mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
wrote a simple test for libs
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
assert value == 42, "import/export failed";
|
||||
}
|
||||
|
||||
|
||||
//test functions using import/export
|
||||
{
|
||||
fn f() {
|
||||
@@ -18,6 +19,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//test importing/exporting of functions
|
||||
{
|
||||
fn func() {
|
||||
@@ -32,6 +34,7 @@
|
||||
assert func() == 69, "import/export of functions failed";
|
||||
}
|
||||
|
||||
|
||||
//test that variables retain their types with the typeof keyword
|
||||
{
|
||||
var t: type = int;
|
||||
@@ -45,4 +48,5 @@
|
||||
assert typeof t == type, "type retention failed";
|
||||
}
|
||||
|
||||
|
||||
print "All good";
|
||||
|
||||
10
scripts/test/lib/standard.toy
Normal file
10
scripts/test/lib/standard.toy
Normal file
@@ -0,0 +1,10 @@
|
||||
//test the standard library
|
||||
{
|
||||
import standard;
|
||||
|
||||
//this depends on external factors, so only check the length
|
||||
assert clock().length() == 24, "clock() import failed";
|
||||
}
|
||||
|
||||
|
||||
print "All good";
|
||||
Reference in New Issue
Block a user