[PATCH 2/2] vbscript/tests: Test lack of newline parsing before End statements.
Gabriel Ivăncescu
gabrielopcode at gmail.com
Thu Sep 5 07:48:06 CDT 2019
Signed-off-by: Gabriel IvÄncescu <gabrielopcode at gmail.com>
---
dlls/vbscript/tests/run.c | 99 +++++++++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c
index 15a8f10..87540a3 100644
--- a/dlls/vbscript/tests/run.c
+++ b/dlls/vbscript/tests/run.c
@@ -2077,6 +2077,104 @@ static void test_gc(void)
IActiveScriptParse_Release(parser);
}
+static void test_end_parse_without_nl(void)
+{
+ static const char *invalid[] =
+ {
+ /* If...End If */
+ "If 0 > 1 Then\n"
+ " x = 0 End If\n",
+
+ /* While...End While */
+ "While False\n"
+ " x = 0 End While\n",
+
+ /* While...Wend */
+ "While False\n"
+ " x = 0 Wend\n",
+
+ /* Do While...Loop */
+ "Do While False\n"
+ " x = 0 Loop\n",
+
+ /* Do Until...Loop */
+ "Do Until True\n"
+ " x = 0 Loop\n",
+
+ /* Do...Loop While */
+ "Do\n"
+ " x = 0 Loop While False\n",
+
+ /* Do...Loop Until */
+ "Do\n"
+ " x = 0 Loop Until True\n",
+
+ /* Select...End Select */
+ "x = False\n"
+ "Select Case 42\n"
+ " Case 0\n"
+ " Call ok(False, \"unexpected case\")\n"
+ " Case 42\n"
+ " x = True End Select\n"
+ "Call ok(x, \"wrong case\")\n",
+
+ /* Class...End Class (empty) */
+ "Class C End Class"
+ };
+ static const char *valid[] =
+ {
+ /* Sub...End Sub */
+ "Sub test\n"
+ " x = 42 End Sub\n",
+
+ /* Sub...End Sub (with a Call) */
+ "Sub test\n"
+ " x = 42\n"
+ " Call ok(x = 42, \"x = \" & x)End Sub\n"
+ "Call test()",
+
+ /* Function...End Function (with a Call) */
+ "Function test(x)\n"
+ " Call ok(x > 0, \"x = \" & x)End Function\n"
+ "test(1)",
+
+ /* Class...End Class (with storage identifier) */
+ "Class C\n"
+ " Public x End Class\n",
+
+ /* Class...End Class (with Dim decl) */
+ "Class C\n"
+ " Dim x End Class\n",
+
+ /* Class...End Class (with Function decl) */
+ "Class C\n"
+ " Function test(ByVal x)\n"
+ " x = 0 End Function End Class\n",
+
+ /* Property...End Property */
+ "Class C\n"
+ " Public x\n"
+ " Public default Property Get defprop\n"
+ " defprop = x End Property End Class\n"
+ };
+ HRESULT hres;
+ UINT i;
+
+ for (i = 0; i < ARRAY_SIZE(invalid); i++)
+ {
+ SET_EXPECT(OnScriptError);
+ hres = parse_script_ar(invalid[i]);
+ ok(FAILED(hres), "[%u] script did not fail\n", i);
+ todo_wine CHECK_CALLED(OnScriptError);
+ }
+
+ for (i = 0; i < ARRAY_SIZE(valid); i++)
+ {
+ hres = parse_script_ar(valid[i]);
+ ok(SUCCEEDED(hres), "[%u] script failed\n", i);
+ }
+}
+
static void test_msgbox(void)
{
HRESULT hres;
@@ -2499,6 +2597,7 @@ static void run_tests(void)
test_procedures();
test_gc();
+ test_end_parse_without_nl();
test_msgbox();
test_parse_context();
}
--
2.21.0
More information about the wine-devel
mailing list