diff options
-rw-r--r-- | src/testsuite/interpreter/testSyntax.input | 7 | ||||
-rw-r--r-- | src/testsuite/interpreter/testSyntax.spad | 53 |
2 files changed, 60 insertions, 0 deletions
diff --git a/src/testsuite/interpreter/testSyntax.input b/src/testsuite/interpreter/testSyntax.input new file mode 100644 index 00000000..fdcbabdb --- /dev/null +++ b/src/testsuite/interpreter/testSyntax.input @@ -0,0 +1,7 @@ +++ Contributed by Yixin Cao +)co "syntax.spad" +sym:=("b")::Symbol +syn:=b::Syntax +test syn + +test() diff --git a/src/testsuite/interpreter/testSyntax.spad b/src/testsuite/interpreter/testSyntax.spad new file mode 100644 index 00000000..9cd16c21 --- /dev/null +++ b/src/testsuite/interpreter/testSyntax.spad @@ -0,0 +1,53 @@ +++ Contibuted by Yixin Cao +)abbrev domain TD TestDomain +import OutputPackage +TestDomain :Public == Private where + Public == with + testCase: Syntax -> Boolean + testCoerceTo: Symbol -> Syntax + testCoerceFrom: Syntax -> Symbol + testBuildSyntax: () -> Syntax + testGetOperator: Syntax -> Syntax + testGetOperator: () -> Syntax + test: Syntax -> Boolean + test: () -> Boolean + + Private == add + testBuildSyntax == + b:=("b")::Symbol + a:=("a")::Symbol + m:=("-")::Symbol + c:=buildSyntax('_*, [a::Syntax, 3::Syntax]) + d:=buildSyntax(m::Syntax, [b::Syntax, c]) + d:=buildSyntax('_-, [3::Syntax, 2::Syntax]) + d + + testCase(x) == + x case Symbol + + testCoerceFrom x == + x case Symbol => coerce(x)@Symbol + + testCoerceTo s == + error "not implemented yet" + + testGetOperator == + (getOperator testBuildSyntax())::Syntax + + test == + test testBuildSyntax() + + test x == + output "testing case function" + testCase x + output "case function works" + + output "testing coerce from Syntax to Symbol" + testCoerceFrom x + output "coerce (from) function works" + + output "testing getOperator function" + testGetOperator() + output "getOperator function works" + + true |