We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e18d1aa commit c89a769Copy full SHA for c89a769
1 file changed
ports-py/semantic-tests.py
@@ -0,0 +1,27 @@
1
+import json
2
+import lispy
3
+import numbers
4
+
5
+testTable = []
6
+with open("ports/lispy-tests.json") as file:
7
+ testTable.extend(json.load(file))
8
9
+with open("ports/lispy-tests2.json") as file:
10
11
12
+def matches(structure, target):
13
+ if(isinstance(target, dict) and "type" in target):
14
+ return isinstance(structure, Exception)
15
+ return structure == target
16
17
+for entry in testTable:
18
+ input = entry["input"]
19
+ try:
20
+ evalResult = lispy.eval(lispy.parse(input))
21
+ except Exception as e:
22
+ evalResult = e
23
+ if matches(evalResult, entry["expected"]):
24
+ print(f"✅: {input}")
25
+ else:
26
+ print(f"❌: {input} got {evalResult} instead")
27
0 commit comments