undefalias

This commit is contained in:
2021-07-22 16:32:33 -06:00
parent e52ed1abd1
commit b54073fa32
4 changed files with 39 additions and 7 deletions

View File

@@ -23,6 +23,7 @@
(Assert.equals 4 b))
(otherwise
(Assert.fail)))
(case l
([::...rest last]
(Assert.equals (.toString [1 2 3]) (.toString rest))

View File

@@ -23,4 +23,9 @@ class MacroTestCase extends Test {
function testModularMacros() {
Assert.equals("Nat 5", nameAndNumber("Nat", 5));
}
function testUndefAlias() {
Assert.equals(9, print);
Assert.equals(9, aliasValue());
}
}

View File

@@ -35,3 +35,12 @@
(altDefun nameAndNumber [name String number Int]
"$name $number")
// If for whatever reason, you wanted to make a variable called print
(undefalias &call print)
(defvar print 9)
(defalias &ident alias 5)
(undefalias &ident alias)
(defvar alias 9)
(defun aliasValue [] alias)