refactor: move benchmark directory under test and update all references
The benchmark directory is relocated from the project root into the test directory, and all scripts, documentation links, and gitignore paths are updated accordingly. The test runner is also refactored to explicitly walk subdirectories (core, io, language, limit) instead of using a single test root, and a new test/README.md is added to document the test suite structure. Additionally, the constructor test for the Foo class is updated to add a zero-arity constructor and adjust expected output strings.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
IO.print(new Fn {}.arity) // expect: 0
|
||||
IO.print(new Fn {|a| a}.arity) // expect: 1
|
||||
IO.print(new Fn {|a, b| a}.arity) // expect: 2
|
||||
IO.print(new Fn {|a, b, c| a}.arity) // expect: 3
|
||||
IO.print(new Fn {|a, b, c, d| a}.arity) // expect: 4
|
||||
@@ -0,0 +1,16 @@
|
||||
var f0 = new Fn { IO.print("zero") }
|
||||
var f1 = new Fn {|a| IO.print("one ", a) }
|
||||
var f2 = new Fn {|a, b| IO.print("two ", a, " ", b) }
|
||||
var f3 = new Fn {|a, b, c| IO.print("three ", a, " ", b, " ", c) }
|
||||
|
||||
f0.call("a") // expect: zero
|
||||
f0.call("a", "b") // expect: zero
|
||||
|
||||
f1.call("a", "b") // expect: one a
|
||||
f1.call("a", "b", "c") // expect: one a
|
||||
|
||||
f2.call("a", "b", "c") // expect: two a b
|
||||
f2.call("a", "b", "c", "d") // expect: two a b
|
||||
|
||||
f3.call("a", "b", "c", "d") // expect: three a b c
|
||||
f3.call("a", "b", "c", "d", "e") // expect: three a b c
|
||||
@@ -0,0 +1,2 @@
|
||||
var f2 = new Fn {|a, b| IO.print(a, b) }
|
||||
f2.call("a") // expect runtime error: Function expects more arguments.
|
||||
@@ -0,0 +1,16 @@
|
||||
// Not structurally equal.
|
||||
IO.print(new Fn { 123 } == new Fn { 123 }) // expect: false
|
||||
IO.print(new Fn { 123 } != new Fn { 123 }) // expect: true
|
||||
|
||||
// Not equal to other types.
|
||||
IO.print(new Fn { 123 } == 1) // expect: false
|
||||
IO.print(new Fn { 123 } == false) // expect: false
|
||||
IO.print(new Fn { 123 } == "fn 123") // expect: false
|
||||
IO.print(new Fn { 123 } != 1) // expect: true
|
||||
IO.print(new Fn { 123 } != false) // expect: true
|
||||
IO.print(new Fn { 123 } != "fn 123") // expect: true
|
||||
|
||||
// Equal by identity.
|
||||
var f = new Fn { 123 }
|
||||
IO.print(f == f) // expect: true
|
||||
IO.print(f != f) // expect: false
|
||||
@@ -0,0 +1 @@
|
||||
new Fn(3) // expect runtime error: Argument must be a function.
|
||||
@@ -0,0 +1 @@
|
||||
IO.print(new Fn {}) // expect: <fn>
|
||||
@@ -0,0 +1,4 @@
|
||||
IO.print(new Fn { 0 } is Fn) // expect: true
|
||||
IO.print(new Fn { 0 } is Object) // expect: true
|
||||
IO.print(new Fn { 0 } is String) // expect: false
|
||||
IO.print(new Fn { 0 }.type == Fn) // expect: true
|
||||
Reference in New Issue
Block a user