@voxgig/sdkgen 4.8.2 → 4.8.3
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/action/doctor.d.ts +1 -0
- package/dist/action/doctor.js +50 -2
- package/dist/action/doctor.js.map +1 -1
- package/dist/helpers/naming.js +4 -2
- package/dist/helpers/naming.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aon +21 -0
- package/package.json +1 -1
- package/project/.sdk/model/feature/secrets.aon +120 -18
- package/project/.sdk/model/target/c.aon +10 -0
- package/project/.sdk/model/target/clojure.aon +13 -0
- package/project/.sdk/model/target/cpp.aon +10 -0
- package/project/.sdk/model/target/csharp.aon +9 -0
- package/project/.sdk/model/target/dart.aon +10 -0
- package/project/.sdk/model/target/elixir.aon +9 -0
- package/project/.sdk/model/target/go.aon +13 -0
- package/project/.sdk/model/target/java.aon +9 -0
- package/project/.sdk/model/target/js.aon +7 -0
- package/project/.sdk/model/target/kotlin.aon +9 -0
- package/project/.sdk/model/target/lean.aon +17 -0
- package/project/.sdk/model/target/lua.aon +8 -0
- package/project/.sdk/model/target/ocaml.aon +9 -0
- package/project/.sdk/model/target/perl.aon +8 -0
- package/project/.sdk/model/target/php.aon +8 -0
- package/project/.sdk/model/target/py.aon +13 -0
- package/project/.sdk/model/target/rb.aon +8 -0
- package/project/.sdk/model/target/rust.aon +10 -0
- package/project/.sdk/model/target/scala.aon +21 -2
- package/project/.sdk/model/target/swift.aon +18 -0
- package/project/.sdk/model/target/ts.aon +13 -0
- package/project/.sdk/src/cmp/clojure/Package_clojure.ts +9 -2
- package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +3 -0
- package/project/.sdk/src/cmp/dart/Test_dart.ts +2 -0
- package/project/.sdk/src/cmp/elixir/Package_elixir.ts +4 -1
- package/project/.sdk/src/cmp/go/Config_go.ts +59 -2
- package/project/.sdk/src/cmp/go/Main_go.ts +8 -2
- package/project/.sdk/src/cmp/java/Test_java.ts +6 -5
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +6 -5
- package/project/.sdk/src/cmp/lean/Package_lean.ts +23 -0
- package/project/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +1 -0
- package/project/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/Gitignore_ocaml.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +7 -3
- package/project/.sdk/src/cmp/py/Config_py.ts +82 -1
- package/project/.sdk/src/cmp/py/Main_py.ts +44 -0
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +2 -0
- package/project/.sdk/src/cmp/swift/Main_swift.ts +10 -0
- package/project/.sdk/src/cmp/swift/Package_swift.ts +13 -1
- package/project/.sdk/src/cmp/ts/Config_ts.ts +42 -17
- package/project/.sdk/src/cmp/ts/fragment/Config.data.fragment.ts +13 -1
- package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +13 -1
- package/project/.sdk/tm/c/Makefile +38 -3
- package/project/.sdk/tm/c/tests/omni_resolver.h +361 -0
- package/project/.sdk/tm/c/tests/omni_smoke_test.c +237 -0
- package/project/.sdk/tm/c/tests/primary_corpus_test.c +205 -284
- package/project/.sdk/tm/c/tests/struct_corpus_test.c +292 -212
- package/project/.sdk/tm/c/tests/vendor/omni/json.c +811 -0
- package/project/.sdk/tm/c/tests/vendor/omni/omni.h +240 -0
- package/project/.sdk/tm/c/tests/vendor/omni/runner.c +940 -0
- package/project/.sdk/tm/c/tests/vendor/omni/util.c +351 -0
- package/project/.sdk/tm/c/utility/struct/utility.c +7 -2
- package/project/.sdk/tm/clojure/test/sdk/test/omni.clj +401 -0
- package/project/.sdk/tm/clojure/test/sdk/test/omni_smoke.clj +81 -0
- package/project/.sdk/tm/clojure/test/sdk/test/primary.clj +92 -58
- package/project/.sdk/tm/clojure/test/sdk/test/struct_corpus.clj +122 -149
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +8 -3
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/json.clj +145 -0
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/runner.clj +445 -0
- package/project/.sdk/tm/clojure/test/vendor/omni/voxgig/omni/util.clj +145 -0
- package/project/.sdk/tm/cpp/Makefile +5 -1
- package/project/.sdk/tm/cpp/test/omni_resolver.hpp +473 -0
- package/project/.sdk/tm/cpp/test/omni_smoke_test.cpp +209 -0
- package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +243 -184
- package/project/.sdk/tm/cpp/test/runner_support.hpp +68 -181
- package/project/.sdk/tm/cpp/test/struct_corpus_test.cpp +183 -56
- package/project/.sdk/tm/cpp/test/vendor/omni/json.hpp +406 -0
- package/project/.sdk/tm/cpp/test/vendor/omni/omni.hpp +751 -0
- package/project/.sdk/tm/cpp/test/vendor/omni/util.hpp +256 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +7 -1
- package/project/.sdk/tm/csharp/test/OmniResolver.cs +491 -0
- package/project/.sdk/tm/csharp/test/OmniSmokeTest.cs +106 -0
- package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +299 -316
- package/project/.sdk/tm/csharp/test/Runner.cs +104 -269
- package/project/.sdk/tm/csharp/test/StructUtilityTest.cs +535 -724
- package/project/.sdk/tm/csharp/test/vendor/omni/Runner.cs +864 -0
- package/project/.sdk/tm/csharp/test/vendor/omni/Util.cs +347 -0
- package/project/.sdk/tm/csharp/utility/MakeSpec.cs +3 -1
- package/project/.sdk/tm/csharp/utility/PrepareMethod.cs +6 -1
- package/project/.sdk/tm/csharp/utility/struct/Struct.cs +21 -5
- package/project/.sdk/tm/dart/test/omni.dart +520 -0
- package/project/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
- package/project/.sdk/tm/dart/test/primary_test.dart +86 -28
- package/project/.sdk/tm/dart/test/struct_test.dart +438 -11
- package/project/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
- package/project/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
- package/project/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
- package/project/.sdk/tm/elixir/Makefile +11 -3
- package/project/.sdk/tm/elixir/test/omni_smoke_test.exs +117 -0
- package/project/.sdk/tm/elixir/test/primary_utility_test.exs +341 -16
- package/project/.sdk/tm/elixir/test/struct_corpus_test.exs +554 -9
- package/project/.sdk/tm/elixir/test/support/omni.ex +377 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/json.ex +122 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/runner.ex +623 -0
- package/project/.sdk/tm/elixir/test/vendor/omni/util.ex +187 -0
- package/project/.sdk/tm/go/core/context.go +32 -16
- package/project/.sdk/tm/go/feature/secrets/plugin/capability.go +261 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/catalog.go +78 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/config.go +652 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/depend.go +250 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/env.go +194 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/export.go +80 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/graph.go +238 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/host.go +1575 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/order.go +248 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/point.go +184 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/ref.go +123 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/resolve.go +79 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/types.go +296 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/util.go +87 -0
- package/project/.sdk/tm/go/feature/secrets/plugin/version.go +161 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/aws/aws.go +292 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/aws/sigv4.go +201 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/azuresecrets/azuresecrets.go +187 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/boru/boru.go +184 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/doppler/doppler.go +114 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/gcpsecrets/gcpsecrets.go +156 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/hashicorp/hashicorp.go +209 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/httpjson/httpjson.go +241 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/infisical/infisical.go +151 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/onepassword/onepassword.go +152 -0
- package/project/.sdk/tm/go/feature/secrets/plugins/secretspec/secretspec.go +143 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/addr.go +120 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/providers.go +439 -0
- package/project/.sdk/tm/go/feature/secrets/sekreto/sekreto.go +685 -0
- package/project/.sdk/tm/go/feature/secrets_feature.go +675 -0
- package/project/.sdk/tm/go/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +799 -0
- package/project/.sdk/tm/go/test/omni/omni.go +897 -0
- package/project/.sdk/tm/go/test/omni/util.go +360 -0
- package/project/.sdk/tm/go/test/omniresolver_test.go +748 -0
- package/project/.sdk/tm/go/test/omnismoke_test.go +112 -0
- package/project/.sdk/tm/go/test/primary_utility_test.go +123 -191
- package/project/.sdk/tm/go/test/struct_utility_test.go +323 -16
- package/project/.sdk/tm/go/test/testsupport_test.go +294 -0
- package/project/.sdk/tm/go/utility/make_options.go +8 -1
- package/project/.sdk/tm/go/utility/prepare_method.go +5 -1
- package/project/.sdk/tm/go/utility/struct/voxgigstruct.go +2 -2
- package/project/.sdk/tm/java/test/OmniResolver.java +355 -0
- package/project/.sdk/tm/java/test/OmniSmokeTest.java +99 -0
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +254 -280
- package/project/.sdk/tm/java/test/RunnerSupport.java +9 -194
- package/project/.sdk/tm/java/test/StructCorpusTest.java +119 -42
- package/project/.sdk/tm/java/test/vendor/omni/Json.java +287 -0
- package/project/.sdk/tm/java/test/vendor/omni/Runner.java +851 -0
- package/project/.sdk/tm/java/test/vendor/omni/Util.java +322 -0
- package/project/.sdk/tm/java/utility/MakeSpec.java +3 -1
- package/project/.sdk/tm/java/utility/PrepareMethod.java +5 -5
- package/project/.sdk/tm/java/utility/struct/Struct.java +17 -4
- package/project/.sdk/tm/js/src/utility/StructUtility.js +3 -3
- package/project/.sdk/tm/js/test/omni.js +251 -0
- package/project/.sdk/tm/js/test/omni.test.js +105 -0
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +6 -2
- package/project/.sdk/tm/js/test/utility/StructUtility.test.js +27 -2
- package/project/.sdk/tm/js/test/vendor/omni/index.js +77 -0
- package/project/.sdk/tm/js/test/vendor/omni/runner.js +613 -0
- package/project/.sdk/tm/js/test/vendor/omni/util.js +212 -0
- package/project/.sdk/tm/kotlin/core/Utility.kt +1 -1
- package/project/.sdk/tm/kotlin/test/OmniResolver.kt +343 -0
- package/project/.sdk/tm/kotlin/test/OmniSmokeTest.kt +100 -0
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +244 -262
- package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +9 -178
- package/project/.sdk/tm/kotlin/test/StructCorpusTest.kt +121 -32
- package/project/.sdk/tm/kotlin/test/vendor/omni/Json.kt +264 -0
- package/project/.sdk/tm/kotlin/test/vendor/omni/Runner.kt +615 -0
- package/project/.sdk/tm/kotlin/test/vendor/omni/Util.kt +139 -0
- package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -3
- package/project/.sdk/tm/kotlin/utility/Prepare.kt +6 -6
- package/project/.sdk/tm/kotlin/utility/struct/Struct.kt +18 -2
- package/project/.sdk/tm/lean/Makefile +12 -5
- package/project/.sdk/tm/lean/src/SdkUtility.lean +14 -1
- package/project/.sdk/tm/lean/test/OmniResolver.lean +358 -0
- package/project/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
- package/project/.sdk/tm/lean/test/StructCorpus.lean +245 -574
- package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +155 -291
- package/project/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
- package/project/.sdk/tm/lua/test/omni.lua +456 -0
- package/project/.sdk/tm/lua/test/omni_smoke_test.lua +103 -0
- package/project/.sdk/tm/lua/test/primary_utility_test.lua +250 -509
- package/project/.sdk/tm/lua/test/struct_utility_test.lua +161 -70
- package/project/.sdk/tm/lua/test/vendor/omni/json.lua +268 -0
- package/project/.sdk/tm/lua/test/vendor/omni/regex.lua +385 -0
- package/project/.sdk/tm/lua/test/vendor/omni/runner.lua +641 -0
- package/project/.sdk/tm/lua/test/vendor/omni/util.lua +282 -0
- package/project/.sdk/tm/lua/utility/prepare_method.lua +5 -1
- package/project/.sdk/tm/lua/utility/struct/regex.lua +663 -0
- package/project/.sdk/tm/lua/utility/struct/struct.lua +660 -420
- package/project/.sdk/tm/ocaml/Makefile +37 -12
- package/project/.sdk/tm/ocaml/test/omni_resolver.ml +284 -0
- package/project/.sdk/tm/ocaml/test/omni_smoke_test.ml +169 -0
- package/project/.sdk/tm/ocaml/test/primary_utility_test.ml +84 -100
- package/project/.sdk/tm/ocaml/test/struct_corpus.ml +225 -201
- package/project/.sdk/tm/ocaml/test/vendor/omni/omni.ml +1157 -0
- package/project/.sdk/tm/perl/lib/Voxgig/Struct.pm +88 -12
- package/project/.sdk/tm/perl/t/omni.pm +647 -0
- package/project/.sdk/tm/perl/t/omni_smoke.t +87 -0
- package/project/.sdk/tm/perl/t/primary_utility.t +189 -487
- package/project/.sdk/tm/perl/t/struct_utility.t +455 -389
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Runner.pm +649 -0
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni/Util.pm +253 -0
- package/project/.sdk/tm/perl/t/vendor/omni/Voxgig/Omni.pm +24 -0
- package/project/.sdk/tm/perl/utility/prepare_method.pm +7 -2
- package/project/.sdk/tm/php/test/Omni.php +691 -0
- package/project/.sdk/tm/php/test/OmniSmokeTest.php +93 -0
- package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +210 -571
- package/project/.sdk/tm/php/test/StructUtilityTest.php +320 -342
- package/project/.sdk/tm/php/test/vendor/omni/Runner.php +644 -0
- package/project/.sdk/tm/php/test/vendor/omni/Util.php +283 -0
- package/project/.sdk/tm/php/utility/MakeSpec.php +10 -3
- package/project/.sdk/tm/php/utility/PrepareBody.php +7 -1
- package/project/.sdk/tm/php/utility/PrepareMethod.php +6 -2
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/__init__.py +36 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/capability.py +141 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/catalog.py +50 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/config.py +333 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/depend.py +198 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/env.py +147 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/export.py +52 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/graph.py +139 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/host.py +1053 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/order.py +171 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/point.py +95 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/ref.py +116 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/resolve.py +59 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/types.py +87 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_plugin/version.py +112 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/__init__.py +74 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/addr.py +116 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/aws.py +192 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/azuresecrets.py +120 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/boru.py +140 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/doppler.py +62 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/gcpsecrets.py +101 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/hashicorp.py +152 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/httpjson.py +115 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/infisical.py +92 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/onepassword.py +101 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/secretspec.py +119 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/plugins/sigv4.py +125 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/providers.py +211 -0
- package/project/.sdk/tm/py/pkg/feature/secrets/voxgig_sekreto/sekreto.py +455 -0
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +467 -0
- package/project/.sdk/tm/py/pkg/utility/prepare_method.py +5 -1
- package/project/.sdk/tm/py/pkg/utility/voxgig_struct/__init__.py +0 -2
- package/project/.sdk/tm/py/pkg/utility/voxgig_struct/voxgig_struct.py +780 -529
- package/project/.sdk/tm/py/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/py/test/feature/__init__.py +0 -0
- package/project/.sdk/tm/py/test/feature/secrets/__init__.py +0 -0
- package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +337 -0
- package/project/.sdk/tm/py/test/omni.py +415 -0
- package/project/.sdk/tm/py/test/test_omni_smoke.py +74 -0
- package/project/.sdk/tm/py/test/test_primary_utility.py +144 -668
- package/project/.sdk/tm/py/test/test_struct_utility.py +74 -27
- package/project/.sdk/tm/py/test/voxgig_omni/__init__.py +62 -0
- package/project/.sdk/tm/py/test/voxgig_omni/runner.py +566 -0
- package/project/.sdk/tm/py/test/voxgig_omni/util.py +237 -0
- package/project/.sdk/tm/rb/test/omni.rb +505 -0
- package/project/.sdk/tm/rb/test/omni_smoke_test.rb +72 -0
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +174 -560
- package/project/.sdk/tm/rb/test/struct_utility_test.rb +13 -7
- package/project/.sdk/tm/rb/test/vendor/omni/runner.rb +493 -0
- package/project/.sdk/tm/rb/test/vendor/omni/util.rb +199 -0
- package/project/.sdk/tm/rb/test/vendor/omni/voxgig_omni.rb +15 -0
- package/project/.sdk/tm/rb/utility/prepare_method.rb +5 -1
- package/project/.sdk/tm/rust/tests/common/mod.rs +19 -242
- package/project/.sdk/tm/rust/tests/omni_resolver/mod.rs +888 -0
- package/project/.sdk/tm/rust/tests/omni_smoke_test.rs +286 -0
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +318 -312
- package/project/.sdk/tm/rust/tests/struct_utility_test.rs +66 -28
- package/project/.sdk/tm/rust/tests/vendor/omni/json.rs +412 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/mod.rs +38 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/regex.rs +392 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/runner.rs +1001 -0
- package/project/.sdk/tm/rust/tests/vendor/omni/util.rs +161 -0
- package/project/.sdk/tm/rust/utility/prepare_method.rs +5 -1
- package/project/.sdk/tm/scala/Makefile +16 -6
- package/project/.sdk/tm/scala/sdktest/OmniResolver.scala +497 -0
- package/project/.sdk/tm/scala/sdktest/OmniSmoke.scala +192 -0
- package/project/.sdk/tm/scala/sdktest/PrimaryCorpus.scala +47 -19
- package/project/.sdk/tm/scala/sdktest/StructCorpus.scala +0 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Json.scala +229 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Runner.scala +552 -0
- package/project/.sdk/tm/scala/sdktest/vendor/omni/Util.scala +104 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Constants.swift +10 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Inject.swift +28 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Injection.swift +5 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Minor.swift +4 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/Struct/Validate.swift +15 -5
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Prepare.swift +6 -1
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniResolver.swift +474 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/OmniSmokeTest.swift +107 -0
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +141 -178
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/Runner.swift +17 -113
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/StructUtilityTest.swift +295 -446
- package/project/.sdk/tm/swift/Tests/vendor/omni/Json.swift +364 -0
- package/project/.sdk/tm/swift/Tests/vendor/omni/Runner.swift +730 -0
- package/project/.sdk/tm/swift/Tests/vendor/omni/Util.swift +162 -0
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +7 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Capability.ts +148 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Catalog.ts +55 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Config.ts +344 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Depend.ts +205 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Env.ts +138 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Export.ts +46 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/FeatureHost.ts +349 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Graph.ts +181 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Host.ts +1132 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Order.ts +177 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Point.ts +119 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Ref.ts +102 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Resolve.ts +61 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Types.ts +112 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/Version.ts +100 -0
- package/project/.sdk/tm/ts/src/feature/secrets/plugin/index.ts +37 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/Sekreto.ts +163 -30
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/index.ts +27 -22
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/aws.ts +26 -36
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/azuresecrets.ts +19 -21
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/boru.ts +36 -17
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/doppler.ts +14 -21
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/gcpsecrets.ts +27 -27
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/hashicorp.ts +25 -39
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/httpjson.ts +99 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/infisical.ts +14 -16
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{provider → plugins}/onepassword.ts +15 -22
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/plugins/secretspec.ts +98 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/{Sigv4.ts → plugins/sigv4.ts} +7 -6
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/addr.ts +97 -23
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/builtin.ts +37 -0
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/dotenv.ts +4 -17
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/env.ts +4 -16
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/file.ts +11 -25
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/memory.ts +6 -23
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/support.ts +106 -39
- package/project/.sdk/tm/ts/src/utility/StructUtility.ts +3 -3
- package/project/.sdk/tm/ts/test/omni.ts +104 -32
- package/project/.sdk/tm/ts/test/utility/StructUtility.test.ts +27 -0
- package/project/.sdk/tm/ts/test/vendor/omni/Runner.ts +32 -5
- package/project/.sdk/tm/ts/test/vendor/omni/Util.ts +2 -2
- package/project/.sdk/tm/ts/test/vendor/omni/index.ts +2 -2
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +1 -1
- package/project/.sdk/tm/zig/test/struct_runner.zig +5 -4
- package/project/sdkgen-package.json +1 -1
- package/src/action/doctor.ts +66 -2
- package/src/helpers/naming.ts +4 -2
- package/project/.sdk/tm/c/tests/runner.h +0 -274
- package/project/.sdk/tm/cpp/test/struct_runner.hpp +0 -314
- package/project/.sdk/tm/csharp/test/StructRunner.cs +0 -276
- package/project/.sdk/tm/dart/test/runner.dart +0 -406
- package/project/.sdk/tm/dart/test/struct_corpus.dart +0 -531
- package/project/.sdk/tm/elixir/test/support/struct_corpus.ex +0 -1088
- package/project/.sdk/tm/go/test/runner_test.go +0 -629
- package/project/.sdk/tm/go/test/struct_runner_test.go +0 -1094
- package/project/.sdk/tm/java/test/StructRunner.java +0 -281
- package/project/.sdk/tm/js/test/runner.js +0 -387
- package/project/.sdk/tm/kotlin/test/StructRunner.kt +0 -177
- package/project/.sdk/tm/lua/test/struct_runner.lua +0 -602
- package/project/.sdk/tm/ocaml/test/corpus_runner.ml +0 -185
- package/project/.sdk/tm/perl/t/struct_runner.pm +0 -275
- package/project/.sdk/tm/php/test/StructRunner.php +0 -275
- package/project/.sdk/tm/py/test/struct_runner.py +0 -411
- package/project/.sdk/tm/rb/test/struct_runner.rb +0 -309
- package/project/.sdk/tm/rust/tests/struct_runner/mod.rs +0 -424
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/Registry.ts +0 -90
- package/project/.sdk/tm/ts/src/feature/secrets/sekreto/provider/http.ts +0 -66
- package/project/.sdk/tm/ts/test/vendor/omni/compat.ts +0 -188
|
@@ -1,477 +1,361 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
1
|
+
// Drives the shared struct corpus (../../../.sdk/test/test.json, root key
|
|
2
|
+
// "struct") against the vendored struct utility THROUGH the vendored omni
|
|
3
|
+
// runner (OmniResolver over Tests/vendor/omni) - the engine half of the
|
|
4
|
+
// hand-written runner this file used to carry. Mirrors
|
|
5
|
+
// tm/csharp/test/StructUtilityTest.cs and tm/go/test/struct_utility_test.go.
|
|
6
|
+
//
|
|
7
|
+
// What changed with the migration, and why each change is load-bearing:
|
|
8
|
+
//
|
|
9
|
+
// - A missing or EMPTY category/section now FAILS. The retired inline
|
|
10
|
+
// engine returned early whenever a section did not resolve to a list,
|
|
11
|
+
// so `testSentinels` drove a category called "sentinels" that the
|
|
12
|
+
// corpus renamed to "nullsem" LONG AGO and reported PASS over zero
|
|
13
|
+
// assertions for every one of its 33 entries.
|
|
14
|
+
//
|
|
15
|
+
// - `err:` entries now RUN. The retired engine skipped every entry
|
|
16
|
+
// carrying one ("not yet wired uniformly"), which silently dropped 55
|
|
17
|
+
// cases - all of validate.invalid and transform.apply among them.
|
|
18
|
+
// Struct's Swift port COLLECTS diagnostics in `Injection.errs` instead
|
|
19
|
+
// of raising (unlike the C#/TS ports, which throw), so the validate and
|
|
20
|
+
// transform subjects below collect and raise them; the messages
|
|
21
|
+
// asserted are the port's own.
|
|
22
|
+
//
|
|
23
|
+
// - `match:` entries now RUN. The retired engine compared `out` only, so
|
|
24
|
+
// `minor.setpath` and `merge.integrity` - thirteen entries whose whole
|
|
25
|
+
// point is `match: {args: ...}`, i.e. what the call did to its
|
|
26
|
+
// ARGUMENTS - asserted nothing about that. Subjects therefore no longer
|
|
27
|
+
// clone their input: an in-place rewrite has to be visible.
|
|
28
|
+
//
|
|
29
|
+
// - `.noval` and `.null` are DISTINCT. The retired engine's canonical
|
|
30
|
+
// comparison folded them together; omni's `null` flag decides per
|
|
31
|
+
// section, and the flags below track csharp's.
|
|
32
|
+
//
|
|
33
|
+
// RUN: cd swift && swift test
|
|
34
|
+
// RUN-SOME: swift test --filter StructUtilityTest.testMinor
|
|
3
35
|
|
|
36
|
+
import Foundation
|
|
4
37
|
import XCTest
|
|
5
38
|
|
|
6
39
|
@testable import ProjectNameSdk
|
|
7
40
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
private func fixNull(_ v: Value) -> Value {
|
|
24
|
-
switch v {
|
|
25
|
-
case .null: return .string(NULLMARK)
|
|
26
|
-
case .list(let l): return .list(l.items.map { fixNull($0) })
|
|
27
|
-
case .map(let m):
|
|
28
|
-
let nm = VMap()
|
|
29
|
-
for (k, vv) in m.entries { nm.entries[k] = fixNull(vv) }
|
|
30
|
-
return .map(nm)
|
|
31
|
-
default: return v
|
|
41
|
+
final class StructUtilityTest: XCTestCase {
|
|
42
|
+
|
|
43
|
+
// One corpus runner for the whole suite (XCTest builds a fresh instance
|
|
44
|
+
// per test method, so the runner is static).
|
|
45
|
+
private static var RUN: OmniResolver.Run?
|
|
46
|
+
private static let runLock = NSLock()
|
|
47
|
+
|
|
48
|
+
private static func structRun() throws -> OmniResolver.Run {
|
|
49
|
+
runLock.lock()
|
|
50
|
+
defer { runLock.unlock() }
|
|
51
|
+
if let run = RUN { return run }
|
|
52
|
+
let run = try OmniResolver.makeRunner(
|
|
53
|
+
SdkRunner.testJsonPath(), ProjectNameSDK.testSDK(nil, nil))("struct")
|
|
54
|
+
RUN = run
|
|
55
|
+
return run
|
|
32
56
|
}
|
|
33
|
-
}
|
|
34
57
|
|
|
35
|
-
//
|
|
36
|
-
// `
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
58
|
+
// Run one corpus section through the vendored engine, failing loudly when
|
|
59
|
+
// the category, the section, or its `set` is missing or EMPTY - a renamed
|
|
60
|
+
// fixture must not report PASS while running zero assertions. The case
|
|
61
|
+
// count is printed so a collapse is visible in the log, not just in a
|
|
62
|
+
// red/green bit.
|
|
63
|
+
private func runStruct(
|
|
64
|
+
_ category: String, _ name: String, _ nullFlag: Bool,
|
|
65
|
+
_ subject: @escaping (Value) throws -> Value,
|
|
66
|
+
file: StaticString = #filePath, line: UInt = #line
|
|
67
|
+
) {
|
|
68
|
+
let label = category + "." + name
|
|
69
|
+
do {
|
|
70
|
+
let run = try StructUtilityTest.structRun()
|
|
71
|
+
|
|
72
|
+
let cat = run.spec.get(category)
|
|
73
|
+
guard cat.isMap else {
|
|
74
|
+
return XCTFail(
|
|
75
|
+
"struct corpus category missing: \(category) - check .sdk/test/struct/",
|
|
76
|
+
file: file, line: line)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let section = cat.get(name)
|
|
80
|
+
guard section.isMap else {
|
|
81
|
+
return XCTFail(
|
|
82
|
+
"struct corpus section missing: \(label) - check .sdk/test/struct/",
|
|
83
|
+
file: file, line: line)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
guard let count = section.setCount else {
|
|
87
|
+
return XCTFail(
|
|
88
|
+
"struct corpus section has no set list: \(label) - zero cases would run",
|
|
89
|
+
file: file, line: line)
|
|
90
|
+
}
|
|
91
|
+
guard 0 < count else {
|
|
92
|
+
return XCTFail(
|
|
93
|
+
"struct corpus section is EMPTY: \(label) - zero cases would run",
|
|
94
|
+
file: file, line: line)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
try run.runsetflags(section, nullFlag) { args in
|
|
98
|
+
try subject(args.first ?? .noval)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
print("ok \(label): \(count)/\(count)")
|
|
102
|
+
} catch {
|
|
103
|
+
XCTFail("\(label): \(OmniResolver.message(error))", file: file, line: line)
|
|
44
104
|
}
|
|
45
105
|
}
|
|
46
|
-
}
|
|
47
106
|
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
107
|
+
// A section of the corpus in the SDK's value model, for the few subjects
|
|
108
|
+
// that need to read fixture data directly.
|
|
109
|
+
private func section(_ category: String, _ name: String) throws -> Value {
|
|
110
|
+
try StructUtilityTest.structRun().spec.get([category, name]).value
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// MARK: - Local helpers
|
|
114
|
+
|
|
115
|
+
private func intArg(_ v: Value) -> Int? { v.asInt.map(Int.init) }
|
|
57
116
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
117
|
+
// A RAW fixture read. `gp`/`getprop` is Group A - a stored null reads as
|
|
118
|
+
// absent - so reading a fixture field with it collapses the very
|
|
119
|
+
// distinction the `null: false` sections exist to test (an explicit
|
|
120
|
+
// `alt: null` arrived as "no alt", and `data: null` as "no data").
|
|
121
|
+
// `lookup` is Group B: the stored value, null included, and `.noval` only
|
|
122
|
+
// when the key is genuinely missing.
|
|
123
|
+
private func raw(_ v: Value, _ key: String) -> Value { lookup(v, .string(key)) }
|
|
124
|
+
|
|
125
|
+
// An Injection whose `errs` list this suite holds, so the diagnostics
|
|
126
|
+
// struct's Swift port COLLECTS can be raised as the failure the corpus
|
|
127
|
+
// `err:` entries expect. (The C# port raises them from inside Validate;
|
|
128
|
+
// the Swift port does not - see the header note.)
|
|
129
|
+
private func errCollector() -> (Injection, VList) {
|
|
130
|
+
let inj = Injection(val: .noval, parent: .noval)
|
|
131
|
+
let errs = VList()
|
|
132
|
+
inj.errs = errs
|
|
133
|
+
return (inj, errs)
|
|
68
134
|
}
|
|
69
|
-
}
|
|
70
135
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
let spec = try JSON.parse(text)
|
|
76
|
-
return getprop(spec, .string("struct"))
|
|
77
|
-
} catch {
|
|
78
|
-
XCTFail("Failed to load corpus at \(CORPUS_PATH.path): \(error)")
|
|
79
|
-
return .noval
|
|
80
|
-
}
|
|
136
|
+
private func raiseErrs(_ errs: VList) throws {
|
|
137
|
+
if errs.items.isEmpty { return }
|
|
138
|
+
throw OmniResolver.SubjectError(
|
|
139
|
+
errs.items.map { stringify($0) }.joined(separator: " | "))
|
|
81
140
|
}
|
|
82
141
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// Skip entries with an `err:` field — those exercise error
|
|
91
|
-
// collection, which is not yet wired uniformly.
|
|
92
|
-
if em.entries["err"] != nil { continue }
|
|
93
|
-
let expected = em.entries["out"] ?? .noval
|
|
94
|
-
let got = subject(inVal)
|
|
95
|
-
let exp = canon(expected)
|
|
96
|
-
let gotS = canon(got)
|
|
97
|
-
if exp == gotS { pass += 1 } else { fails.append("[\(label)#\(i)] exp=\(exp) got=\(gotS)") }
|
|
98
|
-
}
|
|
99
|
-
if !fails.isEmpty {
|
|
100
|
-
for f in fails.prefix(5) { print(f) }
|
|
101
|
-
XCTFail("\(label): \(pass)/\(pass + fails.count) — \(fails.count) failed")
|
|
102
|
-
} else {
|
|
103
|
-
print("ok \(label): \(pass)/\(pass)")
|
|
104
|
-
}
|
|
142
|
+
// MARK: - Existence
|
|
143
|
+
|
|
144
|
+
func testMinorExists() {
|
|
145
|
+
XCTAssertFalse(isnode(.noval))
|
|
146
|
+
XCTAssertTrue(isnode(.map(VMap())))
|
|
147
|
+
XCTAssertEqual(typename(T_string), S_string)
|
|
148
|
+
XCTAssertEqual(escre(.string("a.b")), "a\\.b")
|
|
105
149
|
}
|
|
106
150
|
|
|
107
151
|
// MARK: - Minor
|
|
108
152
|
|
|
109
153
|
func testMinor() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
154
|
+
runStruct("minor", "isnode", true) { .bool(isnode($0)) }
|
|
155
|
+
runStruct("minor", "ismap", true) { .bool(ismap($0)) }
|
|
156
|
+
runStruct("minor", "islist", true) { .bool(islist($0)) }
|
|
157
|
+
runStruct("minor", "iskey", false) { .bool(iskey($0)) }
|
|
158
|
+
runStruct("minor", "isempty", false) { .bool(isempty($0)) }
|
|
159
|
+
runStruct("minor", "isfunc", true) { .bool(isfunc($0)) }
|
|
160
|
+
runStruct("minor", "size", false) { .int(Int64(size($0))) }
|
|
161
|
+
runStruct("minor", "typify", false) { .int(Int64(typify($0))) }
|
|
162
|
+
runStruct("minor", "typename", true) { .string(typename(Int($0.asInt ?? 0))) }
|
|
163
|
+
runStruct("minor", "strkey", false) { .string(strkey($0)) }
|
|
164
|
+
runStruct("minor", "keysof", true) { .list(keysof($0).map { Value.string($0) }) }
|
|
165
|
+
runStruct("minor", "clone", false) { clone($0) }
|
|
166
|
+
runStruct("minor", "escre", true) { .string(escre($0)) }
|
|
167
|
+
runStruct("minor", "escurl", true) { .string(escurl($0)) }
|
|
168
|
+
runStruct("minor", "items", true) { .list(items($0).map { Value.list($0) }) }
|
|
169
|
+
|
|
170
|
+
runStruct("minor", "haskey", false) {
|
|
171
|
+
.bool(haskey(gp($0, "src"), gp($0, "key")))
|
|
172
|
+
}
|
|
173
|
+
runStruct("minor", "getprop", false) {
|
|
174
|
+
getprop(gp($0, "val"), gp($0, "key"), self.raw($0, "alt"))
|
|
175
|
+
}
|
|
176
|
+
runStruct("minor", "getelem", false) {
|
|
177
|
+
getelem(gp($0, "val"), gp($0, "key"), gp($0, "alt"))
|
|
178
|
+
}
|
|
179
|
+
runStruct("minor", "stringify", false) {
|
|
180
|
+
if case .map(let m) = $0 {
|
|
181
|
+
return .string(stringify(m.entries["val"] ?? .noval,
|
|
182
|
+
m.entries["max"]?.asInt.map(Int.init)))
|
|
183
|
+
}
|
|
184
|
+
return .string(stringify($0))
|
|
185
|
+
}
|
|
186
|
+
runStruct("minor", "jsonify", false) {
|
|
187
|
+
var indent = 2
|
|
188
|
+
var offset = 0
|
|
189
|
+
let flags = gp($0, "flags")
|
|
190
|
+
if case .map = flags {
|
|
191
|
+
if case .int(let n) = gp(flags, "indent") { indent = Int(n) }
|
|
192
|
+
if case .int(let n) = gp(flags, "offset") { offset = Int(n) }
|
|
193
|
+
}
|
|
194
|
+
return .string(jsonify(lookup($0, .string("val")), indent: indent, offset: offset))
|
|
195
|
+
}
|
|
196
|
+
runStruct("minor", "pathify", false) {
|
|
197
|
+
.string(pathify(lookup($0, .string("path")), self.intArg(gp($0, "from"))))
|
|
198
|
+
}
|
|
199
|
+
runStruct("minor", "flatten", true) {
|
|
200
|
+
flatten(gp($0, "val"), self.intArg(gp($0, "depth")))
|
|
201
|
+
}
|
|
202
|
+
runStruct("minor", "filter", true) {
|
|
203
|
+
let checks: [String: (Value, Value) -> Bool] = [
|
|
204
|
+
"gt3": { _, v in (v.asDouble ?? 0) > 3 },
|
|
205
|
+
"lt3": { _, v in (v.asDouble ?? 0) < 3 },
|
|
206
|
+
]
|
|
207
|
+
let check = strkey(gp($0, "check"))
|
|
208
|
+
return filter(gp($0, "val"), checks[check] ?? { _, _ in false })
|
|
209
|
+
}
|
|
210
|
+
runStruct("minor", "join", false) {
|
|
211
|
+
let sep: String
|
|
212
|
+
if case .string(let s) = gp($0, "sep") { sep = s } else { sep = "," }
|
|
213
|
+
var url = false
|
|
214
|
+
if case .bool(let b) = gp($0, "url") { url = b }
|
|
215
|
+
return .string(join(gp($0, "val"), sep, url))
|
|
216
|
+
}
|
|
217
|
+
runStruct("minor", "slice", false) {
|
|
218
|
+
slice(gp($0, "val"), self.intArg(gp($0, "start")), self.intArg(gp($0, "end")))
|
|
219
|
+
}
|
|
220
|
+
runStruct("minor", "pad", false) {
|
|
221
|
+
let padding = self.intArg(gp($0, "pad"))
|
|
222
|
+
var padchar: Character = " "
|
|
223
|
+
if case .string(let c) = gp($0, "char"), let f = c.first { padchar = f }
|
|
224
|
+
return pad(lookup($0, .string("val")), padding, padchar)
|
|
113
225
|
}
|
|
114
226
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
runset(
|
|
128
|
-
"minor.isempty", getprop(.map(minor), .string("isempty")) |> setProp("set"),
|
|
129
|
-
{ .bool(isempty($0)) })
|
|
130
|
-
runset(
|
|
131
|
-
"minor.size", getprop(.map(minor), .string("size")) |> setProp("set"),
|
|
132
|
-
{ .int(Int64(size($0))) })
|
|
133
|
-
runset(
|
|
134
|
-
"minor.keysof", getprop(.map(minor), .string("keysof")) |> setProp("set"),
|
|
135
|
-
{ .list(keysof($0).map { Value.string($0) }) })
|
|
136
|
-
runset(
|
|
137
|
-
"minor.haskey", getprop(.map(minor), .string("haskey")) |> setProp("set"),
|
|
138
|
-
{ .bool(haskey(getprop($0, .string("src")), getprop($0, .string("key")))) })
|
|
139
|
-
runset(
|
|
140
|
-
"minor.getprop", getprop(.map(minor), .string("getprop")) |> setProp("set"),
|
|
141
|
-
{
|
|
142
|
-
getprop(
|
|
143
|
-
getprop($0, .string("val")),
|
|
144
|
-
getprop($0, .string("key")),
|
|
145
|
-
getprop($0, .string("alt")))
|
|
146
|
-
})
|
|
147
|
-
runset(
|
|
148
|
-
"minor.clone", getprop(.map(minor), .string("clone")) |> setProp("set"),
|
|
149
|
-
{ clone($0) })
|
|
150
|
-
runset(
|
|
151
|
-
"minor.escre", getprop(.map(minor), .string("escre")) |> setProp("set"),
|
|
152
|
-
{ .string(escre($0)) })
|
|
153
|
-
runset(
|
|
154
|
-
"minor.escurl", getprop(.map(minor), .string("escurl")) |> setProp("set"),
|
|
155
|
-
{ .string(escurl($0)) })
|
|
156
|
-
runset(
|
|
157
|
-
"minor.stringify", getprop(.map(minor), .string("stringify")) |> setProp("set"),
|
|
158
|
-
{
|
|
159
|
-
if case .map(let m) = $0 {
|
|
160
|
-
let v = m.entries["val"] ?? .noval
|
|
161
|
-
let maxlen = m.entries["max"]?.asInt.map(Int.init)
|
|
162
|
-
return .string(stringify(v, maxlen))
|
|
163
|
-
}
|
|
164
|
-
return .string(stringify($0))
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
func mset(_ name: String) -> Value { getprop(.map(minor), .string(name)) |> setProp("set") }
|
|
168
|
-
runset("minor.isfunc", mset("isfunc"), { .bool(isfunc($0)) })
|
|
169
|
-
runset("minor.typify", mset("typify"), { .int(Int64(typify($0))) })
|
|
170
|
-
runset("minor.typename", mset("typename"), { .string(typename(Int($0.asInt ?? 0))) })
|
|
171
|
-
runset("minor.strkey", mset("strkey"), { .string(strkey($0)) })
|
|
172
|
-
runset(
|
|
173
|
-
"minor.getelem", mset("getelem"),
|
|
174
|
-
{
|
|
175
|
-
getelem(
|
|
176
|
-
getprop($0, .string("val")), getprop($0, .string("key")), getprop($0, .string("alt")))
|
|
177
|
-
})
|
|
178
|
-
runset("minor.items", mset("items"), { .list(items($0).map { Value.list($0) }) })
|
|
179
|
-
runset(
|
|
180
|
-
"minor.flatten", mset("flatten"),
|
|
181
|
-
{
|
|
182
|
-
flatten(getprop($0, .string("val")), getprop($0, .string("depth")).asInt.map(Int.init))
|
|
183
|
-
})
|
|
184
|
-
let filterChecks: [String: (Value, Value) -> Bool] = [
|
|
185
|
-
"gt3": { _, v in (v.asDouble ?? 0) > 3 },
|
|
186
|
-
"lt3": { _, v in (v.asDouble ?? 0) < 3 },
|
|
187
|
-
]
|
|
188
|
-
runset(
|
|
189
|
-
"minor.filter", mset("filter"),
|
|
190
|
-
{
|
|
191
|
-
let check = strkey(getprop($0, .string("check")))
|
|
192
|
-
return filter(getprop($0, .string("val")), filterChecks[check] ?? { _, _ in false })
|
|
193
|
-
})
|
|
194
|
-
runset(
|
|
195
|
-
"minor.join", mset("join"),
|
|
196
|
-
{
|
|
197
|
-
let sep: String
|
|
198
|
-
if case .string(let s) = getprop($0, .string("sep")) { sep = s } else { sep = "," }
|
|
199
|
-
var url = false
|
|
200
|
-
if case .bool(let b) = getprop($0, .string("url")) { url = b }
|
|
201
|
-
return .string(join(getprop($0, .string("val")), sep, url))
|
|
202
|
-
})
|
|
203
|
-
runset(
|
|
204
|
-
"minor.jsonify", mset("jsonify"),
|
|
205
|
-
{
|
|
206
|
-
var indent = 2
|
|
207
|
-
var offset = 0
|
|
208
|
-
let flags = getprop($0, .string("flags"))
|
|
209
|
-
if case .map = flags {
|
|
210
|
-
if case .int(let n) = getprop(flags, .string("indent")) { indent = Int(n) }
|
|
211
|
-
if case .int(let n) = getprop(flags, .string("offset")) { offset = Int(n) }
|
|
212
|
-
}
|
|
213
|
-
return .string(jsonify(lookup($0, .string("val")), indent: indent, offset: offset))
|
|
214
|
-
})
|
|
215
|
-
runset(
|
|
216
|
-
"minor.pathify", mset("pathify"),
|
|
217
|
-
{
|
|
218
|
-
.string(
|
|
219
|
-
pathify(lookup($0, .string("path")), getprop($0, .string("from")).asInt.map(Int.init)))
|
|
220
|
-
})
|
|
221
|
-
runset(
|
|
222
|
-
"minor.slice", mset("slice"),
|
|
223
|
-
{
|
|
224
|
-
slice(
|
|
225
|
-
getprop($0, .string("val")),
|
|
226
|
-
getprop($0, .string("start")).asInt.map(Int.init),
|
|
227
|
-
getprop($0, .string("end")).asInt.map(Int.init))
|
|
228
|
-
})
|
|
229
|
-
runset(
|
|
230
|
-
"minor.pad", mset("pad"),
|
|
231
|
-
{
|
|
232
|
-
let padding = getprop($0, .string("pad")).asInt.map(Int.init)
|
|
233
|
-
let padchar: Character
|
|
234
|
-
if case .string(let c) = getprop($0, .string("char")), let f = c.first {
|
|
235
|
-
padchar = f
|
|
236
|
-
} else {
|
|
237
|
-
padchar = " "
|
|
238
|
-
}
|
|
239
|
-
return pad(lookup($0, .string("val")), padding, padchar)
|
|
240
|
-
})
|
|
241
|
-
runset(
|
|
242
|
-
"minor.setprop", mset("setprop"),
|
|
243
|
-
{
|
|
244
|
-
setprop(
|
|
245
|
-
clone(getprop($0, .string("parent"))), getprop($0, .string("key")),
|
|
246
|
-
lookup($0, .string("val")))
|
|
247
|
-
})
|
|
248
|
-
runset(
|
|
249
|
-
"minor.delprop", mset("delprop"),
|
|
250
|
-
{
|
|
251
|
-
delprop(clone(getprop($0, .string("parent"))), getprop($0, .string("key")))
|
|
252
|
-
})
|
|
253
|
-
runset(
|
|
254
|
-
"minor.setpath", mset("setpath"),
|
|
255
|
-
{
|
|
256
|
-
setpath(
|
|
257
|
-
clone(getprop($0, .string("store"))), getprop($0, .string("path")),
|
|
258
|
-
lookup($0, .string("val")))
|
|
259
|
-
})
|
|
227
|
+
// setprop/delprop/setpath REWRITE the container they are given, and
|
|
228
|
+
// minor.setpath asserts exactly that through `match: {args: ...}`, so
|
|
229
|
+
// the argument crosses by identity - no clone.
|
|
230
|
+
runStruct("minor", "setprop", true) {
|
|
231
|
+
setprop(gp($0, "parent"), gp($0, "key"), lookup($0, .string("val")))
|
|
232
|
+
}
|
|
233
|
+
runStruct("minor", "delprop", true) {
|
|
234
|
+
delprop(gp($0, "parent"), gp($0, "key"))
|
|
235
|
+
}
|
|
236
|
+
runStruct("minor", "setpath", false) {
|
|
237
|
+
setpath(gp($0, "store"), gp($0, "path"), lookup($0, .string("val")))
|
|
238
|
+
}
|
|
260
239
|
}
|
|
261
240
|
|
|
262
|
-
// MARK: -
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
"
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
"
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
.bool(haskey(getprop($0, .string("val")), getprop($0, .string("key"))))
|
|
284
|
-
})
|
|
285
|
-
runset("sentinels.isempty_unify", sset("isempty_unify"), { .bool(isempty($0)) })
|
|
286
|
-
runset("sentinels.isnode_unify", sset("isnode_unify"), { .bool(isnode($0)) })
|
|
287
|
-
runset("sentinels.stringify_null", sset("stringify_null"), { .string(stringify($0)) })
|
|
241
|
+
// MARK: - Null semantics
|
|
242
|
+
//
|
|
243
|
+
// The corpus group is `nullsem` - it was called `sentinels` once, and the
|
|
244
|
+
// retired engine kept driving the old name over zero entries.
|
|
245
|
+
|
|
246
|
+
func testNullsem() {
|
|
247
|
+
runStruct("nullsem", "getprop", false) {
|
|
248
|
+
getprop(gp($0, "val"), gp($0, "key"), self.raw($0, "alt"))
|
|
249
|
+
}
|
|
250
|
+
runStruct("nullsem", "getelem", false) {
|
|
251
|
+
getelem(gp($0, "val"), gp($0, "key"), gp($0, "alt"))
|
|
252
|
+
}
|
|
253
|
+
runStruct("nullsem", "getpath", false) {
|
|
254
|
+
getpath(gp($0, "store"), gp($0, "path"))
|
|
255
|
+
}
|
|
256
|
+
runStruct("nullsem", "haskey", false) {
|
|
257
|
+
.bool(haskey(gp($0, "src"), gp($0, "key")))
|
|
258
|
+
}
|
|
259
|
+
runStruct("nullsem", "keysof", false) {
|
|
260
|
+
.list(keysof($0).map { Value.string($0) })
|
|
261
|
+
}
|
|
288
262
|
}
|
|
289
263
|
|
|
290
264
|
// MARK: - Walk
|
|
291
265
|
|
|
292
266
|
func testWalkBasic() {
|
|
293
|
-
let s = loadStructSpec()
|
|
294
|
-
let walkBasic = getprop(getprop(s, .string("walk")), .string("basic"))
|
|
295
|
-
let set = getprop(walkBasic, .string("set"))
|
|
296
267
|
let walkpath: WalkApply = { _, v, _, path in
|
|
297
268
|
if case .string(let s) = v {
|
|
298
269
|
return .string(s + "~" + path.joined(separator: "."))
|
|
299
270
|
}
|
|
300
271
|
return v
|
|
301
272
|
}
|
|
302
|
-
|
|
273
|
+
runStruct("walk", "basic", true) { walk($0, walkpath) }
|
|
303
274
|
}
|
|
304
275
|
|
|
305
276
|
// MARK: - Getpath
|
|
306
277
|
|
|
307
278
|
func testGetpathBasic() {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
"getpath.basic", set,
|
|
312
|
-
{
|
|
313
|
-
getpath(getprop($0, .string("store")), getprop($0, .string("path")))
|
|
314
|
-
})
|
|
279
|
+
runStruct("getpath", "basic", true) {
|
|
280
|
+
getpath(gp($0, "store"), gp($0, "path"))
|
|
281
|
+
}
|
|
315
282
|
}
|
|
316
283
|
|
|
317
284
|
// MARK: - Merge
|
|
318
285
|
|
|
319
|
-
func
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
// depth set has shape {val: [...], depth: N}
|
|
328
|
-
runset(
|
|
329
|
-
"merge.\(name)", set,
|
|
330
|
-
{
|
|
331
|
-
let val = getprop($0, .string("val"))
|
|
332
|
-
let depth = getprop($0, .string("depth")).asInt.map(Int.init) ?? MAXDEPTH
|
|
333
|
-
return merge(clone(val), depth)
|
|
334
|
-
})
|
|
335
|
-
} else {
|
|
336
|
-
runset("merge.\(name)", set, { merge(clone($0)) })
|
|
337
|
-
}
|
|
338
|
-
}
|
|
286
|
+
func testMerge() {
|
|
287
|
+
// merge.integrity asserts through `match: {args: ...}` that merge does
|
|
288
|
+
// NOT rewrite the list it was handed, so nothing is cloned here.
|
|
289
|
+
runStruct("merge", "cases", true) { merge($0) }
|
|
290
|
+
runStruct("merge", "array", true) { merge($0) }
|
|
291
|
+
runStruct("merge", "integrity", true) { merge($0) }
|
|
292
|
+
runStruct("merge", "depth", true) {
|
|
293
|
+
merge(gp($0, "val"), self.intArg(gp($0, "depth")) ?? MAXDEPTH)
|
|
339
294
|
}
|
|
340
295
|
}
|
|
341
296
|
|
|
342
297
|
// MARK: - Inject
|
|
343
298
|
|
|
344
299
|
func testInject() {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
if let basic = im.entries["basic"], case .map(let bm) = basic, let inv = bm.entries["in"] {
|
|
350
|
-
let got = inject(
|
|
351
|
-
clone(getprop(inv, .string("val"))),
|
|
352
|
-
getprop(inv, .string("store")))
|
|
353
|
-
let exp = bm.entries["out"] ?? .noval
|
|
354
|
-
XCTAssertEqual(canon(got), canon(exp), "inject.basic")
|
|
300
|
+
runStruct("inject", "string", true) {
|
|
301
|
+
let inj = Injection(val: .noval, parent: .noval)
|
|
302
|
+
inj.modify = OmniResolver.nullModifier
|
|
303
|
+
return inject(gp($0, "val"), gp($0, "store"), inj)
|
|
355
304
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
let set = sm.entries["set"], case .list(let sl) = set
|
|
359
|
-
{
|
|
360
|
-
var pass = 0
|
|
361
|
-
var fail = 0
|
|
362
|
-
for (i, entry) in sl.items.enumerated() {
|
|
363
|
-
guard case .map(let em) = entry else { continue }
|
|
364
|
-
if em.entries["err"] != nil { continue }
|
|
365
|
-
let inVal = em.entries["in"] ?? .noval
|
|
366
|
-
let v = fixNull(clone(getprop(inVal, .string("val"))))
|
|
367
|
-
let st = fixNull(clone(getprop(inVal, .string("store"))))
|
|
368
|
-
let runInj = Injection(val: .noval, parent: .noval)
|
|
369
|
-
runInj.modify = nullModifier
|
|
370
|
-
let got = inject(v, st, runInj)
|
|
371
|
-
let exp = em.entries["out"] ?? .noval
|
|
372
|
-
if canon(got) == canon(exp) {
|
|
373
|
-
pass += 1
|
|
374
|
-
} else {
|
|
375
|
-
fail += 1
|
|
376
|
-
if fail <= 5 { print("[inject.string#\(i)] exp=\(canon(exp)) got=\(canon(got))") }
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
if fail > 0 {
|
|
380
|
-
XCTFail("inject.string: \(pass)/\(pass + fail)")
|
|
381
|
-
} else {
|
|
382
|
-
print("ok inject.string: \(pass)/\(pass)")
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
if let deepSet = im.entries["deep"], case .map(let dm) = deepSet,
|
|
386
|
-
let set = dm.entries["set"]
|
|
387
|
-
{
|
|
388
|
-
runset(
|
|
389
|
-
"inject.deep", set,
|
|
390
|
-
{
|
|
391
|
-
inject(
|
|
392
|
-
clone(getprop($0, .string("val"))),
|
|
393
|
-
getprop($0, .string("store")))
|
|
394
|
-
})
|
|
305
|
+
runStruct("inject", "deep", true) {
|
|
306
|
+
inject(gp($0, "val"), gp($0, "store"))
|
|
395
307
|
}
|
|
396
308
|
}
|
|
397
309
|
|
|
398
310
|
// MARK: - Transform
|
|
399
311
|
|
|
400
312
|
func testTransform() {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
clone(getprop(inv, .string("spec"))))
|
|
408
|
-
let exp = bm.entries["out"] ?? .noval
|
|
409
|
-
XCTAssertEqual(canon(got), canon(exp), "transform.basic")
|
|
410
|
-
}
|
|
411
|
-
for name in ["paths", "cmds", "each", "pack", "ref", "apply", "format"] {
|
|
412
|
-
if let sub = tm.entries[name], case .map(let sm) = sub,
|
|
413
|
-
let set = sm.entries["set"]
|
|
414
|
-
{
|
|
415
|
-
runset(
|
|
416
|
-
"transform.\(name)", set,
|
|
417
|
-
{
|
|
418
|
-
transform(
|
|
419
|
-
clone(getprop($0, .string("data"))),
|
|
420
|
-
clone(getprop($0, .string("spec"))))
|
|
421
|
-
})
|
|
313
|
+
for name in ["paths", "cmds", "each", "pack", "ref"] {
|
|
314
|
+
runStruct("transform", name, true) {
|
|
315
|
+
let (inj, errs) = self.errCollector()
|
|
316
|
+
let out = transform(gp($0, "data"), gp($0, "spec"), inj)
|
|
317
|
+
try self.raiseErrs(errs)
|
|
318
|
+
return out
|
|
422
319
|
}
|
|
423
320
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
let
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}
|
|
321
|
+
runStruct("transform", "format", false) {
|
|
322
|
+
let (inj, errs) = self.errCollector()
|
|
323
|
+
let out = transform(gp($0, "data"), gp($0, "spec"), inj)
|
|
324
|
+
try self.raiseErrs(errs)
|
|
325
|
+
return out
|
|
326
|
+
}
|
|
327
|
+
runStruct("transform", "apply", true) {
|
|
328
|
+
let (inj, errs) = self.errCollector()
|
|
329
|
+
let out = transform(gp($0, "data"), gp($0, "spec"), inj)
|
|
330
|
+
try self.raiseErrs(errs)
|
|
331
|
+
return out
|
|
332
|
+
}
|
|
333
|
+
runStruct("transform", "modify", true) {
|
|
334
|
+
let inj = Injection(val: .noval, parent: .noval)
|
|
335
|
+
inj.modify = { val, key, parent, _, _ in
|
|
336
|
+
if case .string(let s) = val, !s.isEmpty {
|
|
337
|
+
setprop(parent, key, .string("@" + s))
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return transform(gp($0, "data"), gp($0, "spec"), inj)
|
|
442
341
|
}
|
|
443
342
|
}
|
|
444
343
|
|
|
445
344
|
// MARK: - Validate
|
|
446
345
|
|
|
447
346
|
func testValidate() {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
let
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
let i = Injection(val: .noval, parent: .noval)
|
|
461
|
-
i.meta = im
|
|
462
|
-
runInj = i
|
|
463
|
-
} else if let ij = (entry.asMap?.entries["inj"]), case .map(let im) = ij {
|
|
464
|
-
let i = Injection(val: .noval, parent: .noval)
|
|
465
|
-
i.meta = im
|
|
466
|
-
runInj = i
|
|
467
|
-
} else {
|
|
468
|
-
runInj = nil
|
|
469
|
-
}
|
|
470
|
-
return validate(
|
|
471
|
-
clone(getprop(entry, .string("data"))),
|
|
472
|
-
clone(getprop(entry, .string("spec"))),
|
|
473
|
-
runInj)
|
|
474
|
-
})
|
|
347
|
+
for (name, nullFlag) in [
|
|
348
|
+
("basic", false), ("child", true), ("one", true),
|
|
349
|
+
("exact", true), ("invalid", false), ("special", true),
|
|
350
|
+
] {
|
|
351
|
+
runStruct("validate", name, nullFlag) {
|
|
352
|
+
let (inj, errs) = self.errCollector()
|
|
353
|
+
if case .map(let im) = gp($0, "inj"), let meta = im.entries["meta"]?.asMap {
|
|
354
|
+
inj.meta = meta
|
|
355
|
+
}
|
|
356
|
+
let out = validate(self.raw($0, "data"), self.raw($0, "spec"), inj)
|
|
357
|
+
try self.raiseErrs(errs)
|
|
358
|
+
return out
|
|
475
359
|
}
|
|
476
360
|
}
|
|
477
361
|
}
|
|
@@ -479,45 +363,10 @@ final class StructUtilityTest: XCTestCase {
|
|
|
479
363
|
// MARK: - Select
|
|
480
364
|
|
|
481
365
|
func testSelect() {
|
|
482
|
-
let s = loadStructSpec()
|
|
483
|
-
let sSpec = getprop(s, .string("select"))
|
|
484
|
-
guard case .map(let sm) = sSpec else { return }
|
|
485
366
|
for name in ["basic", "operators", "edge", "alts"] {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
{
|
|
489
|
-
var pass = 0
|
|
490
|
-
var fail = 0
|
|
491
|
-
for (i, entry) in sl.items.enumerated() {
|
|
492
|
-
guard case .map(let em) = entry else { continue }
|
|
493
|
-
if em.entries["err"] != nil { continue }
|
|
494
|
-
let inVal = em.entries["in"] ?? .noval
|
|
495
|
-
let obj = fixNull(clone(getprop(inVal, .string("obj"))))
|
|
496
|
-
let q = fixNull(clone(getprop(inVal, .string("query"))))
|
|
497
|
-
let got = select(obj, q)
|
|
498
|
-
let exp = fixNull(clone(em.entries["out"] ?? .noval))
|
|
499
|
-
if canon(got) == canon(exp) {
|
|
500
|
-
pass += 1
|
|
501
|
-
} else {
|
|
502
|
-
fail += 1
|
|
503
|
-
if fail <= 5 {
|
|
504
|
-
print("[select.\(name)#\(i)] exp=\(canon(exp)) got=\(canon(got))")
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
if fail > 0 {
|
|
509
|
-
XCTFail("select.\(name): \(pass)/\(pass + fail)")
|
|
510
|
-
} else {
|
|
511
|
-
print("ok select.\(name): \(pass)/\(pass)")
|
|
512
|
-
}
|
|
367
|
+
runStruct("select", name, true) {
|
|
368
|
+
select(gp($0, "obj"), gp($0, "query"))
|
|
513
369
|
}
|
|
514
370
|
}
|
|
515
371
|
}
|
|
516
372
|
}
|
|
517
|
-
|
|
518
|
-
// Convenience: "x |> setProp(y)" sugar to chain a getprop access.
|
|
519
|
-
infix operator |> : MultiplicationPrecedence
|
|
520
|
-
private func |> (lhs: Value, rhs: (Value) -> Value) -> Value { rhs(lhs) }
|
|
521
|
-
private func setProp(_ key: String) -> (Value) -> Value {
|
|
522
|
-
{ v in getprop(v, .string(key)) }
|
|
523
|
-
}
|