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,46 +2,44 @@
|
|
|
2
2
|
# Container tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
objs [can] :
|
|
7
|
-
can [can] :
|
|
5
|
+
tests.objs.can [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
a [can] :
|
|
8
|
+
b [string] : "b"
|
|
9
|
+
c [string] : "c"
|
|
10
|
+
d [string] : "d"
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
count_children [test] :
|
|
13
|
+
description [string] : Verify the number of children
|
|
14
|
+
on_test [script] :
|
|
15
|
+
tell tests.objs.can.a to count
|
|
16
|
+
eval it = 3
|
|
17
|
+
assert "expected it to be 3"
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
test_contains [test] :
|
|
20
|
+
description [string] : Verify the container contains
|
|
21
|
+
on_test [script] :
|
|
22
|
+
check tests.objs.can.a for contains?
|
|
23
|
+
assert "expected can to contains"
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
check tests.objs.can.a.b for contains?
|
|
26
|
+
refute "expected string to not contains"
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
create_container [test] :
|
|
29
|
+
description [string] : Create a container and verify
|
|
30
|
+
on_test [script] :
|
|
31
|
+
create tests.objs.can.c as container
|
|
32
|
+
tell tests.objs.can.c to count
|
|
33
|
+
eval it = 0
|
|
34
|
+
assert "expected it to be 0"
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
create tests.objs.can.c.s as string
|
|
37
|
+
tell tests.objs.can.c to count
|
|
38
|
+
eval it = 1
|
|
39
|
+
assert "expected it to be 1"
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
tell tests.objs.can.c to delete_children
|
|
42
|
+
tell tests.objs.can.c to count
|
|
43
|
+
eval it = 0
|
|
44
|
+
assert "expected it to be 0"
|
|
47
45
|
|
|
@@ -2,44 +2,42 @@
|
|
|
2
2
|
# Cipher 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
|
-
eval tests.objs.cipher.b.data = ^^.plaintext
|
|
45
|
-
assert "expected the second cipher to decrypt with the shared key"
|
|
5
|
+
tests.objs.cipher [can] :
|
|
6
|
+
|
|
7
|
+
plaintext [string] : attack at dawn
|
|
8
|
+
|
|
9
|
+
round_trip [test] :
|
|
10
|
+
description [string] : encrypt then decrypt returns the original text.
|
|
11
|
+
on_test [script] :
|
|
12
|
+
create tests.objs.cipher.c as cipher
|
|
13
|
+
|
|
14
|
+
tell tests.objs.cipher.c to generate_keys
|
|
15
|
+
check tests.objs.cipher.c.key for blank?
|
|
16
|
+
refute "expected generate_keys to set a key"
|
|
17
|
+
|
|
18
|
+
put ^^.plaintext into tests.objs.cipher.c.data
|
|
19
|
+
tell tests.objs.cipher.c to encrypt
|
|
20
|
+
eval tests.objs.cipher.c.data = ^^.plaintext
|
|
21
|
+
refute "expected the data to be encrypted (not the plaintext)"
|
|
22
|
+
|
|
23
|
+
tell tests.objs.cipher.c to decrypt
|
|
24
|
+
eval tests.objs.cipher.c.data = ^^.plaintext
|
|
25
|
+
assert "expected decrypt to restore the original text"
|
|
26
|
+
|
|
27
|
+
shared_keys [test] :
|
|
28
|
+
description [string] : a second cipher with the same key + init_vector can decrypt.
|
|
29
|
+
on_test [script] :
|
|
30
|
+
create tests.objs.cipher.a as cipher
|
|
31
|
+
create tests.objs.cipher.b as cipher
|
|
32
|
+
|
|
33
|
+
tell tests.objs.cipher.a to generate_keys
|
|
34
|
+
put ^^.plaintext into tests.objs.cipher.a.data
|
|
35
|
+
tell tests.objs.cipher.a to encrypt
|
|
36
|
+
|
|
37
|
+
put tests.objs.cipher.a.key into tests.objs.cipher.b.key
|
|
38
|
+
put tests.objs.cipher.a.init_vector into tests.objs.cipher.b.init_vector
|
|
39
|
+
put tests.objs.cipher.a.data into tests.objs.cipher.b.data
|
|
40
|
+
|
|
41
|
+
tell tests.objs.cipher.b to decrypt
|
|
42
|
+
eval tests.objs.cipher.b.data = ^^.plaintext
|
|
43
|
+
assert "expected the second cipher to decrypt with the shared key"
|
|
@@ -2,37 +2,35 @@
|
|
|
2
2
|
# Decimal tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
objs [can] :
|
|
7
|
-
decimal [can] :
|
|
5
|
+
tests.objs.decimal [can] :
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
a [decimal] :
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
set_value [test] :
|
|
10
|
+
description [string] : Set a decimal value
|
|
11
|
+
on_test [script] :
|
|
12
|
+
put 3.14 into ^^.a
|
|
13
|
+
eval ^^.a = 3.14
|
|
14
|
+
assert "expected a to be 3.14"
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
round_decimal [test] :
|
|
17
|
+
description [string] : Round a decimal value
|
|
18
|
+
on_test [script] :
|
|
19
|
+
put 3.7 into ^^.a
|
|
20
|
+
tell ^^.a to round
|
|
21
|
+
eval ^^.a = 4.0
|
|
22
|
+
assert "expected a to be rounded to 4.0"
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
format_decimal [test] :
|
|
25
|
+
description [string] : Format a decimal
|
|
26
|
+
f [decimal] :
|
|
27
|
+
on_test [script] :
|
|
28
|
+
put 1234567.891 into ^.f
|
|
29
|
+
tell ^.f to format
|
|
30
|
+
eval it = '1,234,567.891'
|
|
31
|
+
assert "expected formatted decimal to match"
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
put 3.14159 into ^.f
|
|
34
|
+
tell ^.f to format ('%.2f')
|
|
35
|
+
eval it = '3.14'
|
|
36
|
+
assert "expected formatted decimal to match"
|
|
@@ -2,52 +2,50 @@
|
|
|
2
2
|
# ERB 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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
eval ^^.with_logic.result = 'ACTIVE'
|
|
53
|
-
assert "expected the 'yes' param to render the ACTIVE branch"
|
|
5
|
+
tests.objs.erb [can] :
|
|
6
|
+
|
|
7
|
+
greeting [string] : <%= name %>!!
|
|
8
|
+
|
|
9
|
+
basic [erb] :
|
|
10
|
+
template [text] : <%= name %>
|
|
11
|
+
params [can] :
|
|
12
|
+
name [string] : world
|
|
13
|
+
result [text] :
|
|
14
|
+
|
|
15
|
+
aliased_template [erb] :
|
|
16
|
+
template [alias] : tests.objs.erb.greeting
|
|
17
|
+
params [can] :
|
|
18
|
+
name [string] : gloo
|
|
19
|
+
result [text] :
|
|
20
|
+
|
|
21
|
+
with_logic [erb] :
|
|
22
|
+
template [text] : <%= n == "yes" ? "ACTIVE" : "closed" %>
|
|
23
|
+
params [can] :
|
|
24
|
+
n [string] : no
|
|
25
|
+
result [text] :
|
|
26
|
+
|
|
27
|
+
run_basic [test] :
|
|
28
|
+
description [string] : Render a template with a param
|
|
29
|
+
on_test [script] :
|
|
30
|
+
tell ^^.basic to run
|
|
31
|
+
eval ^^.basic.result = 'world'
|
|
32
|
+
assert "expected template to render with the param value"
|
|
33
|
+
|
|
34
|
+
run_with_aliased_template [test] :
|
|
35
|
+
description [string] : Render a template whose 'template' child is an alias to another object
|
|
36
|
+
on_test [script] :
|
|
37
|
+
tell ^^.aliased_template to run
|
|
38
|
+
eval ^^.aliased_template.result = 'gloo!!'
|
|
39
|
+
assert "expected alias to be resolved before rendering the template"
|
|
40
|
+
|
|
41
|
+
run_with_logic [test] :
|
|
42
|
+
description [string] : A <% %> tag runs Ruby; the param drives which branch renders
|
|
43
|
+
on_test [script] :
|
|
44
|
+
tell ^^.with_logic to run
|
|
45
|
+
eval ^^.with_logic.result = 'closed'
|
|
46
|
+
assert "expected the 'no' param to render the closed branch"
|
|
47
|
+
|
|
48
|
+
put 'yes' into ^^.with_logic.params.n
|
|
49
|
+
tell ^^.with_logic to run
|
|
50
|
+
eval ^^.with_logic.result = 'ACTIVE'
|
|
51
|
+
assert "expected the 'yes' param to render the ACTIVE branch"
|
|
@@ -5,73 +5,71 @@
|
|
|
5
5
|
# file under /tmp, exercise it, and delete it at the end.
|
|
6
6
|
#
|
|
7
7
|
|
|
8
|
-
tests [can] :
|
|
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
|
-
|
|
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
|
-
check ^^.f for exists?
|
|
77
|
-
refute "expected the file to be gone after delete"
|
|
8
|
+
tests.objs.file [can] :
|
|
9
|
+
|
|
10
|
+
f [file] : /tmp/gloo_file_test.txt
|
|
11
|
+
names [file] : /Users/me/project/report.csv
|
|
12
|
+
|
|
13
|
+
first [string] : first line
|
|
14
|
+
second [string] : second line
|
|
15
|
+
back [string] :
|
|
16
|
+
|
|
17
|
+
write_read_round_trip [test] :
|
|
18
|
+
description [string] : write puts an object's value in the file; read gets it back.
|
|
19
|
+
on_test [script] :
|
|
20
|
+
tell ^^.f to write ( ^^.first )
|
|
21
|
+
|
|
22
|
+
check ^^.f for exists?
|
|
23
|
+
assert "expected the file to exist after write"
|
|
24
|
+
|
|
25
|
+
check ^^.f for is_file?
|
|
26
|
+
assert "expected exists to be a regular file"
|
|
27
|
+
|
|
28
|
+
check ^^.f for is_dir?
|
|
29
|
+
refute "expected the file not to be a directory"
|
|
30
|
+
|
|
31
|
+
tell ^^.f to read ( ^^.back )
|
|
32
|
+
eval ^^.back = 'first line'
|
|
33
|
+
assert "expected read to return what was written"
|
|
34
|
+
|
|
35
|
+
tell ^^.f to delete
|
|
36
|
+
|
|
37
|
+
append_adds_a_line [test] :
|
|
38
|
+
description [string] : append adds a new line to the file.
|
|
39
|
+
on_test [script] :
|
|
40
|
+
tell ^^.f to write ( ^^.first )
|
|
41
|
+
tell ^^.f to append ( ^^.second )
|
|
42
|
+
|
|
43
|
+
tell ^^.f to read ( ^^.back )
|
|
44
|
+
check ^^.back for substring? ( "first line" )
|
|
45
|
+
assert "expected the original line to still be there"
|
|
46
|
+
check ^^.back for substring? ( "second line" )
|
|
47
|
+
assert "expected the appended line to be there"
|
|
48
|
+
|
|
49
|
+
tell ^^.f to delete
|
|
50
|
+
|
|
51
|
+
path_parts [test] :
|
|
52
|
+
description [string] : get_name, get_ext and get_parent read the path, not the disk.
|
|
53
|
+
on_test [script] :
|
|
54
|
+
tell ^^.names to get_name
|
|
55
|
+
eval it = 'report'
|
|
56
|
+
assert "expected the base name without extension"
|
|
57
|
+
|
|
58
|
+
tell ^^.names to get_ext
|
|
59
|
+
eval it = '.csv'
|
|
60
|
+
assert "expected the extension"
|
|
61
|
+
|
|
62
|
+
tell ^^.names to get_parent
|
|
63
|
+
eval it = '/Users/me/project'
|
|
64
|
+
assert "expected the parent directory"
|
|
65
|
+
|
|
66
|
+
delete_removes_the_file [test] :
|
|
67
|
+
description [string] : delete removes the file from disk.
|
|
68
|
+
on_test [script] :
|
|
69
|
+
tell ^^.f to write ( ^^.first )
|
|
70
|
+
check ^^.f for exists?
|
|
71
|
+
assert "sanity: file exists before delete"
|
|
72
|
+
|
|
73
|
+
tell ^^.f to delete
|
|
74
|
+
check ^^.f for exists?
|
|
75
|
+
refute "expected the file to be gone after delete"
|
|
@@ -7,48 +7,46 @@
|
|
|
7
7
|
# after_invoke event.
|
|
8
8
|
#
|
|
9
9
|
|
|
10
|
-
tests [can] :
|
|
11
|
-
objs [can] :
|
|
12
|
-
function [can] :
|
|
10
|
+
tests.objs.function [can] :
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
after_ran [bool] : false
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
greet [ƒ] :
|
|
15
|
+
params [can] :
|
|
16
|
+
name [string] : Default Person
|
|
17
|
+
on_invoke [script] :
|
|
18
|
+
put 'Hi, ' + ^.params.name into ^.result
|
|
19
|
+
after_invoke [script] :
|
|
20
|
+
put true into tests.objs.function.after_ran
|
|
21
|
+
result [string] :
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
boom [ƒ] :
|
|
24
|
+
params [can] :
|
|
25
|
+
on_invoke [script] :
|
|
26
|
+
put no_such_object into ^.result
|
|
27
|
+
after_invoke [script] :
|
|
28
|
+
put true into tests.objs.function.after_ran
|
|
29
|
+
result [string] :
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
invoke_message_uses_param_defaults [test] :
|
|
32
|
+
description [string] : the invoke message with no args runs on_invoke against the param defaults.
|
|
33
|
+
on_test [script] :
|
|
34
|
+
tell ^^.greet to invoke
|
|
35
|
+
eval ^^.greet.result = 'Hi, Default Person'
|
|
36
|
+
assert "expected on_invoke to run with the default param value"
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
after_invoke_runs_on_success [test] :
|
|
39
|
+
description [string] : after_invoke runs once the function has been invoked.
|
|
40
|
+
on_test [script] :
|
|
41
|
+
put false into ^^.after_ran
|
|
42
|
+
tell ^^.greet to invoke
|
|
43
|
+
eval ^^.after_ran = true
|
|
44
|
+
assert "expected after_invoke to run after a successful invoke"
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
after_invoke_runs_on_failure [test] :
|
|
47
|
+
description [string] : after_invoke still runs when on_invoke hits an error.
|
|
48
|
+
on_test [script] :
|
|
49
|
+
put false into ^^.after_ran
|
|
50
|
+
tell ^^.boom to invoke
|
|
51
|
+
eval ^^.after_ran = true
|
|
52
|
+
assert "expected after_invoke to run even after on_invoke failed"
|