Implement eval_arg and some builtins.
[muddle-interpreter.git] / src / test_bindings
diff --git a/src/test_bindings b/src/test_bindings
new file mode 100755 (executable)
index 0000000..256b2dc
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Copyright (C) 2018 Keziah Wesley
+
+# You can redistribute and/or modify this file under the terms of the
+# GNU Affero General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any
+# later version.
+
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public
+# License along with this file. If not, see
+# <http://www.gnu.org/licenses/>.
+
+assert_eq () {
+    [ "$1" = "$2" ] || ( echo Assertion failed: "\"$1\"" = "\"$2\""; exit 1 )
+}
+
+assert_eq 'ROOT' "$(echo '<SETG BAZ ROOT>' | ./muddle)"
+assert_eq '(ROOT BAZ)' "$(echo '(<SETG BAZ ROOT> BAZ)' | ./muddle)"
+assert_eq '(ROOT ROOT)' "$(echo '(<SETG BAZ ROOT> <GVAL BAZ>)' | ./muddle)"