blueloveTH 2 years ago
parent
commit
1e77f369a2
5 changed files with 28 additions and 5 deletions
  1. 4 5
      scripts/run_tests.py
  2. 2 0
      tests/01_int.py
  3. 3 0
      tests/30_import.py
  4. 11 0
      tests/41_exception.py
  5. 8 0
      tests/99_builtin_func.py

+ 4 - 5
scripts/run_tests.py

@@ -62,7 +62,7 @@ else:
     if sys.platform in ['linux', 'darwin']:
     if sys.platform in ['linux', 'darwin']:
         cmd = './main'
         cmd = './main'
     elif sys.platform == 'win32':
     elif sys.platform == 'win32':
-        cmd = 'main.exe'
+        cmd = '.\main.exe'
     else:
     else:
         cmd = None
         cmd = None
 
 
@@ -80,9 +80,8 @@ else:
 
 
 
 
     print(add(1, 2))
     print(add(1, 2))
-    print(A('abc').get())
-    ''', capture_output=True, check=True)
+    print(A('abc').get())''', capture_output=True, check=True)
         res.check_returncode()
         res.check_returncode()
-        assert res.stdout.endswith('>>> 3\n>>> abc\n>>> ')
+        assert res.stdout.endswith('>>> 3\n>>> abc\n>>> '), res.stdout
 
 
-print("ALL TESTS PASSED")
+print("ALL TESTS PASSED")

+ 2 - 0
tests/01_int.py

@@ -115,3 +115,5 @@ try:
     exit(1)
     exit(1)
 except ZeroDivisionError:
 except ZeroDivisionError:
     pass
     pass
+
+assert not 1 < 2 > 3

+ 3 - 0
tests/30_import.py

@@ -27,3 +27,6 @@ def f():
     assert value == 1
     assert value == 1
 
 
 f()
 f()
+
+from math import *
+assert pi > 3

+ 11 - 0
tests/41_exception.py

@@ -1,3 +1,14 @@
+try:
+    raise 1
+except TypeError:
+    pass
+
+try:
+    assert False
+    exit(1)
+except AssertionError:
+    pass
+
 try:
 try:
     for i in range(5):
     for i in range(5):
         raise KeyError(i)
         raise KeyError(i)

+ 8 - 0
tests/99_builtin_func.py

@@ -674,3 +674,11 @@ assert issubclass(object, object) is True
 assert issubclass(int, type) is False
 assert issubclass(int, type) is False
 assert issubclass(type, type) is True
 assert issubclass(type, type) is True
 assert issubclass(float, int) is False
 assert issubclass(float, int) is False
+
+
+def f(a, b):
+    c = a
+    del a
+    return sum([b, c])
+
+assert f(1, 2) == 3