More tests
This commit is contained in:
2
testdata/arrays.monkey
vendored
Normal file
2
testdata/arrays.monkey
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
let xs = [1, 2, 3]
|
||||
xs[0] + xs[1] + xs[2]
|
||||
3
testdata/assign.monkey
vendored
Normal file
3
testdata/assign.monkey
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
let x = 1
|
||||
x = 2
|
||||
x = x + 1
|
||||
13
testdata/builtins.monkey
vendored
Normal file
13
testdata/builtins.monkey
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
let xs = [1, 2, 3]
|
||||
len(xs)
|
||||
|
||||
first(xs)
|
||||
rest(xs)
|
||||
last(xs)
|
||||
push(xs, 5)
|
||||
pop(xs)
|
||||
|
||||
len("foo")
|
||||
|
||||
let x = input()
|
||||
print(x)
|
||||
2
testdata/closures.monkey
vendored
Normal file
2
testdata/closures.monkey
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
let f = fn(x) { fn() { x + 1 } }
|
||||
f(2)
|
||||
2
testdata/expressions.monkey
vendored
Normal file
2
testdata/expressions.monkey
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
1 + 2;
|
||||
(1 + 2) * 3;
|
||||
2
testdata/functions.monkey
vendored
Normal file
2
testdata/functions.monkey
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
let f = fn(x, y) { x * y };
|
||||
f(2, 4)
|
||||
2
testdata/hashes.monkey
vendored
Normal file
2
testdata/hashes.monkey
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
let d = {"a": 1, "b": 2}
|
||||
d["a"] + d["b"]
|
||||
5
testdata/if.monkey
vendored
Normal file
5
testdata/if.monkey
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
let x = 1
|
||||
if (x == 1) {
|
||||
x = 2
|
||||
x
|
||||
}
|
||||
3
testdata/let.monkey
vendored
Normal file
3
testdata/let.monkey
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
let x = 1
|
||||
let y = 2
|
||||
let z = x
|
||||
2
testdata/strings.monkey
vendored
Normal file
2
testdata/strings.monkey
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
let s = "hello"
|
||||
s + " " + "world"
|
||||
Reference in New Issue
Block a user