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,42 +2,40 @@
|
|
|
2
2
|
# URI 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
|
-
result [string] :
|
|
5
|
+
tests.objs.uri [can] :
|
|
6
|
+
|
|
7
|
+
link [uri] : https://example.com:8443/docs/guide?page=3&sort=asc#install
|
|
8
|
+
bare [uri] : https://example.com
|
|
9
|
+
|
|
10
|
+
parts_of_a_url [test] :
|
|
11
|
+
description [string] : the get_ messages pull each piece of the URL into it.
|
|
12
|
+
on_test [script] :
|
|
13
|
+
tell ^^.link to get_scheme
|
|
14
|
+
eval it = 'https'
|
|
15
|
+
assert "expected scheme https"
|
|
16
|
+
|
|
17
|
+
tell ^^.link to get_host
|
|
18
|
+
eval it = 'example.com'
|
|
19
|
+
assert "expected host example.com (no port)"
|
|
20
|
+
|
|
21
|
+
tell ^^.link to get_path
|
|
22
|
+
eval it = '/docs/guide'
|
|
23
|
+
assert "expected path /docs/guide"
|
|
24
|
+
|
|
25
|
+
tell ^^.link to get_query
|
|
26
|
+
eval it = 'page=3&sort=asc'
|
|
27
|
+
assert "expected the query string"
|
|
28
|
+
|
|
29
|
+
tell ^^.link to get_fragment
|
|
30
|
+
eval it = 'install'
|
|
31
|
+
assert "expected fragment install"
|
|
32
|
+
|
|
33
|
+
missing_pieces [test] :
|
|
34
|
+
description [string] : a bare URL has an empty path.
|
|
35
|
+
on_test [script] :
|
|
36
|
+
tell ^^.bare to get_path
|
|
37
|
+
put it into tests.objs.uri.result
|
|
38
|
+
check tests.objs.uri.result for blank?
|
|
39
|
+
assert "expected the path of a bare URL to be blank"
|
|
40
|
+
|
|
41
|
+
result [string] :
|
|
@@ -21,6 +21,21 @@ tests [can] :
|
|
|
21
21
|
eval ^^.s = "hello world"
|
|
22
22
|
assert "expected s to be 'hello world'"
|
|
23
23
|
|
|
24
|
+
put_a_quote_containing_value [test] :
|
|
25
|
+
description [string] : Put a literal that contains quote characters
|
|
26
|
+
on_test [script] :
|
|
27
|
+
put '{"x":1}' into ^^.s
|
|
28
|
+
eval ^^.s = '{"x":1}'
|
|
29
|
+
assert "expected s to hold the JSON string"
|
|
30
|
+
|
|
31
|
+
put "it's here" into ^^.s
|
|
32
|
+
eval ^^.s = "it's here"
|
|
33
|
+
assert "expected s to hold the apostrophe string"
|
|
34
|
+
|
|
35
|
+
put "say \"hi\"" into ^^.s
|
|
36
|
+
eval ^^.s = 'say "hi"'
|
|
37
|
+
assert "expected s to hold the unescaped double-quote string"
|
|
38
|
+
|
|
24
39
|
blank [test] :
|
|
25
40
|
description [string] : Check to see if the string is blank
|
|
26
41
|
on_test [script] :
|
|
@@ -2,21 +2,19 @@
|
|
|
2
2
|
# Break verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
break [can] :
|
|
5
|
+
tests.verbs.break [can] :
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
b [bool] : true
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
s [script] :
|
|
10
|
+
if ^.b then break
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
# Should not get here
|
|
13
|
+
put false into ^.b
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
break [test] :
|
|
16
|
+
description [string] : Break out of a script
|
|
17
|
+
on_test [script] :
|
|
18
|
+
tell ^^.s to run
|
|
19
|
+
eval ^^.b
|
|
20
|
+
assert "expected b to be true"
|
|
@@ -2,34 +2,32 @@
|
|
|
2
2
|
# Check verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
check [can] :
|
|
5
|
+
tests.verbs.check [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
c [container] :
|
|
8
|
+
a [string] : "a"
|
|
9
|
+
t [container] :
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
check_contains [test] :
|
|
12
|
+
description [string] : Check an object for containment
|
|
13
|
+
on_test [script] :
|
|
14
|
+
check ^^.c for contains?
|
|
15
|
+
assert "expected c to contain a"
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
check ^^.t for contains?
|
|
18
|
+
refute "expected t to not contain a"
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
check ^^.c.a for contains?
|
|
21
|
+
refute "expected a to not be a container"
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
check_blank [test] :
|
|
24
|
+
description [string] : Check an object for blankness
|
|
25
|
+
on_test [script] :
|
|
26
|
+
check ^^.c for blank?
|
|
27
|
+
refute "expected c to not be blank"
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
check ^^.t for blank?
|
|
30
|
+
assert "expected t to be blank"
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
check ^^.c.a for blank?
|
|
33
|
+
refute "expected a to not be blank"
|
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
# Context verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
context [can] :
|
|
5
|
+
tests.verbs.context [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
set_context [test] :
|
|
8
|
+
description [string] : context {path} sets the context and puts the path in it.
|
|
9
|
+
on_test [script] :
|
|
10
|
+
context tests.verbs.context
|
|
11
|
+
eval it = 'tests.verbs.context'
|
|
12
|
+
assert "expected it to be the new context path"
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
# restore, so later tests run at root
|
|
15
|
+
context root
|
|
16
|
+
eval it = 'root'
|
|
17
|
+
assert "expected context to be restored to root"
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
# Create verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
create [can] :
|
|
5
|
+
tests.verbs.create [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
create_str [test] :
|
|
8
|
+
description [string] : Create sets it to the initial value.
|
|
9
|
+
on_test [script] :
|
|
10
|
+
create cx as string : 'hello'
|
|
11
|
+
eval it = 'hello'
|
|
12
|
+
assert "expected it to equal the created value"
|
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
# Eval verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
eval [can] :
|
|
5
|
+
tests.verbs.eval [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
eval_expr [test] :
|
|
8
|
+
description [string] : Evaluate an expression.
|
|
9
|
+
on_test [script] :
|
|
10
|
+
eval 1 + 1 = 2
|
|
11
|
+
assert "expected 1 + 1 to equal 2"
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
eval true
|
|
14
|
+
assert "expected true to be true"
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
eval false
|
|
17
|
+
refute "expected false to be false"
|
|
@@ -2,48 +2,46 @@
|
|
|
2
2
|
# Exists verb 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
|
-
|
|
48
|
-
exists? instance tests.verbs.exists.instance2
|
|
49
|
-
refute "expected instance to not exist"
|
|
5
|
+
tests.verbs.exists [can] :
|
|
6
|
+
|
|
7
|
+
verb [test] :
|
|
8
|
+
description [string] : Check on existance of exists verb
|
|
9
|
+
on_test [script] :
|
|
10
|
+
exists? verb exists?
|
|
11
|
+
assert "expected exists? to exist"
|
|
12
|
+
|
|
13
|
+
exists? verb does_not_exist
|
|
14
|
+
refute "expected does_not_exist to not exist"
|
|
15
|
+
|
|
16
|
+
object [test] :
|
|
17
|
+
description [string] : Check on existance of exists object type
|
|
18
|
+
on_test [script] :
|
|
19
|
+
exists? object container
|
|
20
|
+
assert "expected container to exist"
|
|
21
|
+
|
|
22
|
+
exists? object can
|
|
23
|
+
assert "expected can to exist"
|
|
24
|
+
|
|
25
|
+
exists? object does_not_exist
|
|
26
|
+
refute "expected does_not_exist to not exist"
|
|
27
|
+
|
|
28
|
+
any_v_or_o [test] :
|
|
29
|
+
description [string] : Check on existance of any type
|
|
30
|
+
on_test [script] :
|
|
31
|
+
exists? str
|
|
32
|
+
assert "expected str to exist"
|
|
33
|
+
|
|
34
|
+
exists? show
|
|
35
|
+
assert "expected show to exist"
|
|
36
|
+
|
|
37
|
+
exists? does_not_exist
|
|
38
|
+
refute "expected does_not_exist to not exist"
|
|
39
|
+
|
|
40
|
+
instance [test] :
|
|
41
|
+
description [string] : Check on existance of objects.
|
|
42
|
+
on_test [script] :
|
|
43
|
+
exists? instance tests.verbs.exists.instance
|
|
44
|
+
assert "expected instance to exist"
|
|
45
|
+
|
|
46
|
+
exists? instance tests.verbs.exists.instance2
|
|
47
|
+
refute "expected instance to not exist"
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
# If verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
if [can] :
|
|
5
|
+
tests.verbs.if [can] :
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
b [bool] : true
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
if_test [test] :
|
|
10
|
+
description [string] : If true then evaluate
|
|
11
|
+
on_test [script] :
|
|
12
|
+
eval false
|
|
13
|
+
if ^^.b then eval true
|
|
14
|
+
assert "expected b to be true"
|
|
@@ -2,92 +2,90 @@
|
|
|
2
2
|
# Invoke verb tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
verbs [can] :
|
|
7
|
-
invoke [can] :
|
|
5
|
+
tests.verbs.invoke [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
f [ƒ] :
|
|
8
|
+
params [can] :
|
|
9
|
+
on_invoke [script] :
|
|
10
|
+
put 42 into ^.result
|
|
11
|
+
result [int] :
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
invoke_test [test] :
|
|
14
|
+
description [string] : Invoke a function and check the result.
|
|
15
|
+
on_test [script] :
|
|
16
|
+
invoke tests.verbs.invoke.f
|
|
17
|
+
eval it = 42
|
|
18
|
+
assert "expected it to be 42"
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
add [ƒ] :
|
|
21
|
+
on_invoke [script] :
|
|
22
|
+
put ^.params.x + ^.params.y into ^.result
|
|
23
|
+
params [can] :
|
|
24
|
+
x [int] :
|
|
25
|
+
y [int] :
|
|
26
|
+
result [int] :
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
total [int] :
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
inline_invoke_in_show_test [test] :
|
|
31
|
+
description [string] : Inline invoke( ... ) works inside show.
|
|
32
|
+
on_test [script] :
|
|
33
|
+
show invoke( tests.verbs.invoke.add 3 4 )
|
|
34
|
+
eval it = 7
|
|
35
|
+
assert "expected it to be 7"
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
inline_shortcut_in_show_test [test] :
|
|
38
|
+
description [string] : Inline ~>( ... ) works inside show, same as invoke( ... ).
|
|
39
|
+
on_test [script] :
|
|
40
|
+
show ~>( tests.verbs.invoke.add 3 4 )
|
|
41
|
+
eval it = 7
|
|
42
|
+
assert "expected it to be 7"
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
inline_invoke_with_operator_test [test] :
|
|
45
|
+
description [string] : Inline invoke( ... ) composes with an operator.
|
|
46
|
+
on_test [script] :
|
|
47
|
+
show "Total: " + invoke( tests.verbs.invoke.add 3 4 )
|
|
48
|
+
eval it = "Total: 7"
|
|
49
|
+
assert "expected it to be 'Total: 7'"
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
inline_invoke_in_put_test [test] :
|
|
52
|
+
description [string] : Inline invoke( ... ) works inside put ... into.
|
|
53
|
+
on_test [script] :
|
|
54
|
+
put 0 into ^^.total
|
|
55
|
+
put invoke( tests.verbs.invoke.add 3 4 ) into ^^.total
|
|
56
|
+
eval ^^.total = 7
|
|
57
|
+
assert "expected total to be 7"
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
inline_invoke_in_if_test [test] :
|
|
60
|
+
description [string] : Inline invoke( ... ) works inside if.
|
|
61
|
+
on_test [script] :
|
|
62
|
+
eval false
|
|
63
|
+
if invoke( tests.verbs.invoke.add 3 4 ) = 7 then eval true
|
|
64
|
+
assert "expected the if branch to have run"
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
err_fired [bool] : false
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
on_error [script] :
|
|
69
|
+
put true into ^.err_fired
|
|
72
70
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
inline_invoke_error_test [test] :
|
|
72
|
+
description [string] : Inline invoke( ... ) reports an error for an unresolved target, same as the standalone verb.
|
|
73
|
+
on_test [script] :
|
|
74
|
+
put false into ^^.err_fired
|
|
75
|
+
show invoke( tests.verbs.invoke.no_such_function )
|
|
76
|
+
eval ^^.err_fired = true
|
|
77
|
+
assert "expected on_error to have fired for an unresolved inline call target"
|
|
80
78
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
greet [ƒ] :
|
|
80
|
+
on_invoke [script] :
|
|
81
|
+
put 'Hi, ' + ^.params.name into ^.result
|
|
82
|
+
params [can] :
|
|
83
|
+
name [string] :
|
|
84
|
+
result [string] :
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
inline_invoke_with_quoted_arg_test [test] :
|
|
87
|
+
description [string] : A quoted string arg inside invoke( ... ) is passed through as one arg, not split on its internal space.
|
|
88
|
+
on_test [script] :
|
|
89
|
+
show invoke( tests.verbs.invoke.greet "Bob Smith" )
|
|
90
|
+
eval it = "Hi, Bob Smith"
|
|
91
|
+
assert "expected it to be 'Hi, Bob Smith'"
|
|
@@ -5,30 +5,28 @@
|
|
|
5
5
|
# behaviour rather than its output.
|
|
6
6
|
#
|
|
7
7
|
|
|
8
|
-
tests [can] :
|
|
9
|
-
verbs [can] :
|
|
10
|
-
list [can] :
|
|
8
|
+
tests.verbs.list [can] :
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
data [can] :
|
|
11
|
+
a [string] : A
|
|
12
|
+
b [string] : B
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
err_fired [bool] : false
|
|
15
|
+
on_error [script] :
|
|
16
|
+
put true into ^.err_fired
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
list_real_container [test] :
|
|
19
|
+
description [string] : listing a real container does not fire on_error.
|
|
20
|
+
on_test [script] :
|
|
21
|
+
put false into ^^.err_fired
|
|
22
|
+
list tests.verbs.list.data
|
|
23
|
+
eval ^^.err_fired = false
|
|
24
|
+
assert "listing a real container should not fire on_error"
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
list_missing_target [test] :
|
|
27
|
+
description [string] : listing a missing target fires on_error.
|
|
28
|
+
on_test [script] :
|
|
29
|
+
put false into ^^.err_fired
|
|
30
|
+
list tests.verbs.list.no_such_thing
|
|
31
|
+
eval ^^.err_fired = true
|
|
32
|
+
assert "listing a missing target should fire on_error"
|