Kaydet (Commit) 56d44e10 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Markus Mohrhard

VBA: unit test for PtrSafe and compiler directives

 #If Vba7
   Declare PtrSafe Function xx
 #Else
   Declare Function xx
 #End if

Change-Id: I807efb9fa68b5ac50f2bd59ba7cfa45c499af189
Reviewed-on: https://gerrit.libreoffice.org/34522Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Tested-by: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 97caa8a8
......@@ -20,12 +20,14 @@ namespace
public:
EnableTest() : BootstrapFixture(true, false) {};
void testDimEnable();
void testWin64();
void testEnableRuntime();
// Adds code needed to register the test suite
CPPUNIT_TEST_SUITE(EnableTest);
// Declares the method as a test to call
CPPUNIT_TEST(testDimEnable);
CPPUNIT_TEST(testWin64);
CPPUNIT_TEST(testEnableRuntime);
// End of test suite definition
......@@ -63,6 +65,21 @@ void EnableTest::testDimEnable()
CPPUNIT_ASSERT_MESSAGE("Dim causes compile error", !myMacro.HasError() );
}
void EnableTest::testWin64()
{
OUStringBuffer aSource1(" #If Win64\n");
aSource1.append("Declare PtrSafe Function aht_apiGetOpenFileName Lib ");
aSource1.append('"');
aSource1.append("comdlg32.dll");
aSource1.append('"');
aSource1.append("\n");
aSource1.append("#End if\n");
MacroSnippet myMacro(aSource1.toString());
myMacro.Compile();
CPPUNIT_ASSERT_MESSAGE("#if Win64 Declare PtrSafe causes compile error", !myMacro.HasError() );
}
// Put the test suite in the registry
CPPUNIT_TEST_SUITE_REGISTRATION(EnableTest);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment