1 | # Pretty printing tests
|
2 |
|
3 | #### Int
|
4 | = -123
|
5 | ## stdout: (Int) -123
|
6 |
|
7 | #### Float
|
8 | = -0.00
|
9 | ## stdout: (Float) -0.0
|
10 |
|
11 | #### Null
|
12 | = null
|
13 | ## stdout: (Null) null
|
14 |
|
15 | #### Bool
|
16 | = true
|
17 | = false
|
18 | ## STDOUT:
|
19 | (Bool) true
|
20 | (Bool) false
|
21 | ## END
|
22 |
|
23 | #### String
|
24 | = "double quoted"
|
25 | = 'single quoted'
|
26 | ## STDOUT:
|
27 | (Str) 'double quoted'
|
28 | (Str) 'single quoted'
|
29 | ## END
|
30 |
|
31 | #### Range
|
32 | var x = 1..100
|
33 | = x
|
34 | ## stdout: (Range) 1 .. 100
|
35 |
|
36 | #### Bash Array
|
37 | declare -a array_0=()
|
38 | declare -a array_1=(hello)
|
39 | declare -a array_3
|
40 | array_3[0]="world"
|
41 | array_3[2]=*.py
|
42 | declare array_long=(Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
|
43 | do eiusmod.)
|
44 | = array_0
|
45 | = array_1
|
46 | = array_3
|
47 | = array_long
|
48 | ## STDOUT:
|
49 | (BashArray) (BashArray)
|
50 | (BashArray) (BashArray 'hello')
|
51 | (BashArray) (BashArray 'world' null '*.py')
|
52 | (BashArray)
|
53 | (BashArray
|
54 | 'Lorem' 'ipsum' 'dolor' 'sit' 'amet,'
|
55 | 'consectetur' 'adipiscing' 'elit,' 'sed' 'do'
|
56 | 'eiusmod.'
|
57 | )
|
58 | ## END
|
59 |
|
60 | #### Bash Assoc: string formatting
|
61 | declare -A assoc=(['k']=$'foo \x01\u03bc')
|
62 | = assoc
|
63 | ## stdout: (BashAssoc) (BashAssoc ['k']=$'foo \u0001μ')
|
64 |
|
65 | #### Bash Assoc
|
66 | declare -A assoc_0=()
|
67 | declare -A assoc_1=([1]=one)
|
68 | declare assoc_3=([1]=one [two]=2 [3]=three)
|
69 | declare assoc_long=([Lorem]=ipsum [dolor]="sit amet," ['consectetur adipiscing']="elit, sed" [do]="eiusmod.")
|
70 | = assoc_0
|
71 | = assoc_1
|
72 | = assoc_3
|
73 | = assoc_long
|
74 | ## STDOUT:
|
75 | (BashAssoc) (BashAssoc)
|
76 | (BashAssoc) (BashAssoc ['1']='one')
|
77 | (BashAssoc) (BashAssoc ['1']='one' ['two']='2' ['3']='three')
|
78 | (BashAssoc)
|
79 | (BashAssoc
|
80 | ['Lorem']='ipsum'
|
81 | ['dolor']='sit amet,'
|
82 | ['consectetur adipiscing']='elit, sed'
|
83 | ['do']='eiusmod.'
|
84 | )
|
85 | ## END
|
86 |
|
87 | #### Simple Cycles
|
88 | var cyclic_array = ["one", "two", "three"]
|
89 | setvar cyclic_array[2] = cyclic_array
|
90 | var cyclic_dict = {"dead_end": null}
|
91 | setvar cyclic_dict["live_end"] = cyclic_dict
|
92 | = cyclic_array
|
93 | = cyclic_dict
|
94 | ## STDOUT:
|
95 | (List) ['one', 'two', [...]]
|
96 | (Dict) {dead_end: null, live_end: {...}}
|
97 | ## END
|
98 |
|
99 | #### Complex Cycles
|
100 | var dict = {}
|
101 | setvar dict["nothing"] = null
|
102 | var simple_cycle = [["dummy"]]
|
103 | setvar simple_cycle[0][0] = simple_cycle
|
104 | setvar dict["simple_cycle"] = simple_cycle
|
105 | var tricky_cycle = ["dummy"]
|
106 | setvar tricky_cycle[0] = dict
|
107 | setvar dict["tricky_cycle"] = tricky_cycle
|
108 | var dag = [1, 2, "dummy"]
|
109 | setvar dag[2] = dag
|
110 | setvar dict["dag"] = [dag, dag]
|
111 | var alpha = {}
|
112 | var omega = {}
|
113 | setvar alpha["omega"] = omega
|
114 | setvar omega["alpha"] = alpha
|
115 | setvar dict["key_alpha"] = alpha
|
116 | setvar dict["key_omega"] = omega
|
117 | = dict
|
118 | ## STDOUT:
|
119 | (Dict)
|
120 | {
|
121 | nothing: null,
|
122 | simple_cycle: [[[...]]],
|
123 | tricky_cycle: [{...}],
|
124 | dag: [[1, 2, [...]], [1, 2, [...]]],
|
125 | key_alpha: {omega: {alpha: {...}}},
|
126 | key_omega: {alpha: {omega: {...}}}
|
127 | }
|
128 | ## END
|