=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: vbscript/tests: Test lack of newline parsing before End statements.
Alexandre Julliard
julliard at winehq.org
Mon Sep 9 16:13:37 CDT 2019
Module: wine
Branch: master
Commit: 848c6e4f93b75f14e1e0e4f32c35d424255c6799
URL: https://source.winehq.org/git/wine.git/?a=commit;h=848c6e4f93b75f14e1e0e4f32c35d424255c6799
Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date: Fri Sep 6 18:03:00 2019 +0300
vbscript/tests: Test lack of newline parsing before End statements.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/vbscript/tests/lang.vbs | 28 ++++++++++++++++++++++
dlls/vbscript/tests/run.c | 57 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+)
diff --git a/dlls/vbscript/tests/lang.vbs b/dlls/vbscript/tests/lang.vbs
index 6b45865..5d9fb80 100644
--- a/dlls/vbscript/tests/lang.vbs
+++ b/dlls/vbscript/tests/lang.vbs
@@ -1429,4 +1429,32 @@ sub test_dotIdentifiers
end sub
call test_dotIdentifiers
+' Test End statements not required to be preceeded by a newline or separator
+Sub EndTestSub
+ x = 1 End Sub
+
+Sub EndTestSubWithCall
+ x = 1
+ Call ok(x = 1, "x = " & x)End Sub
+Call EndTestSubWithCall()
+
+Function EndTestFunc(x)
+ Call ok(x > 0, "x = " & x)End Function
+EndTestFunc(1)
+
+Class EndTestClassWithStorageId
+ Public x End Class
+
+Class EndTestClassWithDim
+ Dim x End Class
+
+Class EndTestClassWithFunc
+ Function test(ByVal x)
+ x = 0 End Function End Class
+
+Class EndTestClassWithProperty
+ Public x
+ Public default Property Get defprop
+ defprop = x End Property End Class
+
reportSuccess()
diff --git a/dlls/vbscript/tests/run.c b/dlls/vbscript/tests/run.c
index 15a8f10..f10a42b 100644
--- a/dlls/vbscript/tests/run.c
+++ b/dlls/vbscript/tests/run.c
@@ -2077,6 +2077,62 @@ static void test_gc(void)
IActiveScriptParse_Release(parser);
}
+static void test_parse_errors(void)
+{
+ static const char *invalid_scripts[] =
+ {
+ /* 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"
+ };
+ HRESULT hres;
+ UINT i;
+
+ for (i = 0; i < ARRAY_SIZE(invalid_scripts); i++)
+ {
+ SET_EXPECT(OnScriptError);
+ hres = parse_script_ar(invalid_scripts[i]);
+ ok(FAILED(hres), "[%u] script did not fail\n", i);
+ todo_wine CHECK_CALLED(OnScriptError);
+ }
+}
+
static void test_msgbox(void)
{
HRESULT hres;
@@ -2500,6 +2556,7 @@ static void run_tests(void)
test_procedures();
test_gc();
test_msgbox();
+ test_parse_errors();
test_parse_context();
}
More information about the wine-cvs
mailing list