blueloveTH 2 år sedan
förälder
incheckning
1e77f369a2
5 ändrade filer med 28 tillägg och 5 borttagningar
  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']:
         cmd = './main'
     elif sys.platform == 'win32':
-        cmd = 'main.exe'
+        cmd = '.\main.exe'
     else:
         cmd = None
 
@@ -80,9 +80,8 @@ else:
 
 
     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()
-        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)
 except ZeroDivisionError:
     pass
+
+assert not 1 < 2 > 3

+ 3 - 0
tests/30_import.py

@@ -27,3 +27,6 @@ def f():
     assert value == 1
 
 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:
     for i in range(5):
         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(type, type) is True
 assert issubclass(float, int) is False
+
+
+def f(a, b):
+    c = a
+    del a
+    return sum([b, c])
+
+assert f(1, 2) == 3