gloo 6.4.0 → 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/docs/application.md +9 -0
- data/docs/language_objects.md +40 -0
- data/docs/objects.md +1 -1
- data/docs/verbs.md +9 -0
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +7 -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 +21 -1
- data/lib/gloo/persist/file_loader.rb +7 -0
- data/lib/gloo/persist/persist_man.rb +35 -3
- data/lib/gloo/persist/source/obj_node.rb +41 -0
- data/lib/gloo/verbs/list.rb +24 -2
- data/lib/gloo/verbs/load.rb +4 -1
- 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 +15 -17
- 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 +56 -58
- 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/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 +30 -32
- data/test.gloo/verbs/run.test.gloo +8 -10
- data/test.gloo/verbs/save.test.gloo +90 -94
- 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 +1 -1
data/test.gloo/dt/date.test.gloo
CHANGED
|
@@ -2,87 +2,85 @@
|
|
|
2
2
|
# Date tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
dt [can] :
|
|
7
|
-
date [can] :
|
|
5
|
+
tests.dt.date [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
d [date] :
|
|
8
|
+
x [date] :
|
|
9
|
+
future [date] :
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
now [test] :
|
|
12
|
+
description [string] : Get the current date
|
|
13
|
+
on_test [script] :
|
|
14
|
+
check ^^.x for blank?
|
|
15
|
+
assert "expected new date to be blank"
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
tell ^^.x to now
|
|
18
|
+
check ^^.x for blank?
|
|
19
|
+
refute "expected date to not be blank"
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
tell ^^.d to now
|
|
22
|
+
eval ^^.d = ^^.x
|
|
23
|
+
assert "expected dates to be equal"
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
add [test] :
|
|
26
|
+
description [string] : Add days to a date
|
|
27
|
+
on_test [script] :
|
|
28
|
+
tell ^^.d to now
|
|
29
|
+
tell ^^.future to now
|
|
30
|
+
tell ^^.future to add
|
|
31
|
+
eval ^^.future = ^^.d
|
|
32
|
+
refute "expected future date to be after current date"
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
subtract [test] :
|
|
35
|
+
description [string] : Subtract days from a date
|
|
36
|
+
on_test [script] :
|
|
37
|
+
tell ^^.d to now
|
|
38
|
+
tell ^^.future to now
|
|
39
|
+
tell ^^.future to sub
|
|
40
|
+
eval ^^.future = ^^.d
|
|
41
|
+
refute "expected past date to be before current date"
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
dd [test] :
|
|
44
|
+
description [string] : Get the day portion of a date
|
|
45
|
+
on_test [script] :
|
|
46
|
+
tell ^^.d to now
|
|
47
|
+
tell ^^.d to dd
|
|
48
|
+
eval it = ^^.d
|
|
49
|
+
refute "expected day to not be the same as the date"
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
mm [test] :
|
|
52
|
+
description [string] : Get the month portion of a date
|
|
53
|
+
on_test [script] :
|
|
54
|
+
tell ^^.d to now
|
|
55
|
+
tell ^^.d to mm
|
|
56
|
+
eval it = ^^.d
|
|
57
|
+
refute "expected month to not be the same as the date"
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
yy [test] :
|
|
60
|
+
description [string] : Get the year portion of a date
|
|
61
|
+
on_test [script] :
|
|
62
|
+
tell ^^.d to now
|
|
63
|
+
tell ^^.d to yy
|
|
64
|
+
eval it = ^^.d
|
|
65
|
+
refute "expected year to not be the same as the date"
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
yyyy [test] :
|
|
68
|
+
description [string] : Get the 4 digit year portion of a date
|
|
69
|
+
on_test [script] :
|
|
70
|
+
tell ^^.d to now
|
|
71
|
+
tell ^^.d to yyyy
|
|
72
|
+
eval ^^.d = it
|
|
73
|
+
refute "expected yyyy to not be the same as the date"
|
|
76
74
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
format [test] :
|
|
76
|
+
description [string] : Format a date
|
|
77
|
+
on_test [script] :
|
|
78
|
+
put '2025.10.15' into ^^.d
|
|
79
|
+
tell ^^.d to format
|
|
80
|
+
eval it = '2025-10-15'
|
|
81
|
+
assert "expected formatted date to match"
|
|
84
82
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
tell ^^.d to format ('%m/%d')
|
|
84
|
+
eval it = '10/15'
|
|
85
|
+
assert "expected formatted date to match"
|
|
88
86
|
|
|
@@ -2,60 +2,58 @@
|
|
|
2
2
|
# Datetime 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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
eval it = '10/15/2025'
|
|
61
|
-
assert "expected formatted datetime to match"
|
|
5
|
+
tests.dt.datetime [can] :
|
|
6
|
+
|
|
7
|
+
d [dt] :
|
|
8
|
+
|
|
9
|
+
now [test] :
|
|
10
|
+
description [string] : Get the current datetime
|
|
11
|
+
on_test [script] :
|
|
12
|
+
check ^^.d for blank?
|
|
13
|
+
assert "expected new datetime to be blank"
|
|
14
|
+
|
|
15
|
+
tell ^^.d to now
|
|
16
|
+
check ^^.d for blank?
|
|
17
|
+
refute "expected datetime to not be blank after now"
|
|
18
|
+
|
|
19
|
+
is_today [test] :
|
|
20
|
+
description [string] : Check if datetime is today
|
|
21
|
+
on_test [script] :
|
|
22
|
+
tell ^^.d to now
|
|
23
|
+
tell ^^.d to is_today
|
|
24
|
+
assert "expected current datetime to be today"
|
|
25
|
+
|
|
26
|
+
is_past [test] :
|
|
27
|
+
description [string] : Check if datetime is in the past
|
|
28
|
+
on_test [script] :
|
|
29
|
+
tell ^^.d to now
|
|
30
|
+
tell ^^.d to is_past
|
|
31
|
+
refute "expected current datetime to not be in the past"
|
|
32
|
+
|
|
33
|
+
put 'yesterday' into ^^.d
|
|
34
|
+
tell ^^.d to is_past
|
|
35
|
+
assert "expected yesterday to be in the past"
|
|
36
|
+
|
|
37
|
+
is_future [test] :
|
|
38
|
+
description [string] : Check if datetime is in the future
|
|
39
|
+
on_test [script] :
|
|
40
|
+
tell ^^.d to now
|
|
41
|
+
tell ^^.d to is_future
|
|
42
|
+
refute "expected current datetime to not be in the future"
|
|
43
|
+
|
|
44
|
+
put 'tomorrow' into ^^.d
|
|
45
|
+
tell ^^.d to is_future
|
|
46
|
+
assert "expected tomorrow to be in the future"
|
|
47
|
+
|
|
48
|
+
format [test] :
|
|
49
|
+
description [string] : Format a datetime
|
|
50
|
+
f [dt] :
|
|
51
|
+
on_test [script] :
|
|
52
|
+
put '2025.10.15 2:30:00 PM' into ^.f
|
|
53
|
+
tell ^.f to format
|
|
54
|
+
eval it = '2025-10-15 14:30:00'
|
|
55
|
+
assert "expected formatted datetime to match"
|
|
56
|
+
|
|
57
|
+
tell ^.f to format ('%m/%d/%Y')
|
|
58
|
+
eval it = '10/15/2025'
|
|
59
|
+
assert "expected formatted datetime to match"
|
data/test.gloo/dt/time.test.gloo
CHANGED
|
@@ -2,88 +2,86 @@
|
|
|
2
2
|
# Time tests
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
tests [can] :
|
|
6
|
-
dt [can] :
|
|
7
|
-
time [can] :
|
|
5
|
+
tests.dt.time [can] :
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
t [time] :
|
|
8
|
+
x [time] :
|
|
9
|
+
future [time] :
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
now [test] :
|
|
12
|
+
description [string] : Get the current time
|
|
13
|
+
on_test [script] :
|
|
14
|
+
check ^^.x for blank?
|
|
15
|
+
assert "expected new time to be blank"
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
tell ^^.x to now
|
|
18
|
+
check ^^.x for blank?
|
|
19
|
+
refute "expected time to not be blank"
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
tell ^^.t to now
|
|
22
|
+
eval ^^.t = ^^.x
|
|
23
|
+
assert "expected times to be equal"
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
add [test] :
|
|
26
|
+
description [string] : Add hours to a time
|
|
27
|
+
on_test [script] :
|
|
28
|
+
tell ^^.t to now
|
|
29
|
+
tell ^^.future to now
|
|
30
|
+
tell ^^.future to add
|
|
31
|
+
eval ^^.future = ^^.t
|
|
32
|
+
refute "expected future time to be after current time"
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
subtract [test] :
|
|
35
|
+
description [string] : Subtract hours from a time
|
|
36
|
+
on_test [script] :
|
|
37
|
+
tell ^^.t to now
|
|
38
|
+
tell ^^.future to now
|
|
39
|
+
tell ^^.future to sub
|
|
40
|
+
eval ^^.future = ^^.t
|
|
41
|
+
refute "expected past time to be before current time"
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
hh [test] :
|
|
44
|
+
description [string] : Get the hour portion of a time
|
|
45
|
+
on_test [script] :
|
|
46
|
+
tell ^^.t to now
|
|
47
|
+
tell ^^.t to hh
|
|
48
|
+
eval it = ^^.t
|
|
49
|
+
refute "expected hour to not be the same as the time"
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
mm [test] :
|
|
52
|
+
description [string] : Get the minute portion of a time
|
|
53
|
+
on_test [script] :
|
|
54
|
+
tell ^^.t to now
|
|
55
|
+
tell ^^.t to mm
|
|
56
|
+
eval it = ^^.t
|
|
57
|
+
refute "expected minute to not be the same as the time"
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
ss [test] :
|
|
60
|
+
description [string] : Get the second portion of a time
|
|
61
|
+
on_test [script] :
|
|
62
|
+
tell ^^.t to now
|
|
63
|
+
tell ^^.t to ss
|
|
64
|
+
eval it = ^^.t
|
|
65
|
+
refute "expected second to not be the same as the time"
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
am [test] :
|
|
68
|
+
description [string] : Get the am/pm portion of a time
|
|
69
|
+
on_test [script] :
|
|
70
|
+
tell ^^.t to now
|
|
71
|
+
tell ^^.t to am
|
|
72
|
+
eval it = ^^.t
|
|
73
|
+
refute "expected am/pm to not be the same as the time"
|
|
76
74
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
format [test] :
|
|
76
|
+
description [string] : Format a time
|
|
77
|
+
f [time] :
|
|
78
|
+
on_test [script] :
|
|
79
|
+
put '2:30:00 PM' into ^.f
|
|
80
|
+
tell ^.f to format
|
|
81
|
+
eval it = '14:30:00'
|
|
82
|
+
assert "expected formatted time to match"
|
|
85
83
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
tell ^.f to format ('%I:%M %p')
|
|
85
|
+
eval it = '02:30 PM'
|
|
86
|
+
assert "expected formatted time to match"
|
|
89
87
|
|
|
@@ -4,36 +4,34 @@
|
|
|
4
4
|
# A trailing \ continues a statement on the next line.
|
|
5
5
|
#
|
|
6
6
|
|
|
7
|
-
tests [can] :
|
|
8
|
-
lang [can] :
|
|
9
|
-
continuation [can] :
|
|
7
|
+
tests.lang.continuation [can] :
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
one [string] : Hello
|
|
10
|
+
two [string] : World
|
|
11
|
+
joined [string] :
|
|
12
|
+
split [string] :
|
|
13
|
+
flag [bool] : false
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
split_statement_matches_single_line [test] :
|
|
16
|
+
description [string] : a statement broken with \ produces the same result as one line.
|
|
17
|
+
on_test [script] :
|
|
18
|
+
put ^^.one and ' ' and ^^.two into ^^.joined
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
put ^^.one and \
|
|
21
|
+
' ' and \
|
|
22
|
+
^^.two into ^^.split
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
eval ^^.split = ^^.joined
|
|
25
|
+
assert "expected the continued statement to match the single-line one"
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
eval ^^.split = 'Hello World'
|
|
28
|
+
assert "expected the joined value"
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
continuation_in_an_if [test] :
|
|
31
|
+
description [string] : \ works inside an if statement.
|
|
32
|
+
on_test [script] :
|
|
33
|
+
put false into ^^.flag
|
|
34
|
+
if ^^.one = 'Hello' \
|
|
35
|
+
then put true into ^^.flag
|
|
36
|
+
eval ^^.flag = true
|
|
37
|
+
assert "expected the continued if to run its then branch"
|
|
@@ -4,67 +4,65 @@
|
|
|
4
4
|
# 'put' converts the value to the target object's type.
|
|
5
5
|
#
|
|
6
6
|
|
|
7
|
-
tests [can] :
|
|
8
|
-
lang [can] :
|
|
9
|
-
convert [can] :
|
|
7
|
+
tests.lang.convert [can] :
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
i [integer] : 0
|
|
10
|
+
d [decimal] : 0
|
|
11
|
+
s [string] : x
|
|
12
|
+
b [boolean] : false
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
string_to_number [test] :
|
|
15
|
+
description [string] : a string is converted to the leading number for an int or decimal target.
|
|
16
|
+
on_test [script] :
|
|
17
|
+
put '3 third time' into ^^.i
|
|
18
|
+
eval ^^.i = 3
|
|
19
|
+
assert "expected the leading integer to be parsed"
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
put '3.12 more' into ^^.d
|
|
22
|
+
eval ^^.d = 3.12
|
|
23
|
+
assert "expected the leading decimal to be parsed"
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
put 'notanumber' into ^^.i
|
|
26
|
+
eval ^^.i = 0
|
|
27
|
+
assert "expected a non-numeric string to convert to 0"
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
number_to_number [test] :
|
|
30
|
+
description [string] : int and decimal convert to each other; decimal to int truncates.
|
|
31
|
+
on_test [script] :
|
|
32
|
+
put 5 into ^^.d
|
|
33
|
+
eval ^^.d = 5.0
|
|
34
|
+
assert "expected the integer to widen to a decimal"
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
put 9.99 into ^^.i
|
|
37
|
+
eval ^^.i = 9
|
|
38
|
+
assert "expected the decimal to truncate toward zero"
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
anything_to_string [test] :
|
|
41
|
+
description [string] : a number or boolean put into a string becomes its text form.
|
|
42
|
+
on_test [script] :
|
|
43
|
+
put 123 into ^^.s
|
|
44
|
+
eval ^^.s = '123'
|
|
45
|
+
assert "expected the number to become a string"
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
put true into ^^.s
|
|
48
|
+
eval ^^.s = 'true'
|
|
49
|
+
assert "expected the boolean to become a string"
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
to_boolean [test] :
|
|
52
|
+
description [string] : strings (case-insensitive) and numbers convert to a boolean.
|
|
53
|
+
on_test [script] :
|
|
54
|
+
put 'false' into ^^.b
|
|
55
|
+
eval ^^.b = false
|
|
56
|
+
assert "expected 'false' to convert to false"
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
put 'TRUE' into ^^.b
|
|
59
|
+
eval ^^.b = true
|
|
60
|
+
assert "expected 'TRUE' to convert to true, case-insensitively"
|
|
63
61
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
put 0 into ^^.b
|
|
63
|
+
eval ^^.b = false
|
|
64
|
+
assert "expected 0 to convert to false"
|
|
67
65
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
put 42 into ^^.b
|
|
67
|
+
eval ^^.b = true
|
|
68
|
+
assert "expected a non-zero number to convert to true"
|