gloo 6.3.1 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CLAUDE.md +13 -0
- data/docs/application.md +9 -0
- data/docs/language_objects.md +78 -0
- data/docs/language_scripting.md +41 -0
- data/docs/objects.md +1 -1
- data/docs/verbs.md +36 -2
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +13 -0
- data/lib/gloo/app/engine.rb +5 -1
- data/lib/gloo/app/log.rb +5 -5
- data/lib/gloo/app/settings.rb +4 -1
- data/lib/gloo/core/obj.rb +60 -1
- data/lib/gloo/core/parser.rb +30 -1
- data/lib/gloo/core/tokens.rb +44 -18
- data/lib/gloo/expr/l_string.rb +8 -4
- data/lib/gloo/objs/basic/script.rb +28 -2
- data/lib/gloo/objs/web/json.rb +4 -1
- data/lib/gloo/persist/comment_buffer.rb +58 -0
- data/lib/gloo/persist/declaration_ledger.rb +61 -0
- data/lib/gloo/persist/disc_mech.rb +15 -2
- data/lib/gloo/persist/file_loader.rb +208 -102
- data/lib/gloo/persist/file_saver.rb +251 -6
- data/lib/gloo/persist/file_storage.rb +10 -4
- data/lib/gloo/persist/indent_stack.rb +90 -0
- data/lib/gloo/persist/line_splitter.rb +18 -3
- data/lib/gloo/persist/persist_man.rb +193 -26
- data/lib/gloo/persist/script_body_collector.rb +102 -0
- data/lib/gloo/persist/shorthand_expander.rb +51 -0
- data/lib/gloo/persist/source/blank_node.rb +27 -0
- data/lib/gloo/persist/source/comment_node.rb +27 -0
- data/lib/gloo/persist/source/directive_node.rb +26 -0
- data/lib/gloo/persist/source/obj_node.rb +91 -0
- data/lib/gloo/persist/source/source_doc.rb +41 -0
- data/lib/gloo/verbs/list.rb +24 -2
- data/lib/gloo/verbs/load.rb +9 -1
- data/lib/gloo/verbs/reload.rb +3 -0
- data/lib/gloo/verbs/save.rb +57 -10
- data/test.gloo/ctrl/each.test.gloo +28 -30
- data/test.gloo/dt/date.test.gloo +69 -71
- data/test.gloo/dt/datetime.test.gloo +55 -57
- data/test.gloo/dt/time.test.gloo +70 -72
- data/test.gloo/lang/continuation.test.gloo +25 -27
- data/test.gloo/lang/convert.test.gloo +50 -52
- data/test.gloo/lang/dt_comparisons.test.gloo +87 -89
- data/test.gloo/lang/exceptions.test.gloo +42 -44
- data/test.gloo/lang/gloo_sys.test.gloo +100 -102
- data/test.gloo/lang/here.test.gloo +32 -34
- data/test.gloo/lang/it.test.gloo +27 -29
- data/test.gloo/lang/literal.test.gloo +55 -57
- data/test.gloo/lang/load_lib_directive.test.gloo +18 -20
- data/test.gloo/lang/naming.test.gloo +28 -30
- data/test.gloo/lang/ops.test.gloo +53 -55
- data/test.gloo/lang/shorthand.test.gloo +27 -0
- data/test.gloo/math/add.test.gloo +40 -42
- data/test.gloo/math/div.test.gloo +23 -25
- data/test.gloo/math/mult.test.gloo +23 -25
- data/test.gloo/math/sub.test.gloo +23 -25
- data/test.gloo/objs/alias.test.gloo +15 -17
- data/test.gloo/objs/bool.test.gloo +54 -56
- data/test.gloo/objs/can.test.gloo +33 -35
- data/test.gloo/objs/cipher.test.gloo +39 -41
- data/test.gloo/objs/decimal.test.gloo +27 -29
- data/test.gloo/objs/erb.test.gloo +47 -49
- data/test.gloo/objs/file.test.gloo +68 -70
- data/test.gloo/objs/function.test.gloo +37 -39
- data/test.gloo/objs/int.test.gloo +54 -56
- data/test.gloo/objs/json.test.gloo +57 -50
- data/test.gloo/objs/obj.test.gloo +68 -48
- data/test.gloo/objs/outline.test.gloo +48 -50
- data/test.gloo/objs/password.test.gloo +34 -36
- data/test.gloo/objs/repeat.test.gloo +42 -44
- data/test.gloo/objs/script.test.gloo +13 -15
- data/test.gloo/objs/string.test.gloo +82 -84
- data/test.gloo/objs/text.test.gloo +90 -92
- data/test.gloo/objs/untyped.test.gloo +36 -38
- data/test.gloo/objs/uri.test.gloo +37 -39
- data/test.gloo/string/str.test.gloo +15 -0
- data/test.gloo/verbs/break.test.gloo +12 -14
- data/test.gloo/verbs/check.test.gloo +22 -24
- data/test.gloo/verbs/context.test.gloo +11 -13
- data/test.gloo/verbs/create.test.gloo +7 -9
- data/test.gloo/verbs/eval.test.gloo +10 -12
- data/test.gloo/verbs/exists.test.gloo +43 -45
- data/test.gloo/verbs/if.test.gloo +8 -10
- data/test.gloo/verbs/invoke.test.gloo +73 -75
- data/test.gloo/verbs/list.test.gloo +21 -23
- data/test.gloo/verbs/load.test.gloo +27 -21
- data/test.gloo/verbs/log.test.gloo +7 -9
- data/test.gloo/verbs/move.test.gloo +12 -14
- data/test.gloo/verbs/put.test.gloo +10 -12
- data/test.gloo/verbs/reload.test.gloo +55 -0
- data/test.gloo/verbs/run.test.gloo +8 -10
- data/test.gloo/verbs/save.test.gloo +111 -0
- data/test.gloo/verbs/show.test.gloo +26 -28
- data/test.gloo/verbs/tell.test.gloo +8 -10
- data/test.gloo/verbs/throw.test.gloo +31 -33
- data/test.gloo/verbs/unless.test.gloo +13 -15
- data/test.gloo/verbs/unload.test.gloo +10 -12
- metadata +14 -1
|
@@ -2,47 +2,45 @@
|
|
|
2
2
|
# Repeat object tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
eval ^^.count = 0
|
|
48
|
-
assert "expected the do script not to run when times is 0"
|
|
5
|
+
tests.objs.repeat [can] :
|
|
6
|
+
|
|
7
|
+
count [int] : 0
|
|
8
|
+
seen [string] :
|
|
9
|
+
|
|
10
|
+
loop [repeat] :
|
|
11
|
+
times [integer] : 4
|
|
12
|
+
index [integer] : 0
|
|
13
|
+
do [script] :
|
|
14
|
+
put tests.objs.repeat.count + 1 into tests.objs.repeat.count
|
|
15
|
+
put tests.objs.repeat.seen + tests.objs.repeat.loop.index into tests.objs.repeat.seen
|
|
16
|
+
|
|
17
|
+
zero [repeat] :
|
|
18
|
+
times [integer] : 0
|
|
19
|
+
index [integer] : 0
|
|
20
|
+
do [script] :
|
|
21
|
+
put tests.objs.repeat.count + 100 into tests.objs.repeat.count
|
|
22
|
+
|
|
23
|
+
runs_the_do_script_n_times [test] :
|
|
24
|
+
description [string] : run executes 'do' once per 'times', and 'index' walks 0..times-1.
|
|
25
|
+
on_test [script] :
|
|
26
|
+
put 0 into ^^.count
|
|
27
|
+
put '' into ^^.seen
|
|
28
|
+
|
|
29
|
+
tell ^^.loop to run
|
|
30
|
+
|
|
31
|
+
eval ^^.count = 4
|
|
32
|
+
assert "expected the do script to run 4 times"
|
|
33
|
+
|
|
34
|
+
eval ^^.seen = '0123'
|
|
35
|
+
assert "expected index to be 0,1,2,3 across the iterations"
|
|
36
|
+
|
|
37
|
+
eval ^^.loop.index = 3
|
|
38
|
+
assert "expected index to be left at times-1 after the run"
|
|
39
|
+
|
|
40
|
+
zero_times_does_nothing [test] :
|
|
41
|
+
description [string] : run with times = 0 never executes 'do'.
|
|
42
|
+
on_test [script] :
|
|
43
|
+
put 0 into ^^.count
|
|
44
|
+
tell ^^.zero to run
|
|
45
|
+
eval ^^.count = 0
|
|
46
|
+
assert "expected the do script not to run when times is 0"
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
# Script tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
objs [can] :
|
|
7
|
-
script [can] :
|
|
5
|
+
tests.objs.script [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
a [script] :
|
|
8
|
+
b [boolean] : true
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
run_script [test] :
|
|
11
|
+
description [string] : Set the value of the script
|
|
12
|
+
on_test [script] :
|
|
13
|
+
put "eval 2 + 5" into ^^.a
|
|
14
|
+
tell ^^.a to run
|
|
15
|
+
eval it = 7
|
|
16
|
+
assert "expected it to be 7"
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
put "eval ^.b = true" into ^^.a
|
|
19
|
+
run ^^.a
|
|
20
|
+
assert "expected it to be true"
|
|
23
21
|
|
|
@@ -2,97 +2,95 @@
|
|
|
2
2
|
# String tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
objs [can] :
|
|
7
|
-
string [can] :
|
|
5
|
+
tests.objs.string [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
s [string] :
|
|
8
|
+
dst [can] :
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
up_down [test] :
|
|
11
|
+
description [string] : Convert string case
|
|
12
|
+
on_test [script] :
|
|
13
|
+
put 'hello' into ^^.s
|
|
14
|
+
tell ^^.s to up
|
|
15
|
+
eval ^^.s = 'HELLO'
|
|
16
|
+
assert "expected string to be uppercase"
|
|
17
|
+
tell ^^.s to down
|
|
18
|
+
eval ^^.s = 'hello'
|
|
19
|
+
assert "expected string to be lowercase"
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
trim [test] :
|
|
22
|
+
description [string] : Trim whitespace from a string
|
|
23
|
+
on_test [script] :
|
|
24
|
+
put ' hello ' into ^^.s
|
|
25
|
+
tell ^^.s to trim
|
|
26
|
+
eval it = 'hello'
|
|
27
|
+
assert "expected trimmed string to equal 'hello'"
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
sub [test] :
|
|
30
|
+
description [string] : Substitute in a string
|
|
31
|
+
on_test [script] :
|
|
32
|
+
put 'hello world' into ^^.s
|
|
33
|
+
tell ^^.s to sub ('world' 'gloo')
|
|
34
|
+
eval it = 'hello gloo'
|
|
35
|
+
assert "expected substituted string to equal 'hello gloo'"
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
count_chars [test] :
|
|
38
|
+
description [string] : Count the characters in a string
|
|
39
|
+
on_test [script] :
|
|
40
|
+
put 'hello' into ^^.s
|
|
41
|
+
tell ^^.s to count_chars
|
|
42
|
+
eval it = 5
|
|
43
|
+
assert "expected 5 characters"
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
split [test] :
|
|
46
|
+
description [string] : Get a substring between two indexes
|
|
47
|
+
on_test [script] :
|
|
48
|
+
put 'one two three' into ^^.s
|
|
49
|
+
tell ^^.s to split (4 7)
|
|
50
|
+
eval it = 'two'
|
|
51
|
+
assert "expected split (4 7) to equal 'two'"
|
|
52
|
+
eval ^^.s = 'one two three'
|
|
53
|
+
assert "expected split to leave the string unchanged"
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
splitl [test] :
|
|
56
|
+
description [string] : Get the substring to the left of an index
|
|
57
|
+
on_test [script] :
|
|
58
|
+
put 'one two three' into ^^.s
|
|
59
|
+
tell ^^.s to splitl (7)
|
|
60
|
+
eval it = 'one two'
|
|
61
|
+
assert "expected splitl (7) to equal 'one two'"
|
|
64
62
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
splitr [test] :
|
|
64
|
+
description [string] : Get the substring from an index to the end
|
|
65
|
+
on_test [script] :
|
|
66
|
+
put 'one two three' into ^^.s
|
|
67
|
+
tell ^^.s to splitr (4)
|
|
68
|
+
eval it = 'two three'
|
|
69
|
+
assert "expected splitr (4) to equal 'two three'"
|
|
72
70
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
split_out_of_range [test] :
|
|
72
|
+
description [string] : Out-of-range split indexes clamp to the string's bounds
|
|
73
|
+
on_test [script] :
|
|
74
|
+
put 'one two three' into ^^.s
|
|
75
|
+
tell ^^.s to split (-5 4)
|
|
76
|
+
eval it = 'one '
|
|
77
|
+
assert "expected split (-5 4) to clamp to 'one '"
|
|
78
|
+
tell ^^.s to split (8 100)
|
|
79
|
+
eval it = 'three'
|
|
80
|
+
assert "expected split (8 100) to clamp to 'three'"
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
82
|
+
split_list [test] :
|
|
83
|
+
description [string] : Split a string into children of a target container
|
|
84
|
+
on_test [script] :
|
|
85
|
+
put 'one,two,three' into ^^.s
|
|
86
|
+
tell ^^.s to split_list (',' ^^.dst)
|
|
87
|
+
eval it = 3
|
|
88
|
+
assert "expected split_list to put the part count into it"
|
|
89
|
+
eval ^^.dst.1 = 'one'
|
|
90
|
+
assert "expected dst.1 to equal 'one'"
|
|
91
|
+
eval ^^.dst.2 = 'two'
|
|
92
|
+
assert "expected dst.2 to equal 'two'"
|
|
93
|
+
eval ^^.dst.3 = 'three'
|
|
94
|
+
assert "expected dst.3 to equal 'three'"
|
|
95
|
+
eval ^^.s = 'one,two,three'
|
|
96
|
+
assert "expected split_list to leave the string unchanged"
|
|
@@ -2,104 +2,102 @@
|
|
|
2
2
|
# Text tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
objs [can] :
|
|
7
|
-
text [can] :
|
|
5
|
+
tests.objs.text [can] :
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
a [text] : BEGIN
|
|
10
8
|
one
|
|
11
9
|
two
|
|
12
10
|
three 3 tree
|
|
13
11
|
END
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
# inside a block every line is literal - '#' lines and blank
|
|
14
|
+
# lines are kept, not treated as comments/blanks
|
|
15
|
+
hashed [text] : BEGIN
|
|
18
16
|
# a heading
|
|
19
17
|
|
|
20
18
|
- a list item
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
19
|
+
END
|
|
20
|
+
|
|
21
|
+
b [string] :
|
|
22
|
+
|
|
23
|
+
verify_text [test] :
|
|
24
|
+
description [string] : Verify the content of the text
|
|
25
|
+
on_test [script] :
|
|
26
|
+
put ^^.a into ^^.b
|
|
27
|
+
check ^^.b for starts_with? (" one")
|
|
28
|
+
assert "expected it to be true"
|
|
29
|
+
|
|
30
|
+
blank [test] :
|
|
31
|
+
description [string] : Check to see if the text is blank
|
|
32
|
+
on_test [script] :
|
|
33
|
+
put '' into ^^.b
|
|
34
|
+
check ^^.b for blank?
|
|
35
|
+
assert "expected text to be blank?"
|
|
36
|
+
|
|
37
|
+
put 'abc' into ^^.b
|
|
38
|
+
check ^^.b for blank?
|
|
39
|
+
refute "expected text to not be blank?"
|
|
40
|
+
|
|
41
|
+
length [test] :
|
|
42
|
+
description [string] : Get the length of the string
|
|
43
|
+
on_test [script] :
|
|
44
|
+
put 'hello' into ^^.b
|
|
45
|
+
tell ^^.b to size
|
|
46
|
+
eval it = 5
|
|
47
|
+
assert "expected length to be 5"
|
|
48
|
+
|
|
49
|
+
count_chars [test] :
|
|
50
|
+
description [string] : Get the number of characters
|
|
51
|
+
on_test [script] :
|
|
52
|
+
put 'hello world' into ^^.b
|
|
53
|
+
tell ^^.b to count_chars
|
|
54
|
+
eval it = 11
|
|
55
|
+
assert "expected text to have 11 characters"
|
|
56
|
+
|
|
57
|
+
count_words [test] :
|
|
58
|
+
description [string] : Get the number of words
|
|
59
|
+
on_test [script] :
|
|
60
|
+
tell ^^.a to count_words
|
|
61
|
+
eval it = 5
|
|
62
|
+
assert "expected text to have 5 words"
|
|
63
|
+
|
|
64
|
+
count_lines [test] :
|
|
65
|
+
description [string] : Get the number of lines
|
|
66
|
+
on_test [script] :
|
|
67
|
+
tell ^^.a to count_lines
|
|
68
|
+
eval it = 3
|
|
69
|
+
assert "expected text to have 3 lines"
|
|
70
|
+
|
|
71
|
+
block_keeps_hash_and_blank_lines [test] :
|
|
72
|
+
description [string] : a BEGIN/END block keeps '#' lines and blank lines verbatim
|
|
73
|
+
on_test [script] :
|
|
74
|
+
check ^^.hashed for substring? ( "# a heading" )
|
|
75
|
+
assert "expected the '#' line to be kept, not stripped as a comment"
|
|
76
|
+
|
|
77
|
+
check ^^.hashed for substring? ( "- a list item" )
|
|
78
|
+
assert "expected content after the blank line to be kept"
|
|
79
|
+
|
|
80
|
+
tell ^^.hashed to count_lines
|
|
81
|
+
eval it = 3
|
|
82
|
+
assert "expected 3 lines: heading, blank, list item"
|
|
83
|
+
|
|
84
|
+
starts_with [test] :
|
|
85
|
+
description [string] : Check if the string starts with a value
|
|
86
|
+
on_test [script] :
|
|
87
|
+
put 'hello' into ^^.b
|
|
88
|
+
tell ^^.b to starts_with? ('he')
|
|
89
|
+
assert "expected it to be true that it starts with 'he'"
|
|
90
|
+
|
|
91
|
+
ends_with [test] :
|
|
92
|
+
description [string] : Check if the string ends with a value
|
|
93
|
+
on_test [script] :
|
|
94
|
+
put 'hello' into ^^.b
|
|
95
|
+
tell ^^.b to ends_with? ('lo')
|
|
96
|
+
assert "expected it to be true that it ends with 'lo'"
|
|
97
|
+
|
|
98
|
+
contains [test] :
|
|
99
|
+
description [string] : Check if the string contains a value
|
|
100
|
+
on_test [script] :
|
|
101
|
+
put 'hello world' into ^^.b
|
|
102
|
+
tell ^^.b to substring? ('lo w')
|
|
103
|
+
assert "expected it to be true that it contains 'lo w'"
|
|
@@ -2,42 +2,40 @@
|
|
|
2
2
|
# Untyped object tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
check ^^.a for responds_to? ( "up" )
|
|
42
|
-
refute "expected an untyped object to not respond to 'up'"
|
|
5
|
+
tests.objs.untyped [can] :
|
|
6
|
+
|
|
7
|
+
a [any] :
|
|
8
|
+
|
|
9
|
+
test_untyped [test] :
|
|
10
|
+
description [string] : Test untyped with different values
|
|
11
|
+
on_test [script] :
|
|
12
|
+
put "hello" into ^^.a
|
|
13
|
+
eval ^^.a = "hello"
|
|
14
|
+
assert "expected it to be hello"
|
|
15
|
+
|
|
16
|
+
put 123 into ^^.a
|
|
17
|
+
eval ^^.a = 123
|
|
18
|
+
assert "expected it to be 123"
|
|
19
|
+
|
|
20
|
+
put true into ^^.a
|
|
21
|
+
eval ^^.a = true
|
|
22
|
+
assert "expected it to be true"
|
|
23
|
+
|
|
24
|
+
base_messages_work [test] :
|
|
25
|
+
description [string] : an untyped object still receives the base object messages
|
|
26
|
+
on_test [script] :
|
|
27
|
+
put "" into ^^.a
|
|
28
|
+
check ^^.a for blank?
|
|
29
|
+
assert "expected an empty untyped object to be blank"
|
|
30
|
+
|
|
31
|
+
put "x" into ^^.a
|
|
32
|
+
check ^^.a for blank?
|
|
33
|
+
refute "expected a non-empty untyped object to not be blank"
|
|
34
|
+
|
|
35
|
+
type_messages_do_not [test] :
|
|
36
|
+
description [string] : an untyped object does not receive type-specific messages
|
|
37
|
+
on_test [script] :
|
|
38
|
+
put "hello" into ^^.a
|
|
39
|
+
check ^^.a for responds_to? ( "up" )
|
|
40
|
+
refute "expected an untyped object to not respond to 'up'"
|
|
43
41
|
|