From 88ea21b2762b3715d3816248953ed7f551cdaa7b Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 5 Oct 2020 01:18:05 +0700 Subject: [PATCH] Add an SML syntax test file. --- tests/syntax-tests/highlighted/SML/sample.sml | 47 +++++++++++++++++++ tests/syntax-tests/source/SML/sample.sml | 47 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 tests/syntax-tests/highlighted/SML/sample.sml create mode 100644 tests/syntax-tests/source/SML/sample.sml diff --git a/tests/syntax-tests/highlighted/SML/sample.sml b/tests/syntax-tests/highlighted/SML/sample.sml new file mode 100644 index 00000000..0c1d7037 --- /dev/null +++ b/tests/syntax-tests/highlighted/SML/sample.sml @@ -0,0 +1,47 @@ +val x = 0 + +val hello = "hello world" + +val id = fn x => x + +fun id' x = x + +val () = print "hello world\n" + +val _ = let + val hello = "hello" + val world = "world" +in + print (hello ^ " " ^ world ^ "\n") +end + +fun isZero n = + if n = 0 then true + else false + +fun isTrue b = + case b of + true => true + | false => false + +exception Bad_value of string + +fun isTrue' b = + case b of + true => true + | _ => raise (Bad_value "value is not true!") + +val alwaysTrue = + isTrue' false handle Bad_value _ => true + +datatype myBool = True | False + +datatype shape = Square of real | Circle of real | Point + +signature FOO = sig + val foo : 'a -> 'a +end + +structure Foo :> FOO = struct + fun foo x = x +end diff --git a/tests/syntax-tests/source/SML/sample.sml b/tests/syntax-tests/source/SML/sample.sml new file mode 100644 index 00000000..17118ec0 --- /dev/null +++ b/tests/syntax-tests/source/SML/sample.sml @@ -0,0 +1,47 @@ +val x = 0 + +val hello = "hello world" + +val id = fn x => x + +fun id' x = x + +val () = print "hello world\n" + +val _ = let + val hello = "hello" + val world = "world" +in + print (hello ^ " " ^ world ^ "\n") +end + +fun isZero n = + if n = 0 then true + else false + +fun isTrue b = + case b of + true => true + | false => false + +exception Bad_value of string + +fun isTrue' b = + case b of + true => true + | _ => raise (Bad_value "value is not true!") + +val alwaysTrue = + isTrue' false handle Bad_value _ => true + +datatype myBool = True | False + +datatype shape = Square of real | Circle of real | Point + +signature FOO = sig + val foo : 'a -> 'a +end + +structure Foo :> FOO = struct + fun foo x = x +end