@voxgig/sdkgen 0.36.0 → 0.38.1
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.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/cmp/Main.js +0 -12
- package/dist/cmp/Main.js.map +1 -1
- package/package.json +2 -3
- package/project/.sdk/model/feature/log.jsonic +1 -1
- package/project/.sdk/model/target/js.jsonic +1 -1
- package/project/.sdk/model/target/py.jsonic +1 -1
- package/project/.sdk/model/target/ts.jsonic +2 -2
- package/project/.sdk/src/cmp/go/Config_go.ts +6 -2
- package/project/.sdk/src/cmp/js/EntityBase_js.ts +34 -0
- package/project/.sdk/src/cmp/js/Main_js.ts +10 -0
- package/project/.sdk/src/cmp/js/ReadmeExplanation_js.ts +33 -0
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +123 -0
- package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +152 -0
- package/project/.sdk/src/cmp/js/ReadmeTopHowto_js.ts +25 -0
- package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +65 -0
- package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +36 -0
- package/project/.sdk/src/cmp/js/TestDirect_js.ts +53 -5
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +114 -20
- package/project/.sdk/src/cmp/js/fragment/Entity.fragment.js +7 -139
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +149 -0
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +6 -10
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +6 -10
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +7 -11
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +7 -11
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +7 -11
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +2 -0
- package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +0 -2
- package/project/.sdk/src/cmp/lua/Config_lua.ts +6 -2
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +3 -1
- package/project/.sdk/src/cmp/php/Config_php.ts +6 -2
- package/project/.sdk/src/cmp/php/Package_php.ts +2 -2
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +2 -2
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +10 -15
- package/project/.sdk/src/cmp/py/Config_py.ts +6 -2
- package/project/.sdk/src/cmp/py/Package_py.ts +1 -1
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +3 -1
- package/project/.sdk/src/cmp/rb/Config_rb.ts +6 -2
- package/project/.sdk/src/cmp/ts/Main_ts.ts +7 -0
- package/project/.sdk/tm/go/feature/log_feature.go +1 -1
- package/project/.sdk/tm/go/test/runner_test.go +16 -2
- package/project/.sdk/tm/js/src/Context.js +142 -0
- package/project/.sdk/tm/js/src/Control.js +16 -0
- package/project/.sdk/tm/js/src/Operation.js +19 -0
- package/project/.sdk/tm/js/src/Point.js +24 -0
- package/project/.sdk/tm/js/src/README.md +1 -0
- package/project/.sdk/tm/js/src/Response.js +19 -0
- package/project/.sdk/tm/js/src/Result.js +21 -0
- package/project/.sdk/tm/js/src/Spec.js +26 -0
- package/project/.sdk/tm/js/src/feature/README.md +1 -0
- package/project/.sdk/tm/js/src/feature/base/BaseFeature.js +45 -0
- package/project/.sdk/tm/js/src/feature/log/LogFeature.js +46 -47
- package/project/.sdk/tm/js/src/feature/test/TestFeature.js +207 -0
- package/project/.sdk/tm/js/src/types.js +22 -0
- package/project/.sdk/tm/js/src/utility/CleanUtility.js +31 -0
- package/project/.sdk/tm/js/src/utility/DoneUtility.js +11 -4
- package/project/.sdk/tm/js/src/utility/FeatureAddUtility.js +42 -0
- package/project/.sdk/tm/js/src/utility/FeatureHookUtility.js +25 -0
- package/project/.sdk/tm/js/src/utility/FeatureInitUtility.js +11 -0
- package/project/.sdk/tm/js/src/utility/FetcherUtility.js +28 -0
- package/project/.sdk/tm/js/src/utility/MakeContextUtility.js +11 -0
- package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +55 -0
- package/project/.sdk/tm/js/src/utility/MakeFetchDefUtility.js +44 -0
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +93 -0
- package/project/.sdk/tm/js/src/utility/MakePointUtility.js +77 -0
- package/project/.sdk/tm/js/src/utility/MakeRequestUtility.js +63 -0
- package/project/.sdk/tm/js/src/utility/MakeResponseUtility.js +55 -0
- package/project/.sdk/tm/js/src/utility/MakeResultUtility.js +54 -0
- package/project/.sdk/tm/js/src/utility/MakeSpecUtility.js +58 -0
- package/project/.sdk/tm/js/src/utility/MakeUrlUtility.js +40 -0
- package/project/.sdk/tm/js/src/utility/ParamUtility.js +61 -0
- package/project/.sdk/tm/js/src/utility/PrepareAuthUtility.js +41 -0
- package/project/.sdk/tm/js/src/utility/PrepareBodyUtility.js +25 -0
- package/project/.sdk/tm/js/src/utility/PrepareHeadersUtility.js +18 -0
- package/project/.sdk/tm/js/src/utility/{MethodUtility.js → PrepareMethodUtility.js} +7 -7
- package/project/.sdk/tm/js/src/utility/PrepareParamsUtility.js +25 -0
- package/project/.sdk/tm/js/src/utility/PreparePathUtility.js +13 -0
- package/project/.sdk/tm/js/src/utility/PrepareQueryUtility.js +26 -0
- package/project/.sdk/tm/js/src/utility/README.md +1 -0
- package/project/.sdk/tm/js/src/utility/ResultBasicUtility.js +34 -0
- package/project/.sdk/tm/js/src/utility/ResultBodyUtility.js +18 -0
- package/project/.sdk/tm/js/src/utility/ResultHeadersUtility.js +22 -0
- package/project/.sdk/tm/js/src/utility/StructUtility.js +2219 -1078
- package/project/.sdk/tm/js/src/utility/TransformRequestUtility.js +28 -0
- package/project/.sdk/tm/js/src/utility/TransformResponseUtility.js +31 -0
- package/project/.sdk/tm/js/src/utility/Utility.js +61 -61
- package/project/.sdk/tm/js/test/README.md +1 -0
- package/project/.sdk/tm/js/test/exists.test.js +16 -0
- package/project/.sdk/tm/js/test/runner.js +323 -107
- package/project/.sdk/tm/js/test/utility/Custom.test.js +41 -63
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +390 -116
- package/project/.sdk/tm/js/test/utility/StructUtility.test.js +728 -175
- package/project/.sdk/tm/js/test/utility/index.js +9 -0
- package/project/.sdk/tm/js/test/utility.js +72 -0
- package/project/.sdk/tm/lua/test/primary_utility_test.lua +1213 -0
- package/project/.sdk/tm/lua/test/runner.lua +2 -2
- package/project/.sdk/tm/lua/test/struct_runner.lua +602 -0
- package/project/.sdk/tm/lua/test/struct_utility_test.lua +959 -0
- package/project/.sdk/tm/lua/utility/struct/struct.lua +10 -0
- package/project/.sdk/tm/php/feature/TestFeature.php +59 -96
- package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +1309 -0
- package/project/.sdk/tm/php/test/Runner.php +24 -1
- package/project/.sdk/tm/php/test/StructRunner.php +275 -0
- package/project/.sdk/tm/php/test/StructUtilityTest.php +1336 -0
- package/project/.sdk/tm/php/utility/Fetcher.php +6 -2
- package/project/.sdk/tm/php/utility/MakeOptions.php +5 -1
- package/project/.sdk/tm/php/utility/MakeResult.php +3 -0
- package/project/.sdk/tm/php/utility/Param.php +9 -7
- package/project/.sdk/tm/php/utility/struct/Struct.php +312 -208
- package/project/.sdk/tm/py/test/runner.py +13 -0
- package/project/.sdk/tm/py/test/struct_runner.py +411 -0
- package/project/.sdk/tm/py/test/test_primary_utility.py +1101 -0
- package/project/.sdk/tm/py/test/test_struct_utility.py +751 -0
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +1083 -0
- package/project/.sdk/tm/rb/test/runner.rb +5 -0
- package/project/.sdk/tm/rb/test/struct_runner.rb +309 -0
- package/project/.sdk/tm/rb/test/struct_utility_test.rb +670 -0
- package/src/cmp/Main.ts +1 -16
- package/project/.sdk/src/cmp/js/Quick_js.ts +0 -78
- package/project/.sdk/src/cmp/js/TestAcceptEntity_js.ts +0 -13
- package/project/.sdk/src/cmp/js/TestAccept_js.ts +0 -18
- package/project/.sdk/tm/js/src/utility/AuthUtility.js +0 -21
- package/project/.sdk/tm/js/src/utility/BodyUtility.js +0 -29
- package/project/.sdk/tm/js/src/utility/ErrorUtility.js +0 -33
- package/project/.sdk/tm/js/src/utility/FindparamUtility.js +0 -31
- package/project/.sdk/tm/js/src/utility/FullurlUtility.js +0 -39
- package/project/.sdk/tm/js/src/utility/HeadersUtility.js +0 -13
- package/project/.sdk/tm/js/src/utility/JoinurlUtility.js +0 -14
- package/project/.sdk/tm/js/src/utility/OperatorUtility.js +0 -44
- package/project/.sdk/tm/js/src/utility/OptionsUtility.js +0 -54
- package/project/.sdk/tm/js/src/utility/ParamsUtility.js +0 -21
- package/project/.sdk/tm/js/src/utility/QueryUtility.js +0 -21
- package/project/.sdk/tm/js/src/utility/ReqformUtility.js +0 -32
- package/project/.sdk/tm/js/src/utility/RequestUtility.js +0 -48
- package/project/.sdk/tm/js/src/utility/ResbasicUtility.js +0 -27
- package/project/.sdk/tm/js/src/utility/ResbodyUtility.js +0 -15
- package/project/.sdk/tm/js/src/utility/ResformUtility.js +0 -34
- package/project/.sdk/tm/js/src/utility/ResheadersUtility.js +0 -19
- package/project/.sdk/tm/js/src/utility/ResponseUtility.js +0 -37
- package/project/.sdk/tm/js/src/utility/ResultUtility.js +0 -28
- package/project/.sdk/tm/js/src/utility/SpecUtility.js +0 -35
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
# Vendored from voxgig/struct/rb
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
require 'json'
|
|
5
|
+
require_relative '../utility/struct/voxgig_struct'
|
|
6
|
+
require_relative 'struct_runner'
|
|
7
|
+
|
|
8
|
+
# A helper for deep equality comparison using JSON round-trip.
|
|
9
|
+
def deep_equal(a, b)
|
|
10
|
+
normalize = lambda { |v|
|
|
11
|
+
case v
|
|
12
|
+
when Hash
|
|
13
|
+
sorted = {}
|
|
14
|
+
v.keys.sort.each { |k| sorted[k] = normalize.call(v[k]) }
|
|
15
|
+
sorted
|
|
16
|
+
when Array
|
|
17
|
+
v.map { |e| normalize.call(e) }
|
|
18
|
+
else
|
|
19
|
+
v
|
|
20
|
+
end
|
|
21
|
+
}
|
|
22
|
+
JSON.generate(normalize.call(a)) == JSON.generate(normalize.call(b))
|
|
23
|
+
rescue
|
|
24
|
+
a == b
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Path to the JSON test file
|
|
28
|
+
STRUCT_TEST_JSON_FILE = File.join(__dir__, '../../.sdk/test/test.json')
|
|
29
|
+
|
|
30
|
+
class StructUtilityTest < Minitest::Test
|
|
31
|
+
def setup
|
|
32
|
+
@client = StructTestClient.new
|
|
33
|
+
@runner = StructRunner.make_runner(STRUCT_TEST_JSON_FILE, @client)
|
|
34
|
+
@runpack = @runner.call('struct')
|
|
35
|
+
@spec = @runpack[:spec]
|
|
36
|
+
@runset = @runpack[:runset]
|
|
37
|
+
@runsetflags = @runpack[:runsetflags]
|
|
38
|
+
@struct = @client.utility.struct
|
|
39
|
+
@minor_spec = @spec["minor"]
|
|
40
|
+
@walk_spec = @spec["walk"]
|
|
41
|
+
@merge_spec = @spec["merge"]
|
|
42
|
+
@getpath_spec = @spec["getpath"]
|
|
43
|
+
@inject_spec = @spec["inject"]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_exists
|
|
47
|
+
%i[
|
|
48
|
+
clone delprop escre escurl filter flatten getdef getelem getpath getprop
|
|
49
|
+
haskey inject isempty isfunc iskey islist ismap isnode items join jsonify
|
|
50
|
+
keysof merge pad pathify select setpath setprop size slice strkey stringify
|
|
51
|
+
transform typify typename validate walk jm jt
|
|
52
|
+
checkPlacement injectorArgs injectChild
|
|
53
|
+
].each do |meth|
|
|
54
|
+
assert_respond_to @struct, meth, "Expected VoxgigStruct to respond to #{meth}"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# --- Minor tests ---
|
|
59
|
+
|
|
60
|
+
def test_minor_isnode
|
|
61
|
+
@runsetflags.call(@minor_spec["isnode"], {}, VoxgigStruct.method(:isnode))
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def test_minor_ismap
|
|
65
|
+
@runsetflags.call(@minor_spec["ismap"], {}, VoxgigStruct.method(:ismap))
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def test_minor_islist
|
|
69
|
+
@runsetflags.call(@minor_spec["islist"], {}, VoxgigStruct.method(:islist))
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def test_minor_iskey
|
|
73
|
+
@runsetflags.call(@minor_spec["iskey"], { "null" => false }, VoxgigStruct.method(:iskey))
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def test_minor_strkey
|
|
77
|
+
@runsetflags.call(@minor_spec["strkey"], { "null" => false }, VoxgigStruct.method(:strkey))
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def test_minor_isempty
|
|
81
|
+
@runsetflags.call(@minor_spec["isempty"], { "null" => false }, VoxgigStruct.method(:isempty))
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def test_minor_isfunc
|
|
85
|
+
@runsetflags.call(@minor_spec["isfunc"], {}, VoxgigStruct.method(:isfunc))
|
|
86
|
+
f0 = -> { nil }
|
|
87
|
+
assert_equal true, VoxgigStruct.isfunc(f0)
|
|
88
|
+
assert_equal false, VoxgigStruct.isfunc(123)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def test_minor_clone
|
|
92
|
+
@runsetflags.call(@minor_spec["clone"], { "null" => false }, VoxgigStruct.method(:clone))
|
|
93
|
+
f0 = -> { nil }
|
|
94
|
+
result = VoxgigStruct.clone({ "a" => f0 })
|
|
95
|
+
assert_equal true, deep_equal(result, { "a" => f0 })
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_minor_escre
|
|
99
|
+
@runsetflags.call(@minor_spec["escre"], {}, VoxgigStruct.method(:escre))
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def test_minor_escurl
|
|
103
|
+
@runsetflags.call(@minor_spec["escurl"], {}, VoxgigStruct.method(:escurl))
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def test_minor_stringify
|
|
107
|
+
@runsetflags.call(@minor_spec["stringify"], {}, lambda { |vin|
|
|
108
|
+
value = vin.key?("val") ? (vin["val"] == StructRunner::NULLMARK ? "null" : vin["val"]) : ""
|
|
109
|
+
VoxgigStruct.stringify(value, vin["max"])
|
|
110
|
+
})
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def test_minor_pathify
|
|
114
|
+
@runsetflags.call(@minor_spec["pathify"], { "null" => false }, lambda { |vin|
|
|
115
|
+
path = vin.key?("path") ? vin["path"] : VoxgigStruct::UNDEF
|
|
116
|
+
VoxgigStruct.pathify(path, vin["startin"] || vin["from"], vin["endin"])
|
|
117
|
+
})
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def test_minor_items
|
|
121
|
+
@runsetflags.call(@minor_spec["items"], {}, VoxgigStruct.method(:items))
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def test_minor_getprop
|
|
125
|
+
@runsetflags.call(@minor_spec["getprop"], { "null" => false }, lambda { |vin|
|
|
126
|
+
if vin["alt"].nil?
|
|
127
|
+
VoxgigStruct.getprop(vin["val"], vin["key"])
|
|
128
|
+
else
|
|
129
|
+
VoxgigStruct.getprop(vin["val"], vin["key"], vin["alt"])
|
|
130
|
+
end
|
|
131
|
+
})
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def test_minor_getelem
|
|
135
|
+
@runsetflags.call(@minor_spec["getelem"], { "null" => false }, lambda { |vin|
|
|
136
|
+
if vin.key?("alt")
|
|
137
|
+
VoxgigStruct.getelem(vin["val"], vin["key"], vin["alt"])
|
|
138
|
+
else
|
|
139
|
+
VoxgigStruct.getelem(vin["val"], vin["key"])
|
|
140
|
+
end
|
|
141
|
+
})
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def test_minor_edge_getprop
|
|
145
|
+
strarr = ['a', 'b', 'c', 'd', 'e']
|
|
146
|
+
assert deep_equal(VoxgigStruct.getprop(strarr, 2), 'c')
|
|
147
|
+
assert deep_equal(VoxgigStruct.getprop(strarr, '2'), 'c')
|
|
148
|
+
intarr = [2, 3, 5, 7, 11]
|
|
149
|
+
assert deep_equal(VoxgigStruct.getprop(intarr, 2), 5)
|
|
150
|
+
assert deep_equal(VoxgigStruct.getprop(intarr, '2'), 5)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def test_minor_setprop
|
|
154
|
+
@runsetflags.call(@minor_spec["setprop"], { "null" => false }, lambda { |vin|
|
|
155
|
+
if vin.key?("val")
|
|
156
|
+
VoxgigStruct.setprop(vin["parent"], vin["key"], vin["val"])
|
|
157
|
+
else
|
|
158
|
+
VoxgigStruct.setprop(vin["parent"], vin["key"])
|
|
159
|
+
end
|
|
160
|
+
})
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def test_minor_delprop
|
|
164
|
+
@runsetflags.call(@minor_spec["delprop"], {}, lambda { |vin|
|
|
165
|
+
VoxgigStruct.delprop(vin["parent"], vin["key"])
|
|
166
|
+
})
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def test_minor_edge_setprop
|
|
170
|
+
strarr0 = ['a', 'b', 'c', 'd', 'e']
|
|
171
|
+
strarr1 = ['a', 'b', 'c', 'd', 'e']
|
|
172
|
+
assert deep_equal(VoxgigStruct.setprop(strarr0, 2, 'C'), ['a', 'b', 'C', 'd', 'e'])
|
|
173
|
+
assert deep_equal(VoxgigStruct.setprop(strarr1, '2', 'CC'), ['a', 'b', 'CC', 'd', 'e'])
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def test_minor_haskey
|
|
177
|
+
@runsetflags.call(@minor_spec["haskey"], { "null" => false }, lambda { |vin|
|
|
178
|
+
VoxgigStruct.haskey(vin["src"], vin["key"])
|
|
179
|
+
})
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def test_minor_keysof
|
|
183
|
+
@runsetflags.call(@minor_spec["keysof"], {}, VoxgigStruct.method(:keysof))
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def test_minor_join
|
|
187
|
+
@runsetflags.call(@minor_spec["join"], { "null" => false }, lambda { |vin|
|
|
188
|
+
VoxgigStruct.join(vin["val"], vin["sep"], vin["url"])
|
|
189
|
+
})
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def test_minor_jsonify
|
|
193
|
+
@runsetflags.call(@minor_spec["jsonify"], { "null" => false }, lambda { |vin|
|
|
194
|
+
VoxgigStruct.jsonify(vin["val"], vin["flags"])
|
|
195
|
+
})
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def test_minor_flatten
|
|
199
|
+
@runsetflags.call(@minor_spec["flatten"], {}, lambda { |vin|
|
|
200
|
+
VoxgigStruct.flatten(vin["val"], vin["depth"])
|
|
201
|
+
})
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def test_minor_filter
|
|
205
|
+
checks = {
|
|
206
|
+
"gt3" => lambda { |item| item[1].is_a?(Numeric) && item[1] > 3 },
|
|
207
|
+
"lt3" => lambda { |item| item[1].is_a?(Numeric) && item[1] < 3 },
|
|
208
|
+
}
|
|
209
|
+
@runsetflags.call(@minor_spec["filter"], {}, lambda { |vin|
|
|
210
|
+
check = checks[vin["check"]] || lambda { |_item| true }
|
|
211
|
+
VoxgigStruct.filter(vin["val"], check)
|
|
212
|
+
})
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def test_minor_typename
|
|
216
|
+
@runsetflags.call(@minor_spec["typename"], {}, VoxgigStruct.method(:typename))
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def test_minor_typify
|
|
220
|
+
@runsetflags.call(@minor_spec["typify"], { "null" => false }, VoxgigStruct.method(:typify))
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def test_minor_size
|
|
224
|
+
@runsetflags.call(@minor_spec["size"], { "null" => false }, VoxgigStruct.method(:size))
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def test_minor_slice
|
|
228
|
+
@runsetflags.call(@minor_spec["slice"], { "null" => false }, lambda { |vin|
|
|
229
|
+
VoxgigStruct.slice(vin["val"], vin["start"], vin["end"])
|
|
230
|
+
})
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def test_minor_pad
|
|
234
|
+
@runsetflags.call(@minor_spec["pad"], {}, lambda { |vin|
|
|
235
|
+
VoxgigStruct.pad(vin["val"], vin["pad"], vin["char"])
|
|
236
|
+
})
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def test_minor_setpath
|
|
240
|
+
@runsetflags.call(@minor_spec["setpath"], {}, lambda { |vin|
|
|
241
|
+
VoxgigStruct.setpath(vin["store"], vin["path"], vin["val"])
|
|
242
|
+
})
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def test_minor_getdef
|
|
246
|
+
f0 = -> { nil }
|
|
247
|
+
assert_equal 1, VoxgigStruct.getdef(1, 2)
|
|
248
|
+
assert_equal 2, VoxgigStruct.getdef(nil, 2)
|
|
249
|
+
assert_equal "a", VoxgigStruct.getdef("a", "b")
|
|
250
|
+
assert_equal "b", VoxgigStruct.getdef(nil, "b")
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# --- Walk tests ---
|
|
254
|
+
|
|
255
|
+
def test_walk_log
|
|
256
|
+
spec_log = @walk_spec["log"]
|
|
257
|
+
test_input = VoxgigStruct.clone(spec_log["in"])
|
|
258
|
+
expected_log = spec_log["out"]
|
|
259
|
+
|
|
260
|
+
log = []
|
|
261
|
+
|
|
262
|
+
walklog = lambda do |key, val, parent, path|
|
|
263
|
+
k_str = key.nil? ? "" : VoxgigStruct.stringify(key)
|
|
264
|
+
p_str = parent.nil? ? "" : VoxgigStruct.stringify(parent)
|
|
265
|
+
v_str = VoxgigStruct.stringify(val)
|
|
266
|
+
t_str = VoxgigStruct.pathify(path)
|
|
267
|
+
log << "k=#{k_str}, v=#{v_str}, p=#{p_str}, t=#{t_str}"
|
|
268
|
+
val
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# after only
|
|
272
|
+
VoxgigStruct.walk(test_input, nil, walklog)
|
|
273
|
+
assert deep_equal(log, expected_log["after"]),
|
|
274
|
+
"Walk log (after) failed.\nExpected: #{expected_log["after"].inspect}\nGot: #{log.inspect}"
|
|
275
|
+
|
|
276
|
+
log = []
|
|
277
|
+
test_input = VoxgigStruct.clone(spec_log["in"])
|
|
278
|
+
# before only
|
|
279
|
+
VoxgigStruct.walk(test_input, walklog)
|
|
280
|
+
assert deep_equal(log, expected_log["before"]),
|
|
281
|
+
"Walk log (before) failed.\nExpected: #{expected_log["before"].inspect}\nGot: #{log.inspect}"
|
|
282
|
+
|
|
283
|
+
log = []
|
|
284
|
+
test_input = VoxgigStruct.clone(spec_log["in"])
|
|
285
|
+
# both
|
|
286
|
+
VoxgigStruct.walk(test_input, walklog, walklog)
|
|
287
|
+
assert deep_equal(log, expected_log["both"]),
|
|
288
|
+
"Walk log (both) failed.\nExpected: #{expected_log["both"].inspect}\nGot: #{log.inspect}"
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def test_walk_basic
|
|
292
|
+
spec_basic = @walk_spec["basic"]
|
|
293
|
+
spec_basic["set"].each do |tc|
|
|
294
|
+
input = tc["in"]
|
|
295
|
+
expected = tc["out"]
|
|
296
|
+
|
|
297
|
+
walkpath = lambda do |_key, val, _parent, path|
|
|
298
|
+
val.is_a?(String) ? "#{val}~#{path.join('.')}" : val
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
result = VoxgigStruct.walk(input, walkpath)
|
|
302
|
+
assert deep_equal(result, expected), "Walk basic: expected #{expected.inspect}, got #{result.inspect}"
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
def test_walk_depth
|
|
307
|
+
@runsetflags.call(@walk_spec["depth"], { "null" => false }, lambda { |vin|
|
|
308
|
+
top = nil
|
|
309
|
+
cur = nil
|
|
310
|
+
copy = lambda { |key, val, _parent, _path|
|
|
311
|
+
if key.nil? || VoxgigStruct.isnode(val)
|
|
312
|
+
child = VoxgigStruct.islist(val) ? [] : {}
|
|
313
|
+
if key.nil?
|
|
314
|
+
top = cur = child
|
|
315
|
+
else
|
|
316
|
+
cur[key.is_a?(String) ? key : key.to_s] = child
|
|
317
|
+
cur = child
|
|
318
|
+
end
|
|
319
|
+
else
|
|
320
|
+
cur[key.is_a?(String) ? key : key.to_s] = val
|
|
321
|
+
end
|
|
322
|
+
val
|
|
323
|
+
}
|
|
324
|
+
VoxgigStruct.walk(vin["src"], copy, nil, vin["maxdepth"])
|
|
325
|
+
top
|
|
326
|
+
})
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
def test_walk_copy
|
|
330
|
+
cur = []
|
|
331
|
+
walkcopy = lambda { |key, val, _parent, path|
|
|
332
|
+
if key.nil?
|
|
333
|
+
cur = []
|
|
334
|
+
cur[0] = VoxgigStruct.ismap(val) ? {} : VoxgigStruct.islist(val) ? [] : val
|
|
335
|
+
next val
|
|
336
|
+
end
|
|
337
|
+
v = val
|
|
338
|
+
i = VoxgigStruct.size(path)
|
|
339
|
+
if VoxgigStruct.isnode(v)
|
|
340
|
+
v = VoxgigStruct.ismap(v) ? {} : []
|
|
341
|
+
cur[i] = v
|
|
342
|
+
end
|
|
343
|
+
VoxgigStruct.setprop(cur[i - 1], key, v)
|
|
344
|
+
val
|
|
345
|
+
}
|
|
346
|
+
@runsetflags.call(@walk_spec["copy"], {}, lambda { |vin|
|
|
347
|
+
VoxgigStruct.walk(vin, walkcopy)
|
|
348
|
+
cur[0]
|
|
349
|
+
})
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
# --- Merge tests ---
|
|
353
|
+
|
|
354
|
+
def test_merge_basic
|
|
355
|
+
spec_merge = @merge_spec["basic"]
|
|
356
|
+
test_input = VoxgigStruct.clone(spec_merge["in"])
|
|
357
|
+
expected_output = spec_merge["out"]
|
|
358
|
+
result = VoxgigStruct.merge(test_input)
|
|
359
|
+
assert deep_equal(result, expected_output),
|
|
360
|
+
"Merge basic: expected #{expected_output.inspect}, got #{result.inspect}"
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
def test_merge_cases
|
|
364
|
+
@runsetflags.call(@merge_spec["cases"], {}, VoxgigStruct.method(:merge))
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
def test_merge_array
|
|
368
|
+
@runsetflags.call(@merge_spec["array"], {}, VoxgigStruct.method(:merge))
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
def test_merge_integrity
|
|
372
|
+
@runsetflags.call(@merge_spec["integrity"], {}, VoxgigStruct.method(:merge))
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
def test_merge_depth
|
|
376
|
+
@runsetflags.call(@merge_spec["depth"], {}, lambda { |vin|
|
|
377
|
+
VoxgigStruct.merge(vin["val"], vin["depth"])
|
|
378
|
+
})
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
def test_merge_special
|
|
382
|
+
f0 = -> { nil }
|
|
383
|
+
assert deep_equal(VoxgigStruct.merge([f0]), f0)
|
|
384
|
+
assert deep_equal(VoxgigStruct.merge([nil, f0]), f0)
|
|
385
|
+
assert deep_equal(VoxgigStruct.merge([{ "a" => f0 }]), { "a" => f0 })
|
|
386
|
+
assert deep_equal(VoxgigStruct.merge([{ "a" => { "b" => f0 } }]), { "a" => { "b" => f0 } })
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
# --- getpath tests ---
|
|
390
|
+
|
|
391
|
+
def test_getpath_basic
|
|
392
|
+
@runsetflags.call(@getpath_spec["basic"], { "null" => false }, lambda { |vin|
|
|
393
|
+
VoxgigStruct.getpath(vin["store"], vin["path"])
|
|
394
|
+
})
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
def test_getpath_relative
|
|
398
|
+
@runsetflags.call(@getpath_spec["relative"], { "null" => false }, lambda { |vin|
|
|
399
|
+
injdef = {}
|
|
400
|
+
injdef['dparent'] = vin["dparent"] if vin.key?("dparent")
|
|
401
|
+
injdef['dpath'] = vin["dpath"].split('.') if vin.key?("dpath") && vin["dpath"].is_a?(String)
|
|
402
|
+
injdef['dpath'] = vin["dpath"] if vin.key?("dpath") && vin["dpath"].is_a?(Array)
|
|
403
|
+
VoxgigStruct.getpath(vin["store"], vin["path"], injdef)
|
|
404
|
+
})
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
def test_getpath_handler
|
|
408
|
+
@runsetflags.call(@getpath_spec["handler"], { "null" => false }, lambda { |vin|
|
|
409
|
+
store = {
|
|
410
|
+
'$TOP' => vin["store"],
|
|
411
|
+
'$FOO' => lambda { 'foo' }
|
|
412
|
+
}
|
|
413
|
+
injdef = {
|
|
414
|
+
'handler' => lambda { |inj, val, ref, _store|
|
|
415
|
+
val.respond_to?(:call) ? val.call : val
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
VoxgigStruct.getpath(store, vin["path"], injdef)
|
|
419
|
+
})
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
def test_getpath_special
|
|
423
|
+
@runsetflags.call(@getpath_spec["special"], { "null" => false }, lambda { |vin|
|
|
424
|
+
injdef = vin.key?("inj") ? vin["inj"] : nil
|
|
425
|
+
VoxgigStruct.getpath(vin["store"], vin["path"], injdef)
|
|
426
|
+
})
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
# --- inject tests ---
|
|
430
|
+
|
|
431
|
+
def test_inject_basic
|
|
432
|
+
basic_spec = @inject_spec["basic"]
|
|
433
|
+
test_input = VoxgigStruct.clone(basic_spec["in"])
|
|
434
|
+
result = VoxgigStruct.inject(test_input["val"], test_input["store"])
|
|
435
|
+
expected = basic_spec["out"]
|
|
436
|
+
assert deep_equal(result, expected),
|
|
437
|
+
"Inject basic: expected #{expected.inspect}, got #{result.inspect}"
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
def test_inject_string
|
|
441
|
+
testcases = @inject_spec["string"]["set"]
|
|
442
|
+
testcases.each do |entry|
|
|
443
|
+
vin = VoxgigStruct.clone(entry["in"])
|
|
444
|
+
expected = entry["out"]
|
|
445
|
+
result = VoxgigStruct.inject(vin["val"], vin["store"])
|
|
446
|
+
assert deep_equal(result, expected),
|
|
447
|
+
"Inject string: expected #{expected.inspect}, got #{result.inspect}"
|
|
448
|
+
end
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
def test_inject_deep
|
|
452
|
+
testcases = @inject_spec["deep"]["set"]
|
|
453
|
+
testcases.each do |entry|
|
|
454
|
+
vin = VoxgigStruct.clone(entry["in"])
|
|
455
|
+
expected = entry["out"]
|
|
456
|
+
result = VoxgigStruct.inject(vin["val"], vin["store"])
|
|
457
|
+
assert deep_equal(result, expected),
|
|
458
|
+
"Inject deep: expected #{expected.inspect}, got #{result.inspect}"
|
|
459
|
+
end
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
# --- transform tests ---
|
|
463
|
+
|
|
464
|
+
def test_transform_basic
|
|
465
|
+
basic_spec = @spec["transform"]["basic"]
|
|
466
|
+
test_input = VoxgigStruct.clone(basic_spec["in"])
|
|
467
|
+
expected = basic_spec["out"]
|
|
468
|
+
result = VoxgigStruct.transform(test_input["data"], test_input["spec"])
|
|
469
|
+
assert deep_equal(result, expected),
|
|
470
|
+
"Transform basic: expected #{expected.inspect}, got #{result.inspect}"
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
def test_transform_paths
|
|
474
|
+
@runsetflags.call(@spec["transform"]["paths"], {}, lambda { |vin|
|
|
475
|
+
VoxgigStruct.transform(vin["data"], vin["spec"])
|
|
476
|
+
})
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
def test_transform_cmds
|
|
480
|
+
@runsetflags.call(@spec["transform"]["cmds"], {}, lambda { |vin|
|
|
481
|
+
VoxgigStruct.transform(vin["data"], vin["spec"])
|
|
482
|
+
})
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
def test_transform_each
|
|
486
|
+
@runsetflags.call(@spec["transform"]["each"], {}, lambda { |vin|
|
|
487
|
+
VoxgigStruct.transform(vin["data"], vin["spec"])
|
|
488
|
+
})
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
def test_transform_pack
|
|
492
|
+
@runsetflags.call(@spec["transform"]["pack"], {}, lambda { |vin|
|
|
493
|
+
VoxgigStruct.transform(vin["data"], vin["spec"])
|
|
494
|
+
})
|
|
495
|
+
end
|
|
496
|
+
|
|
497
|
+
def test_transform_ref
|
|
498
|
+
@runsetflags.call(@spec["transform"]["ref"], {}, lambda { |vin|
|
|
499
|
+
VoxgigStruct.transform(vin["data"], vin["spec"])
|
|
500
|
+
})
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
def test_transform_format
|
|
504
|
+
@runsetflags.call(@spec["transform"]["format"], { "null" => false }, lambda { |vin|
|
|
505
|
+
VoxgigStruct.transform(vin["data"], vin["spec"])
|
|
506
|
+
})
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
def test_transform_apply
|
|
510
|
+
@runsetflags.call(@spec["transform"]["apply"], {}, lambda { |vin|
|
|
511
|
+
VoxgigStruct.transform(vin["data"], vin["spec"])
|
|
512
|
+
})
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
def test_transform_edge_apply
|
|
516
|
+
result = VoxgigStruct.transform({}, ['`$APPLY`', lambda { |v, _s, _i| 1 + v }, 1])
|
|
517
|
+
assert_equal 2, result
|
|
518
|
+
end
|
|
519
|
+
|
|
520
|
+
def test_transform_modify
|
|
521
|
+
@runsetflags.call(@spec["transform"]["modify"], {}, lambda { |vin|
|
|
522
|
+
VoxgigStruct.transform(
|
|
523
|
+
vin["data"],
|
|
524
|
+
vin["spec"],
|
|
525
|
+
{
|
|
526
|
+
'modify' => lambda { |val, key, parent, *_rest|
|
|
527
|
+
if !key.nil? && !parent.nil? && val.is_a?(String)
|
|
528
|
+
parent[key.to_s] = '@' + val
|
|
529
|
+
end
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
)
|
|
533
|
+
})
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
def test_transform_extra
|
|
537
|
+
result = VoxgigStruct.transform(
|
|
538
|
+
{ "a" => 1 },
|
|
539
|
+
{ "x" => "`a`", "b" => "`$COPY`", "c" => "`$UPPER`" },
|
|
540
|
+
{
|
|
541
|
+
'extra' => {
|
|
542
|
+
"b" => 2,
|
|
543
|
+
"$UPPER" => lambda { |inj, *_args|
|
|
544
|
+
path = inj.path
|
|
545
|
+
VoxgigStruct.getprop(path, path.length - 1).to_s.upcase
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
)
|
|
550
|
+
expected = { "x" => 1, "b" => 2, "c" => "C" }
|
|
551
|
+
assert deep_equal(result, expected),
|
|
552
|
+
"Transform extra: expected #{expected.inspect}, got #{result.inspect}"
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
def test_transform_funcval
|
|
556
|
+
f0 = -> { 99 }
|
|
557
|
+
assert deep_equal(VoxgigStruct.transform({}, { "x" => 1 }), { "x" => 1 })
|
|
558
|
+
assert deep_equal(VoxgigStruct.transform({}, { "x" => f0 }), { "x" => f0 })
|
|
559
|
+
assert deep_equal(VoxgigStruct.transform({ "a" => 1 }, { "x" => "`a`" }), { "x" => 1 })
|
|
560
|
+
assert deep_equal(VoxgigStruct.transform({ "f0" => f0 }, { "x" => "`f0`" }), { "x" => f0 })
|
|
561
|
+
end
|
|
562
|
+
|
|
563
|
+
# --- validate tests ---
|
|
564
|
+
|
|
565
|
+
def test_validate_basic
|
|
566
|
+
@runsetflags.call(@spec["validate"]["basic"], { "null" => false }, lambda { |vin|
|
|
567
|
+
VoxgigStruct.validate(vin["data"], vin["spec"])
|
|
568
|
+
})
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
def test_validate_child
|
|
572
|
+
@runsetflags.call(@spec["validate"]["child"], {}, lambda { |vin|
|
|
573
|
+
VoxgigStruct.validate(vin["data"], vin["spec"])
|
|
574
|
+
})
|
|
575
|
+
end
|
|
576
|
+
|
|
577
|
+
def test_validate_one
|
|
578
|
+
@runsetflags.call(@spec["validate"]["one"], {}, lambda { |vin|
|
|
579
|
+
VoxgigStruct.validate(vin["data"], vin["spec"])
|
|
580
|
+
})
|
|
581
|
+
end
|
|
582
|
+
|
|
583
|
+
def test_validate_exact
|
|
584
|
+
@runsetflags.call(@spec["validate"]["exact"], {}, lambda { |vin|
|
|
585
|
+
VoxgigStruct.validate(vin["data"], vin["spec"])
|
|
586
|
+
})
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
def test_validate_invalid
|
|
590
|
+
@runsetflags.call(@spec["validate"]["invalid"], { "null" => false }, lambda { |vin|
|
|
591
|
+
VoxgigStruct.validate(vin["data"], vin["spec"])
|
|
592
|
+
})
|
|
593
|
+
end
|
|
594
|
+
|
|
595
|
+
def test_validate_special
|
|
596
|
+
@runsetflags.call(@spec["validate"]["special"], {}, lambda { |vin|
|
|
597
|
+
injdef = vin.key?("inj") ? vin["inj"] : nil
|
|
598
|
+
VoxgigStruct.validate(vin["data"], vin["spec"], injdef)
|
|
599
|
+
})
|
|
600
|
+
end
|
|
601
|
+
|
|
602
|
+
def test_validate_edge
|
|
603
|
+
errs = []
|
|
604
|
+
VoxgigStruct.validate({ "x" => 1 }, { "x" => '`$INSTANCE`' }, { 'errs' => errs })
|
|
605
|
+
assert_equal 'Expected field x to be instance, but found integer: 1.', errs[0]
|
|
606
|
+
end
|
|
607
|
+
|
|
608
|
+
def test_validate_custom
|
|
609
|
+
errs = []
|
|
610
|
+
extra = {
|
|
611
|
+
"$INTEGER" => lambda { |inj, *_args|
|
|
612
|
+
key = inj.key
|
|
613
|
+
out = VoxgigStruct.getprop(inj.dparent, key)
|
|
614
|
+
|
|
615
|
+
t = VoxgigStruct.typify(out)
|
|
616
|
+
if 0 == (VoxgigStruct::T_integer & t)
|
|
617
|
+
inj.errs.push("Not an integer at #{inj.path[1..-1].join('.')}: #{out}")
|
|
618
|
+
return nil
|
|
619
|
+
end
|
|
620
|
+
out
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
shape = { "a" => '`$INTEGER`' }
|
|
625
|
+
|
|
626
|
+
out = VoxgigStruct.validate({ "a" => 1 }, shape, { 'extra' => extra, 'errs' => errs })
|
|
627
|
+
assert deep_equal(out, { "a" => 1 })
|
|
628
|
+
assert_equal 0, errs.length
|
|
629
|
+
|
|
630
|
+
out = VoxgigStruct.validate({ "a" => "A" }, shape, { 'extra' => extra, 'errs' => errs })
|
|
631
|
+
assert deep_equal(out, { "a" => "A" })
|
|
632
|
+
assert deep_equal(errs, ["Not an integer at a: A"])
|
|
633
|
+
end
|
|
634
|
+
|
|
635
|
+
# --- select tests ---
|
|
636
|
+
|
|
637
|
+
def test_select_basic
|
|
638
|
+
@runsetflags.call(@spec["select"]["basic"], {}, lambda { |vin|
|
|
639
|
+
VoxgigStruct.select(vin["obj"], vin["query"])
|
|
640
|
+
})
|
|
641
|
+
end
|
|
642
|
+
|
|
643
|
+
def test_select_operators
|
|
644
|
+
@runsetflags.call(@spec["select"]["operators"], {}, lambda { |vin|
|
|
645
|
+
VoxgigStruct.select(vin["obj"], vin["query"])
|
|
646
|
+
})
|
|
647
|
+
end
|
|
648
|
+
|
|
649
|
+
def test_select_edge
|
|
650
|
+
@runsetflags.call(@spec["select"]["edge"], {}, lambda { |vin|
|
|
651
|
+
VoxgigStruct.select(vin["obj"], vin["query"])
|
|
652
|
+
})
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
def test_select_alts
|
|
656
|
+
@runsetflags.call(@spec["select"]["alts"], {}, lambda { |vin|
|
|
657
|
+
VoxgigStruct.select(vin["obj"], vin["query"])
|
|
658
|
+
})
|
|
659
|
+
end
|
|
660
|
+
|
|
661
|
+
# --- json-builder tests ---
|
|
662
|
+
|
|
663
|
+
def test_json_builder
|
|
664
|
+
assert deep_equal(VoxgigStruct.jm("a", 1), { "a" => 1 })
|
|
665
|
+
assert deep_equal(VoxgigStruct.jm("a", 1, "b", 2), { "a" => 1, "b" => 2 })
|
|
666
|
+
assert deep_equal(VoxgigStruct.jt(1, 2, 3), [1, 2, 3])
|
|
667
|
+
assert deep_equal(VoxgigStruct.jt(), [])
|
|
668
|
+
end
|
|
669
|
+
|
|
670
|
+
end
|
package/src/cmp/Main.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, names
|
|
2
|
+
import { cmp, names } from 'jostraca'
|
|
3
3
|
|
|
4
4
|
import { requirePath } from '../utility'
|
|
5
5
|
|
|
@@ -12,21 +12,6 @@ const Main = cmp(function Main(props: any) {
|
|
|
12
12
|
const { target, ctx$ } = props
|
|
13
13
|
const { model, stdrep, log } = ctx$
|
|
14
14
|
|
|
15
|
-
const copyOpts: any = {
|
|
16
|
-
// This folder is relative to the .sdk folder in the project, as that is where
|
|
17
|
-
// the sdk is generated from.
|
|
18
|
-
from: 'tm/' + target.name,
|
|
19
|
-
replace: {
|
|
20
|
-
...stdrep,
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (false === target.srcfeature) {
|
|
25
|
-
copyOpts.exclude = [/src\//]
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
Copy(copyOpts)
|
|
29
|
-
|
|
30
15
|
const Main_sdk = requirePath(ctx$, `cmp/${target.name}/Main_${target.name}`)
|
|
31
16
|
|
|
32
17
|
Main_sdk['Main']({ model, target, stdrep })
|