Date: 2014/06/02 10:29:07 UTC-07:00
Type: Denizen Script
1
2
3
4
5
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
61
62
63
64
65
66
67
68
69
70
71
72
"STest":
#
# A script that runs the tests set up in the script name provided
#
# The script in question requires That the file path be pre-determined so its not much use
# unless everything is already under 1 yaml file.
#
type: task
definitions: script_name
script:
#I would like to do....
#- define path <script.file_path>
- define path "scripts/Dropbox/Sync List/Server Utility Scripts/Debug Utilities.yml"
- yaml load:%path% id:UT
- announce "<blue>Loaded yaml ids<&co> <yellow><yaml.list>" to_console
- define number_of_tests <yaml[UT].list_keys[%script_name%.scripttest].size>
- announce "<blue>Starting <green>%number_of_tests% <blue>tests." to_console
- repeat %number_of_tests% {
- define path "scripttest.test_%value%"
- if <s@%script_name%.container_type> == procedure {
- inject %script_name% "path:%path%.setup"
- inject %script_name% "path:%path%.test"
- inject %script_name% "path:%path%.teardown"
- define scripts_expected_return <s@%script_name%.constant[%path%.expected]>
- if <def[scripts_real_return]> == %scripts_expected_return% {
- define script_name %script_name%
- define test_results "<proc[Append Right].context[]>"
- define test_names
- announce "<gold>Script was successful" to_console
- announce "<blue>Scripts Return<&co> <gold><def[scripts_real_return]>" to_console
- announce "<blue>Expected Value<&co> <gold><def[scripts_expected_return]>" to_console
} else {
- announce "<red>Script failed"
}
}
- if <s@%script_name%.constant[type]> == task {
- announce "Testing a task"
- run %script_name% path:script2
}
}
- yaml unload id:UT
# the test script I was using for the script test features. Its functional, and yet unpolished.
#
"x5":
#
# A script for testing out an idea for denizen automated script tests
#
scripttest:
test_1:
input: 1
expected: 5
setup:
- define scripts_input "<s@<script.name>.constant[scripttest.test_1.input]>"
test:
- define scripts_real_return <proc[<script.name>].context[%scripts_input%]>
teardown:
- announce Tearing_down_script
- flag server delete_me !
type: procedure
definitions: number
script:
- determine <math:%number%*5>