aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/python/argcargvtest_runme.py
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/python/argcargvtest_runme.py')
-rw-r--r--Examples/test-suite/python/argcargvtest_runme.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/Examples/test-suite/python/argcargvtest_runme.py b/Examples/test-suite/python/argcargvtest_runme.py
index b0345746f..52d428b2d 100644
--- a/Examples/test-suite/python/argcargvtest_runme.py
+++ b/Examples/test-suite/python/argcargvtest_runme.py
@@ -6,12 +6,15 @@ if mainc(largs) != 3:
targs = ("hi", "hola")
if mainv(targs, 1) != "hola":
- print(mainv(targs, 1))
raise RuntimeError("bad main typemap")
targs = ("hi", "hola")
+if mainv(targs, 0) != "hi":
+ raise RuntimeError("bad main typemap")
if mainv(targs, 1) != "hola":
raise RuntimeError("bad main typemap")
+if mainv(targs, 2) != "<<NULL>>":
+ raise RuntimeError("bad main typemap")
try:
error = 0
@@ -24,3 +27,28 @@ if error:
initializeApp(largs)
+
+# Check that an empty array works.
+empty_args = []
+if mainc(empty_args) != 0:
+ raise RuntimeError("bad main typemap")
+if mainv(empty_args, 0) != "<<NULL>>":
+ raise RuntimeError("bad main typemap")
+empty_tuple = ()
+if mainc(empty_tuple) != 0:
+ raise RuntimeError("bad main typemap")
+if mainv(empty_tuple, 0) != "<<NULL>>":
+ raise RuntimeError("bad main typemap")
+
+# Check that empty strings are handled.
+empty_string = ["hello", "", "world"]
+if mainc(empty_string) != 3:
+ raise RuntimeError("bad main typemap")
+if mainv(empty_string, 0) != "hello":
+ raise RuntimeError("bad main typemap")
+if mainv(empty_string, 1) != "":
+ raise RuntimeError("bad main typemap")
+if mainv(empty_string, 2) != "world":
+ raise RuntimeError("bad main typemap")
+if mainv(empty_string, 3) != "<<NULL>>":
+ raise RuntimeError("bad main typemap")