From: fennecdjay Date: Thu, 19 Sep 2019 01:10:07 +0000 (+0200) Subject: :white_check_mark: Add tests X-Git-Tag: nightly~2216^2 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=refs%2Fpull%2F145%2Fhead;p=gwion.git :white_check_mark: Add tests --- diff --git a/tests/match/assign.gw b/tests/match/assign.gw new file mode 100644 index 00000000..fb9915fa --- /dev/null +++ b/tests/match/assign.gw @@ -0,0 +1,4 @@ +#! [contains] ok +match "ok" { + case v: <<< v >>>; +} diff --git a/tests/match/litteral.gw b/tests/match/litteral.gw new file mode 100644 index 00000000..559b0b8b --- /dev/null +++ b/tests/match/litteral.gw @@ -0,0 +1,6 @@ +#! [contains] ok + +match 1 { + case 1: <<< "ok" >>>; + case 2: <<< "not ok" >>>; +} diff --git a/tests/match/litteral_when.gw b/tests/match/litteral_when.gw new file mode 100644 index 00000000..0c58221e --- /dev/null +++ b/tests/match/litteral_when.gw @@ -0,0 +1,6 @@ +#! [contains] ok + +match 1 { + case 1 when 1 : <<< "ok" >>>; + case 1: <<< "ok" >>>; +} diff --git a/tests/match/litteral_when_fail.gw b/tests/match/litteral_when_fail.gw new file mode 100644 index 00000000..d86c2f0d --- /dev/null +++ b/tests/match/litteral_when_fail.gw @@ -0,0 +1,6 @@ +#! [contains] ok + +match 1 { + case 1 when 0 : <<< "not ok" >>>; + case 1: <<< "ok" >>>; +} diff --git a/tests/match/too_many.gw b/tests/match/too_many.gw new file mode 100644 index 00000000..67e905ca --- /dev/null +++ b/tests/match/too_many.gw @@ -0,0 +1,4 @@ +#! [contains] too many expression to match +match 1 { + case a,b: <<< "WHAT?" >>>; +} diff --git a/tests/match/tuple.c b/tests/match/tuple.c new file mode 100644 index 00000000..90dbff2a --- /dev/null +++ b/tests/match/tuple.c @@ -0,0 +1,12 @@ +class C { + string name; + int age; +} + +C charles; +"charles" => charles.name; +21 => charles.age; + +match charles { + case >(name, age): <<< name , " is ", age, " years old." >>>; +}