@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,314 +0,0 @@
|
|
|
1
|
-
// Voxgig Struct corpus runner — C++ port.
|
|
2
|
-
// Mirrors java/src/test/Runner.java.
|
|
3
|
-
|
|
4
|
-
#ifndef VOXGIG_STRUCT_RUNNER_HPP
|
|
5
|
-
#define VOXGIG_STRUCT_RUNNER_HPP
|
|
6
|
-
|
|
7
|
-
#include <functional>
|
|
8
|
-
#include <iostream>
|
|
9
|
-
#include <map>
|
|
10
|
-
#include <sstream>
|
|
11
|
-
#include <stdexcept>
|
|
12
|
-
#include <string>
|
|
13
|
-
#include <vector>
|
|
14
|
-
|
|
15
|
-
#include "../utility/voxgigstruct/value.hpp"
|
|
16
|
-
#include "../utility/voxgigstruct/value_io.hpp"
|
|
17
|
-
#include "../utility/voxgigstruct/voxgig_struct.hpp"
|
|
18
|
-
|
|
19
|
-
namespace voxgig {
|
|
20
|
-
namespace structlib {
|
|
21
|
-
namespace runner {
|
|
22
|
-
|
|
23
|
-
inline const std::string& NULLMARK() {
|
|
24
|
-
static const std::string s = "__NULL__";
|
|
25
|
-
return s;
|
|
26
|
-
}
|
|
27
|
-
inline const std::string& UNDEFMARK() {
|
|
28
|
-
static const std::string s = "__UNDEF__";
|
|
29
|
-
return s;
|
|
30
|
-
}
|
|
31
|
-
inline const std::string& EXISTSMARK() {
|
|
32
|
-
static const std::string s = "__EXISTS__";
|
|
33
|
-
return s;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
using Subject = std::function<Value(const Value&)>;
|
|
37
|
-
|
|
38
|
-
struct Result {
|
|
39
|
-
std::string name;
|
|
40
|
-
int passed = 0;
|
|
41
|
-
int total = 0;
|
|
42
|
-
std::vector<std::string> failures;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
inline Value& corpus() {
|
|
46
|
-
static Value c = Value::undef();
|
|
47
|
-
return c;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
inline Value get_spec(const std::string& category, const std::string& name) {
|
|
51
|
-
if (corpus().is_undef()) {
|
|
52
|
-
corpus() = parse_json_file("../.sdk/test/test.json");
|
|
53
|
-
}
|
|
54
|
-
Value struct_v = getprop(corpus(), Value("struct"));
|
|
55
|
-
Value cat = getprop(struct_v, Value(category));
|
|
56
|
-
return getprop(cat, Value(name));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// fix_json: bridge JSON null to the cross-port "__NULL__" string marker, the
|
|
60
|
-
// same transform the canonical runner (typescript/test/runner.ts:fixJSON)
|
|
61
|
-
// applies to every test input, every result, and every expected `out` when the
|
|
62
|
-
// null flag is set. This is what lets the corpus encode "value is JSON null"
|
|
63
|
-
// (distinct from "value is absent") without the test harness having to special
|
|
64
|
-
// case it: every observed null becomes the literal string "__NULL__", and the
|
|
65
|
-
// subjects that care (inject.string) swap it back via null_modifier(). A node's
|
|
66
|
-
// own identity is preserved; only null *values* are rewritten.
|
|
67
|
-
inline Value fix_json(const Value& v, bool null_flag) {
|
|
68
|
-
if (v.is_undef())
|
|
69
|
-
return v;
|
|
70
|
-
if (v.is_null())
|
|
71
|
-
return null_flag ? Value(NULLMARK()) : v;
|
|
72
|
-
if (v.is_list()) {
|
|
73
|
-
auto out = std::make_shared<List>();
|
|
74
|
-
for (const auto& e : *v.as_list())
|
|
75
|
-
out->push_back(fix_json(e, null_flag));
|
|
76
|
-
return Value(out);
|
|
77
|
-
}
|
|
78
|
-
if (v.is_map()) {
|
|
79
|
-
auto out = std::shared_ptr<Map>(new Map());
|
|
80
|
-
for (const auto& [k, e] : *v.as_map())
|
|
81
|
-
out->set(k, fix_json(e, null_flag));
|
|
82
|
-
return Value(out);
|
|
83
|
-
}
|
|
84
|
-
return v;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// collapse_absent: treat NOVAL (absent) as JSON null for comparison. The
|
|
88
|
-
// canonical TS runner roundtrips both the result and the expected `out` through
|
|
89
|
-
// JSON.stringify, which erases the null/undef distinction at the value level
|
|
90
|
-
// (swift CorpusTests.canon does the same via normaliseAbsent). Applying this to
|
|
91
|
-
// BOTH sides — together with fix_json — lets a port that correctly returns
|
|
92
|
-
// "absent" for a missing getprop/getelem/getpath match a corpus entry that
|
|
93
|
-
// records the result as null. The stored-null vs absent distinction that the
|
|
94
|
-
// sentinels groups exercise is preserved earlier, on the *input*, via fix_json.
|
|
95
|
-
inline Value collapse_absent(const Value& v) {
|
|
96
|
-
if (v.is_undef())
|
|
97
|
-
return Value(nullptr);
|
|
98
|
-
if (v.is_list()) {
|
|
99
|
-
auto out = std::make_shared<List>();
|
|
100
|
-
for (const auto& e : *v.as_list())
|
|
101
|
-
out->push_back(collapse_absent(e));
|
|
102
|
-
return Value(out);
|
|
103
|
-
}
|
|
104
|
-
if (v.is_map()) {
|
|
105
|
-
auto out = std::shared_ptr<Map>(new Map());
|
|
106
|
-
for (const auto& [k, e] : *v.as_map())
|
|
107
|
-
out->set(k, collapse_absent(e));
|
|
108
|
-
return Value(out);
|
|
109
|
-
}
|
|
110
|
-
return v;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// null_modifier: the inject `modify` callback used by the inject.string subject.
|
|
114
|
-
// Mirrors typescript/test/runner.ts:nullModifier — a slot whose injected value
|
|
115
|
-
// is exactly "__NULL__" becomes JSON null; a string that merely *contains*
|
|
116
|
-
// "__NULL__" has the marker rewritten to the literal text "null".
|
|
117
|
-
inline void null_modifier(const Value& val, const Value& key, const Value& parent, Injection&,
|
|
118
|
-
const Value&) {
|
|
119
|
-
if (!val.is_string())
|
|
120
|
-
return;
|
|
121
|
-
const std::string& s = val.as_string();
|
|
122
|
-
if (s == NULLMARK()) {
|
|
123
|
-
setprop(parent, key, Value(nullptr));
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (s.find(NULLMARK()) != std::string::npos) {
|
|
127
|
-
std::string out = s;
|
|
128
|
-
std::string::size_type pos = 0;
|
|
129
|
-
while ((pos = out.find(NULLMARK(), pos)) != std::string::npos) {
|
|
130
|
-
out.replace(pos, NULLMARK().size(), "null");
|
|
131
|
-
pos += 4;
|
|
132
|
-
}
|
|
133
|
-
setprop(parent, key, Value(out));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Normalise for comparison: integer-valued doubles -> int64. Map key order and
|
|
138
|
-
// null/undef are NOT collapsed here — null is carried as the "__NULL__" marker
|
|
139
|
-
// (see fix_json) and key order must match canonical insertion order, so the
|
|
140
|
-
// comparison stays faithful instead of masking those distinctions.
|
|
141
|
-
inline Value normalize(const Value& v) {
|
|
142
|
-
if (v.is_double()) {
|
|
143
|
-
double d = v.as_double();
|
|
144
|
-
if (std::isfinite(d) && std::floor(d) == d)
|
|
145
|
-
return Value(static_cast<int64_t>(d));
|
|
146
|
-
return v;
|
|
147
|
-
}
|
|
148
|
-
if (v.is_list()) {
|
|
149
|
-
auto out = std::make_shared<List>();
|
|
150
|
-
for (const auto& e : *v.as_list())
|
|
151
|
-
out->push_back(normalize(e));
|
|
152
|
-
return Value(out);
|
|
153
|
-
}
|
|
154
|
-
if (v.is_map()) {
|
|
155
|
-
auto out = std::shared_ptr<Map>(new Map());
|
|
156
|
-
for (const auto& [k, e] : *v.as_map())
|
|
157
|
-
out->set(k, normalize(e));
|
|
158
|
-
return Value(out);
|
|
159
|
-
}
|
|
160
|
-
return v;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Order-insensitive deep equality. JSON objects are unordered, so two maps with
|
|
164
|
-
// the same entries in a different key order are equal (swift CorpusTests.canon
|
|
165
|
-
// compares via stringify with sorted keys for the same reason). Lists stay
|
|
166
|
-
// order-sensitive. Scalars fall back to Value::operator== after normalize().
|
|
167
|
-
inline bool deep_equal(const Value& a0, const Value& b0) {
|
|
168
|
-
Value a = normalize(a0);
|
|
169
|
-
Value b = normalize(b0);
|
|
170
|
-
if (a.is_map() && b.is_map()) {
|
|
171
|
-
auto am = a.as_map();
|
|
172
|
-
auto bm = b.as_map();
|
|
173
|
-
if (am->size() != bm->size())
|
|
174
|
-
return false;
|
|
175
|
-
for (const auto& [k, av] : *am) {
|
|
176
|
-
const Value* bv = bm->find(k);
|
|
177
|
-
if (bv == nullptr || !deep_equal(av, *bv))
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
return true;
|
|
181
|
-
}
|
|
182
|
-
if (a.is_list() && b.is_list()) {
|
|
183
|
-
auto al = a.as_list();
|
|
184
|
-
auto bl = b.as_list();
|
|
185
|
-
if (al->size() != bl->size())
|
|
186
|
-
return false;
|
|
187
|
-
for (size_t i = 0; i < al->size(); i++)
|
|
188
|
-
if (!deep_equal((*al)[i], (*bl)[i]))
|
|
189
|
-
return false;
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
return a == b;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
inline std::string brief(const Value& v) {
|
|
196
|
-
std::string s;
|
|
197
|
-
if (v.is_undef())
|
|
198
|
-
return UNDEFMARK();
|
|
199
|
-
// Use the library's in-tree jsonify (compact form, no third-party dep).
|
|
200
|
-
s = jsonify(v, 0);
|
|
201
|
-
if (s.size() > 200)
|
|
202
|
-
s = s.substr(0, 197) + "...";
|
|
203
|
-
return s;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
inline Result runsetflags(const std::string& full_name, const Value& testspec, bool null_flag,
|
|
207
|
-
const Subject& subject) {
|
|
208
|
-
Result res;
|
|
209
|
-
res.name = full_name;
|
|
210
|
-
Value set_v = getprop(testspec, Value("set"));
|
|
211
|
-
if (!set_v.is_list())
|
|
212
|
-
return res;
|
|
213
|
-
auto set = set_v.as_list();
|
|
214
|
-
for (size_t i = 0; i < set->size(); i++) {
|
|
215
|
-
const Value& eo = (*set)[i];
|
|
216
|
-
if (!eo.is_map())
|
|
217
|
-
continue;
|
|
218
|
-
// Extract in/out/err with the null-preserving lookup_v rather than Group A
|
|
219
|
-
// getprop/haskey: a test entry whose `in` (or `out`) is literally JSON null
|
|
220
|
-
// (e.g. the sentinels groups) must keep that null, not be read as absent.
|
|
221
|
-
Value in_raw = lookup_v(eo, Value("in"));
|
|
222
|
-
bool has_in = !in_raw.is_undef();
|
|
223
|
-
// Bridge JSON null -> "__NULL__" on the input the same way the canonical
|
|
224
|
-
// runner does, so subjects observe the marker (and inject.string can swap
|
|
225
|
-
// it back through null_modifier).
|
|
226
|
-
Value in = has_in ? fix_json(clone(in_raw), null_flag) : Value::undef();
|
|
227
|
-
Value out_raw = lookup_v(eo, Value("out"));
|
|
228
|
-
bool has_out = !out_raw.is_undef();
|
|
229
|
-
// resolveEntry: an absent expected `out` collapses to null, then both sides
|
|
230
|
-
// run through collapse_absent + fix_json so an absent result matches it.
|
|
231
|
-
Value expected = fix_json(collapse_absent(has_out ? out_raw : Value::undef()), null_flag);
|
|
232
|
-
Value err_raw = lookup_v(eo, Value("err"));
|
|
233
|
-
Value err_v = err_raw.is_undef() ? Value::undef() : err_raw;
|
|
234
|
-
|
|
235
|
-
res.total++;
|
|
236
|
-
Value got;
|
|
237
|
-
bool threw = false;
|
|
238
|
-
std::string thrown_msg;
|
|
239
|
-
try {
|
|
240
|
-
got = subject(in);
|
|
241
|
-
} catch (const std::exception& e) {
|
|
242
|
-
threw = true;
|
|
243
|
-
thrown_msg = e.what();
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (!err_v.is_undef()) {
|
|
247
|
-
// err entry: either accept any thrown error, or substring match.
|
|
248
|
-
if (threw) {
|
|
249
|
-
bool match = false;
|
|
250
|
-
if (err_v.is_bool() && err_v.as_bool())
|
|
251
|
-
match = true;
|
|
252
|
-
else if (err_v.is_string()) {
|
|
253
|
-
std::string es = err_v.as_string();
|
|
254
|
-
if (es.empty())
|
|
255
|
-
match = true;
|
|
256
|
-
else if (thrown_msg.find(es) != std::string::npos)
|
|
257
|
-
match = true;
|
|
258
|
-
else {
|
|
259
|
-
std::string lo_msg = thrown_msg;
|
|
260
|
-
std::string lo_es = es;
|
|
261
|
-
for (auto& c : lo_msg)
|
|
262
|
-
c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
|
|
263
|
-
for (auto& c : lo_es)
|
|
264
|
-
c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
|
|
265
|
-
if (lo_msg.find(lo_es) != std::string::npos)
|
|
266
|
-
match = true;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
if (match)
|
|
270
|
-
res.passed++;
|
|
271
|
-
else {
|
|
272
|
-
std::ostringstream oss;
|
|
273
|
-
oss << "[" << i << "] err mismatch: expected '" << brief(err_v) << "' got '" << thrown_msg
|
|
274
|
-
<< "'";
|
|
275
|
-
res.failures.push_back(oss.str());
|
|
276
|
-
}
|
|
277
|
-
} else {
|
|
278
|
-
std::ostringstream oss;
|
|
279
|
-
oss << "[" << i << "] expected err='" << brief(err_v) << "' but call returned "
|
|
280
|
-
<< brief(got);
|
|
281
|
-
res.failures.push_back(oss.str());
|
|
282
|
-
}
|
|
283
|
-
continue;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (threw) {
|
|
287
|
-
std::ostringstream oss;
|
|
288
|
-
oss << "[" << i << "] in=" << brief(in_raw) << " threw=" << thrown_msg;
|
|
289
|
-
res.failures.push_back(oss.str());
|
|
290
|
-
continue;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
Value got_c = fix_json(collapse_absent(got), null_flag);
|
|
294
|
-
if (deep_equal(got_c, expected)) {
|
|
295
|
-
res.passed++;
|
|
296
|
-
} else {
|
|
297
|
-
std::ostringstream oss;
|
|
298
|
-
oss << "[" << i << "] in=" << brief(in_raw) << " expected=" << brief(expected)
|
|
299
|
-
<< " got=" << brief(got_c);
|
|
300
|
-
res.failures.push_back(oss.str());
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return res;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
inline Result runset(const std::string& full_name, const Value& testspec, const Subject& subject) {
|
|
307
|
-
return runsetflags(full_name, testspec, true, subject);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
} // namespace runner
|
|
311
|
-
} // namespace structlib
|
|
312
|
-
} // namespace voxgig
|
|
313
|
-
|
|
314
|
-
#endif // VOXGIG_STRUCT_RUNNER_HPP
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
/* Corpus test runner: reads the shared spec from ../../.sdk/test/test.json
|
|
2
|
-
* and drives xUnit tests. Vendored from github.com/voxgig/struct
|
|
3
|
-
* csharp/tests/Runner.cs (the C# twin of tm/go/test/struct_runner_test.go's
|
|
4
|
-
* vendored go testutil). */
|
|
5
|
-
|
|
6
|
-
using System.Runtime.CompilerServices;
|
|
7
|
-
using System.Text.Json;
|
|
8
|
-
using Voxgig.Struct;
|
|
9
|
-
using Xunit;
|
|
10
|
-
|
|
11
|
-
namespace ProjectNameSdk.Test;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
public static class StructRunner
|
|
15
|
-
{
|
|
16
|
-
public const string NULLMARK = "__NULL__";
|
|
17
|
-
public const string UNDEFMARK = "__UNDEF__";
|
|
18
|
-
public const string EXISTSMARK = "__EXISTS__";
|
|
19
|
-
|
|
20
|
-
private static string SourceDir([CallerFilePath] string path = "")
|
|
21
|
-
=> Path.GetDirectoryName(path)!;
|
|
22
|
-
|
|
23
|
-
// The shared SDK test spec lives at <sdk-project>/.sdk/test/test.json,
|
|
24
|
-
// i.e. ../../.sdk/test/test.json relative to this test folder.
|
|
25
|
-
public static string TestJsonPath()
|
|
26
|
-
{
|
|
27
|
-
return Path.GetFullPath(
|
|
28
|
-
Path.Combine(SourceDir(), "..", "..", ".sdk", "test", "test.json"));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Load the shared test JSON and extract a top-level sub-spec.
|
|
32
|
-
public static Dictionary<string, object?> LoadSpecSection(string name)
|
|
33
|
-
{
|
|
34
|
-
string testFile = TestJsonPath();
|
|
35
|
-
if (!File.Exists(testFile))
|
|
36
|
-
throw new FileNotFoundException("Could not find " + testFile);
|
|
37
|
-
|
|
38
|
-
string json = File.ReadAllText(testFile);
|
|
39
|
-
var all = JsonSerializer.Deserialize<JsonElement>(json);
|
|
40
|
-
return ConvertElement(all.GetProperty(name)) as Dictionary<string, object?> ?? [];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Load the shared test JSON and extract the "struct" sub-spec.
|
|
44
|
-
public static Dictionary<string, object?> LoadSpec()
|
|
45
|
-
{
|
|
46
|
-
return LoadSpecSection("struct");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Convert a JsonElement tree into native C# types.
|
|
50
|
-
public static object? ConvertElement(JsonElement el)
|
|
51
|
-
{
|
|
52
|
-
return el.ValueKind switch
|
|
53
|
-
{
|
|
54
|
-
JsonValueKind.Object => el.EnumerateObject()
|
|
55
|
-
.ToDictionary(p => p.Name, p => ConvertElement(p.Value)),
|
|
56
|
-
JsonValueKind.Array => el.EnumerateArray()
|
|
57
|
-
.Select(ConvertElement)
|
|
58
|
-
.ToList<object?>(),
|
|
59
|
-
JsonValueKind.String => el.GetString(),
|
|
60
|
-
JsonValueKind.Number => el.TryGetInt64(out long l) ? (object?)l : el.GetDouble(),
|
|
61
|
-
JsonValueKind.True => (object?)true,
|
|
62
|
-
JsonValueKind.False => (object?)false,
|
|
63
|
-
JsonValueKind.Null => null,
|
|
64
|
-
_ => null,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Run a test-set spec through a subject function; fail on mismatch.
|
|
69
|
-
public static void RunSet(
|
|
70
|
-
object? testSpec,
|
|
71
|
-
Func<object?, object?> subject,
|
|
72
|
-
Dictionary<string, bool>? flags = null)
|
|
73
|
-
{
|
|
74
|
-
flags ??= [];
|
|
75
|
-
bool allowNull = flags.TryGetValue("null", out bool n) && n;
|
|
76
|
-
|
|
77
|
-
var spec = testSpec as Dictionary<string, object?>;
|
|
78
|
-
if (spec == null) return;
|
|
79
|
-
|
|
80
|
-
var set = spec.TryGetValue("set", out object? sv) ? sv as List<object?> : null;
|
|
81
|
-
if (set == null) return;
|
|
82
|
-
|
|
83
|
-
for (int i = 0; i < set.Count; i++)
|
|
84
|
-
{
|
|
85
|
-
var entry = set[i] as Dictionary<string, object?>;
|
|
86
|
-
if (entry == null) continue;
|
|
87
|
-
|
|
88
|
-
// Skip entries that have no "out".
|
|
89
|
-
if (!entry.ContainsKey("out")) continue;
|
|
90
|
-
|
|
91
|
-
object? input = entry.TryGetValue("in", out object? inv) ? inv : null;
|
|
92
|
-
object? expected = entry["out"];
|
|
93
|
-
|
|
94
|
-
// Skip null-valued inputs when null flag is false.
|
|
95
|
-
if (!allowNull)
|
|
96
|
-
{
|
|
97
|
-
if (input == null) continue;
|
|
98
|
-
if (expected == null) continue;
|
|
99
|
-
if (input is Dictionary<string, object?> inMap &&
|
|
100
|
-
inMap.Values.Any(v => v == null)) continue;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Apply NULLMARK substitutions.
|
|
104
|
-
input = FixJson(input, allowNull);
|
|
105
|
-
expected = FixJson(expected, allowNull);
|
|
106
|
-
|
|
107
|
-
object? result;
|
|
108
|
-
try { result = subject(input); }
|
|
109
|
-
catch (Exception ex)
|
|
110
|
-
{
|
|
111
|
-
Assert.Fail($"Entry #{i}: threw exception: {ex.Message}\n input={StructUtils.Stringify(input)}");
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
result = FixJson(result, allowNull);
|
|
116
|
-
|
|
117
|
-
bool ok = DeepEqual(expected, result);
|
|
118
|
-
if (!ok)
|
|
119
|
-
{
|
|
120
|
-
Assert.Fail(
|
|
121
|
-
$"Entry #{i}: expected {StructUtils.Stringify(expected)} " +
|
|
122
|
-
$"but got {StructUtils.Stringify(result)}\n" +
|
|
123
|
-
$" input={StructUtils.Stringify(input)}");
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Apply NULLMARK / UNDEFMARK substitutions.
|
|
129
|
-
public static object? FixJson(object? val, bool allowNull)
|
|
130
|
-
{
|
|
131
|
-
if (val is string s)
|
|
132
|
-
{
|
|
133
|
-
if (s == NULLMARK) return allowNull ? null : null;
|
|
134
|
-
if (s == UNDEFMARK) return null;
|
|
135
|
-
return val;
|
|
136
|
-
}
|
|
137
|
-
if (val is Dictionary<string, object?> map)
|
|
138
|
-
{
|
|
139
|
-
var result = new Dictionary<string, object?>();
|
|
140
|
-
foreach (var kv in map)
|
|
141
|
-
result[kv.Key] = FixJson(kv.Value, allowNull);
|
|
142
|
-
return result;
|
|
143
|
-
}
|
|
144
|
-
if (val is List<object?> list)
|
|
145
|
-
return list.Select(v => FixJson(v, allowNull)).ToList<object?>();
|
|
146
|
-
return val;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// Deep structural equality (numbers are compared by value, ignoring int/long/double).
|
|
150
|
-
public static bool DeepEqual(object? a, object? b)
|
|
151
|
-
{
|
|
152
|
-
// NONE (TS undefined) compares equal to null for corpus comparison.
|
|
153
|
-
bool aNone = ReferenceEquals(a, StructUtils.NONE);
|
|
154
|
-
bool bNone = ReferenceEquals(b, StructUtils.NONE);
|
|
155
|
-
if (aNone) a = null;
|
|
156
|
-
if (bNone) b = null;
|
|
157
|
-
if (a == null && b == null) return true;
|
|
158
|
-
if (a == null || b == null) return false;
|
|
159
|
-
|
|
160
|
-
// Numeric equivalence across int/long/double.
|
|
161
|
-
if (IsNumeric(a) && IsNumeric(b))
|
|
162
|
-
return ToDouble(a) == ToDouble(b);
|
|
163
|
-
|
|
164
|
-
if (a is bool ab && b is bool bb) return ab == bb;
|
|
165
|
-
if (a is string sa && b is string sb) return sa == sb;
|
|
166
|
-
|
|
167
|
-
if (a is Dictionary<string, object?> am && b is Dictionary<string, object?> bm)
|
|
168
|
-
{
|
|
169
|
-
if (am.Count != bm.Count) return false;
|
|
170
|
-
foreach (var kv in am)
|
|
171
|
-
{
|
|
172
|
-
if (!bm.TryGetValue(kv.Key, out object? bv)) return false;
|
|
173
|
-
if (!DeepEqual(kv.Value, bv)) return false;
|
|
174
|
-
}
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// Handle any IList (List<object?>, List<string>, List<List<object?>>, etc.)
|
|
179
|
-
if (a is System.Collections.IList al && b is System.Collections.IList bl)
|
|
180
|
-
{
|
|
181
|
-
if (al.Count != bl.Count) return false;
|
|
182
|
-
for (int i = 0; i < al.Count; i++)
|
|
183
|
-
if (!DeepEqual(al[i], bl[i])) return false;
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return a.Equals(b);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
private static bool IsNumeric(object? v) =>
|
|
191
|
-
v is int or long or double or float or short or byte;
|
|
192
|
-
|
|
193
|
-
public static bool IsNumericValue(object? v) => IsNumeric(v);
|
|
194
|
-
|
|
195
|
-
private static double ToDouble(object? v) => v switch
|
|
196
|
-
{
|
|
197
|
-
int i => i,
|
|
198
|
-
long l => l,
|
|
199
|
-
double d => d,
|
|
200
|
-
float f => f,
|
|
201
|
-
_ => 0,
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
public static double ToDoubleVal(object? v) => ToDouble(v);
|
|
205
|
-
|
|
206
|
-
// Run a test-set where entries may have an "err" field (expected exception message)
|
|
207
|
-
// instead of (or in addition to) an "out" field.
|
|
208
|
-
// - Entries with "err": subject is called without errs; expects InvalidOperationException.
|
|
209
|
-
// - Entries with only "out": subject is called; result is compared to "out".
|
|
210
|
-
public static void RunSetFull(
|
|
211
|
-
object? testSpec,
|
|
212
|
-
Func<Dictionary<string, object?>?, object?> subject,
|
|
213
|
-
Dictionary<string, bool>? flags = null)
|
|
214
|
-
{
|
|
215
|
-
flags ??= [];
|
|
216
|
-
bool allowNull = flags.TryGetValue("null", out bool n) && n;
|
|
217
|
-
|
|
218
|
-
var spec = testSpec as Dictionary<string, object?>;
|
|
219
|
-
if (spec == null) return;
|
|
220
|
-
|
|
221
|
-
var set = spec.TryGetValue("set", out object? sv) ? sv as List<object?> : null;
|
|
222
|
-
if (set == null) return;
|
|
223
|
-
|
|
224
|
-
for (int i = 0; i < set.Count; i++)
|
|
225
|
-
{
|
|
226
|
-
var entry = set[i] as Dictionary<string, object?>;
|
|
227
|
-
if (entry == null) continue;
|
|
228
|
-
|
|
229
|
-
bool hasOut = entry.ContainsKey("out");
|
|
230
|
-
bool hasErr = entry.ContainsKey("err");
|
|
231
|
-
if (!hasOut && !hasErr) continue;
|
|
232
|
-
|
|
233
|
-
object? rawInput = entry.TryGetValue("in", out object? inv) ? inv : null;
|
|
234
|
-
if (!allowNull && rawInput == null && !hasErr) continue;
|
|
235
|
-
rawInput = FixJson(rawInput, allowNull);
|
|
236
|
-
var input = rawInput as Dictionary<string, object?>;
|
|
237
|
-
|
|
238
|
-
if (hasErr)
|
|
239
|
-
{
|
|
240
|
-
string expectedErr = entry["err"]?.ToString() ?? "";
|
|
241
|
-
try
|
|
242
|
-
{
|
|
243
|
-
var r = subject(input);
|
|
244
|
-
Assert.Fail(
|
|
245
|
-
$"Entry #{i}: expected error but no exception thrown " +
|
|
246
|
-
$"(result={StructUtils.Stringify(r)})");
|
|
247
|
-
}
|
|
248
|
-
catch (Exception ex) when (ex is not Xunit.Sdk.XunitException)
|
|
249
|
-
{
|
|
250
|
-
string msg = ex.Message;
|
|
251
|
-
bool ok = msg.Contains(expectedErr) || expectedErr.Length == 0;
|
|
252
|
-
if (!ok)
|
|
253
|
-
Assert.Fail(
|
|
254
|
-
$"Entry #{i}: expected error containing '{expectedErr}' " +
|
|
255
|
-
$"but got '{msg}'");
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
else
|
|
259
|
-
{
|
|
260
|
-
object? expected = FixJson(entry["out"], allowNull);
|
|
261
|
-
object? result;
|
|
262
|
-
try { result = subject(input); }
|
|
263
|
-
catch (Exception ex)
|
|
264
|
-
{
|
|
265
|
-
Assert.Fail($"Entry #{i}: unexpected exception: {ex.Message}");
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
result = FixJson(result, allowNull);
|
|
269
|
-
if (!DeepEqual(expected, result))
|
|
270
|
-
Assert.Fail(
|
|
271
|
-
$"Entry #{i}: expected {StructUtils.Stringify(expected)} " +
|
|
272
|
-
$"but got {StructUtils.Stringify(result)}");
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|