Patched segault in parser

This commit is contained in:
2023-02-09 12:37:18 +00:00
parent 932401c26d
commit e946a5f071
4 changed files with 7 additions and 49 deletions

View File

@@ -1,50 +1,6 @@
//test the standard library, under a number of different circumstances
//test basic import
{
import standard;
//this depends on external factors, so only check the length
assert clock().length() == 24, "import library failed";
}
import compound;
var arr: [int] = [1, 2, 3];
fn f(_, v: int): int { return v + 1; }
print arr.map(f);
//test import within a function
{
fn f() {
import standard;
assert clock != null, "import library within function failed";
return clock;
}
//invoke
assert f()().length() == 24, "import library within function and return failed";
}
//test closing over standard library element
{
import standard;
fn f() {
assert clock != null, "import library outside function failed";
return clock;
}
//invoke
assert f()().length() == 24, "import library outside function and return failed";
}
//test importing as an alias
{
import standard as std;
assert std["clock"]().length() == 24, "import library as alias failed";
}
print "All good";