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