File tree Expand file tree Collapse file tree 8 files changed +120
-37
lines changed
java/org/byteskript/skript/test Expand file tree Collapse file tree 8 files changed +120
-37
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
2
+ function old:
3
+ trigger:
4
+ set {conf} to hello.csk:
5
+ add "key: bean" to {conf}
6
+ assert "key" from {conf} is "bean"
7
+ add "key: value" to {conf}
8
+ assert "key" from {conf} is "value"
9
+ set "thing" from {conf} to "hello there!"
10
+ assert "thing" from {conf} is "hello there!"
11
+ delete hello.csk
12
+ set {conf2} to a new config
13
+ add "key: bean" to {conf2}
14
+ assert "key" from {conf2} is "bean"
15
+ save config {conf2} to hello.csk
16
+ set {conf} to hello.csk
17
+ assert "key" from {conf} is "bean"
18
+ delete hello.csk
19
+
2
20
function test:
3
21
trigger:
4
22
assert hello.csk exists
@@ -7,4 +25,6 @@ function test:
7
25
assert {config} exists
8
26
delete {config}
9
27
delete hello.csk
28
+ run old()
10
29
return true
30
+
Original file line number Diff line number Diff line change 1
1
2
-
3
- function file:
2
+ function test:
4
3
trigger:
5
4
set {file} to a new file at "test.txt"
6
5
assert "" + {file} is "test.txt": "File name is wrong."
@@ -14,4 +13,5 @@ function file:
14
13
assert {line} is "general kenobi": "File read/write by stream failed."
15
14
close {reader}
16
15
delete file {file}
16
+ return true
17
17
Original file line number Diff line number Diff line change
1
+
2
+ function test:
3
+ trigger:
4
+ set {var} to a new runnable:
5
+ assert true
6
+ assert result of {var} is null
7
+ set {var} to a new supplier:
8
+ return true
9
+ assert result of {var} is true
10
+ set {var} to a new supplier:
11
+ return 23
12
+ assert result of {var} > 22
13
+ return true
Original file line number Diff line number Diff line change
1
+
2
+ function blob:
3
+ trigger:
4
+ set {_var} to 1
5
+
6
+ function blob (number):
7
+ trigger:
8
+ set {_var} to {number}
9
+
10
+ function test:
11
+ trigger:
12
+ set {var} to a new runnable:
13
+ set {_var} to 3
14
+ run {var}
15
+ assert {_var} is 3
16
+ run blob()
17
+ assert {_var} is 1
18
+ run blob(2)
19
+ assert {_var} is 2
20
+ return true
Original file line number Diff line number Diff line change
1
+
2
+ function blob (@var):
3
+ trigger:
4
+ set {@var} to 1
5
+
6
+ function test:
7
+ trigger:
8
+ set {thread} to the current process
9
+ set {@thing} to false
10
+ set {var} to a new runnable:
11
+ wait 1 milliseconds
12
+ set {@thing} to true
13
+ wake {thread}
14
+ assert {@thing} is false
15
+ run {var} in the background
16
+ delete {@thing}
17
+ assert {@thing} is null
18
+ sleep
19
+ assert {@thing} is true
20
+ delete {@thing}
21
+ set {@var} to 0
22
+ set {var} to a new runnable:
23
+ set {@var} to 3
24
+ run {var} in the background
25
+ while {@var} is not 3:
26
+ wait 1 millisecond
27
+ assert {@var} is 3
28
+ run blob({@var}) in the background
29
+ while {@var} is not 1:
30
+ wait 1 millisecond
31
+ assert {@var} is 1
32
+ return true
Original file line number Diff line number Diff line change
1
+
2
+
3
+ function blob (a, b):
4
+ trigger:
5
+ set {_var} to {a} + " " + {b}
6
+
7
+ function blob (number):
8
+ trigger:
9
+ set {_var} to {number}
10
+
11
+ function test:
12
+ trigger:
13
+ set {func} to function "blob(number)"
14
+ run {func} with 2
15
+ assert {_var} is 2
16
+ set {func} to function "blob(a, b)"
17
+ run {func} with ("hello", "there")
18
+ assert {_var} is "hello there"
19
+ return true
Original file line number Diff line number Diff line change
1
+
2
+ function blob (var):
3
+ trigger:
4
+ set {!var} to {var}
5
+
6
+ function test:
7
+ trigger:
8
+ set {func} to function "blob(@var)"
9
+ run {func} with 3 in the background
10
+ while {!var} is not 3:
11
+ wait 1 millisecond
12
+ assert {!var} is 3
13
+ delete {!var}
14
+ return true
You can’t perform that action at this time.
0 commit comments