@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,959 @@
|
|
|
1
|
+
-- Vendored from voxgig/struct/lua
|
|
2
|
+
|
|
3
|
+
local assert = require("luassert")
|
|
4
|
+
|
|
5
|
+
local vs = require("utility.struct.struct")
|
|
6
|
+
|
|
7
|
+
local runnerModule = require("test.struct_runner")
|
|
8
|
+
local makeRunner, nullModifier, NULLMARK, JSON_NULL = runnerModule.makeRunner,
|
|
9
|
+
runnerModule.nullModifier, runnerModule.NULLMARK, runnerModule.JSON_NULL
|
|
10
|
+
local StructTestClient = runnerModule.StructTestClient
|
|
11
|
+
|
|
12
|
+
local _test_dir = debug.getinfo(1, "S").source:match("^@(.+/)") or "./"
|
|
13
|
+
local TEST_JSON_FILE = _test_dir .. "../../.sdk/test/test.json"
|
|
14
|
+
|
|
15
|
+
----------------------------------------------------------
|
|
16
|
+
-- Helper Functions
|
|
17
|
+
----------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
-- Helper function to create an array-like table with metatable
|
|
20
|
+
-- @param ... (any) Variable arguments to include in array
|
|
21
|
+
-- @return (table) Table with array metatable
|
|
22
|
+
local function array(...)
|
|
23
|
+
local t = { ... }
|
|
24
|
+
return setmetatable(t, {
|
|
25
|
+
__jsontype = "array"
|
|
26
|
+
})
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
-- Helper function to create an object-like table with metatable
|
|
30
|
+
-- @param t (table) The table to convert to an object (optional)
|
|
31
|
+
-- @return (table) Table with object metatable
|
|
32
|
+
local function object(t)
|
|
33
|
+
t = t or {}
|
|
34
|
+
return setmetatable(t, {
|
|
35
|
+
__jsontype = "object"
|
|
36
|
+
})
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
----------------------------------------------------------
|
|
40
|
+
-- Test Suite
|
|
41
|
+
----------------------------------------------------------
|
|
42
|
+
|
|
43
|
+
describe("struct", function()
|
|
44
|
+
local struct_test_client = StructTestClient.new()
|
|
45
|
+
local runner = makeRunner(TEST_JSON_FILE, struct_test_client)
|
|
46
|
+
|
|
47
|
+
local runnerStruct = runner('struct')
|
|
48
|
+
local spec, runset, runsetflags, client = runnerStruct.spec,
|
|
49
|
+
runnerStruct.runset, runnerStruct.runsetflags, runnerStruct.client
|
|
50
|
+
|
|
51
|
+
local struct_util = client:utility().struct
|
|
52
|
+
-- Extract test specifications for different function groups
|
|
53
|
+
local clone = struct_util.clone
|
|
54
|
+
local delprop = struct_util.delprop
|
|
55
|
+
local escre = struct_util.escre
|
|
56
|
+
local escurl = struct_util.escurl
|
|
57
|
+
local filter = struct_util.filter
|
|
58
|
+
local flatten = struct_util.flatten
|
|
59
|
+
local getelem = struct_util.getelem
|
|
60
|
+
local getpath = struct_util.getpath
|
|
61
|
+
local getprop = struct_util.getprop
|
|
62
|
+
|
|
63
|
+
local haskey = struct_util.haskey
|
|
64
|
+
local inject = struct_util.inject
|
|
65
|
+
local isempty = struct_util.isempty
|
|
66
|
+
local isfunc = struct_util.isfunc
|
|
67
|
+
local iskey = struct_util.iskey
|
|
68
|
+
|
|
69
|
+
local islist = struct_util.islist
|
|
70
|
+
local ismap = struct_util.ismap
|
|
71
|
+
local isnode = struct_util.isnode
|
|
72
|
+
local items = struct_util.items
|
|
73
|
+
local join = struct_util.join
|
|
74
|
+
local jsonify = struct_util.jsonify
|
|
75
|
+
|
|
76
|
+
local keysof = struct_util.keysof
|
|
77
|
+
local merge = struct_util.merge
|
|
78
|
+
local pad = struct_util.pad
|
|
79
|
+
local pathify = struct_util.pathify
|
|
80
|
+
local select_fn = struct_util.select
|
|
81
|
+
local setpath = struct_util.setpath
|
|
82
|
+
local setprop = struct_util.setprop
|
|
83
|
+
local size = struct_util.size
|
|
84
|
+
local slice = struct_util.slice
|
|
85
|
+
local strkey = struct_util.strkey
|
|
86
|
+
|
|
87
|
+
local stringify = struct_util.stringify
|
|
88
|
+
local transform = struct_util.transform
|
|
89
|
+
local typename = struct_util.typename
|
|
90
|
+
local typify = struct_util.typify
|
|
91
|
+
local validate = struct_util.validate
|
|
92
|
+
local walk = struct_util.walk
|
|
93
|
+
|
|
94
|
+
local minorSpec = spec.minor
|
|
95
|
+
local walkSpec = spec.walk
|
|
96
|
+
local mergeSpec = spec.merge
|
|
97
|
+
local getpathSpec = spec.getpath
|
|
98
|
+
local injectSpec = spec.inject
|
|
99
|
+
local transformSpec = spec.transform
|
|
100
|
+
local validateSpec = spec.validate
|
|
101
|
+
local selectSpec = spec.select
|
|
102
|
+
|
|
103
|
+
-- Basic existence tests
|
|
104
|
+
test("exists", function()
|
|
105
|
+
assert.equal("function", type(clone))
|
|
106
|
+
assert.equal("function", type(delprop))
|
|
107
|
+
assert.equal("function", type(escre))
|
|
108
|
+
assert.equal("function", type(escurl))
|
|
109
|
+
assert.equal("function", type(filter))
|
|
110
|
+
|
|
111
|
+
assert.equal("function", type(flatten))
|
|
112
|
+
assert.equal("function", type(getelem))
|
|
113
|
+
assert.equal("function", type(getprop))
|
|
114
|
+
assert.equal("function", type(getpath))
|
|
115
|
+
|
|
116
|
+
assert.equal("function", type(haskey))
|
|
117
|
+
assert.equal("function", type(inject))
|
|
118
|
+
assert.equal("function", type(isempty))
|
|
119
|
+
assert.equal("function", type(isfunc))
|
|
120
|
+
|
|
121
|
+
assert.equal("function", type(iskey))
|
|
122
|
+
assert.equal("function", type(islist))
|
|
123
|
+
assert.equal("function", type(ismap))
|
|
124
|
+
assert.equal("function", type(isnode))
|
|
125
|
+
assert.equal("function", type(items))
|
|
126
|
+
|
|
127
|
+
assert.equal("function", type(join))
|
|
128
|
+
assert.equal("function", type(jsonify))
|
|
129
|
+
assert.equal("function", type(keysof))
|
|
130
|
+
assert.equal("function", type(merge))
|
|
131
|
+
assert.equal("function", type(pad))
|
|
132
|
+
assert.equal("function", type(pathify))
|
|
133
|
+
|
|
134
|
+
assert.equal("function", type(select_fn))
|
|
135
|
+
assert.equal("function", type(setpath))
|
|
136
|
+
assert.equal("function", type(size))
|
|
137
|
+
assert.equal("function", type(slice))
|
|
138
|
+
assert.equal("function", type(setprop))
|
|
139
|
+
|
|
140
|
+
assert.equal("function", type(strkey))
|
|
141
|
+
assert.equal("function", type(stringify))
|
|
142
|
+
assert.equal("function", type(transform))
|
|
143
|
+
assert.equal("function", type(typify))
|
|
144
|
+
assert.equal("function", type(typename))
|
|
145
|
+
|
|
146
|
+
assert.equal("function", type(validate))
|
|
147
|
+
assert.equal("function", type(walk))
|
|
148
|
+
end)
|
|
149
|
+
|
|
150
|
+
----------------------------------------------------------
|
|
151
|
+
-- Minor Function Tests
|
|
152
|
+
----------------------------------------------------------
|
|
153
|
+
|
|
154
|
+
test("minor-isnode", function()
|
|
155
|
+
runset(minorSpec.isnode, isnode)
|
|
156
|
+
end)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
test("minor-ismap", function()
|
|
160
|
+
runset(minorSpec.ismap, ismap)
|
|
161
|
+
end)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
test("minor-islist", function()
|
|
165
|
+
runset(minorSpec.islist, islist)
|
|
166
|
+
end)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
test("minor-iskey", function()
|
|
170
|
+
runsetflags(minorSpec.iskey, {
|
|
171
|
+
null = false
|
|
172
|
+
}, iskey)
|
|
173
|
+
end)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
test("minor-strkey", function()
|
|
177
|
+
runsetflags(minorSpec.strkey, {
|
|
178
|
+
null = false
|
|
179
|
+
}, strkey)
|
|
180
|
+
end)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
test("minor-isempty", function()
|
|
184
|
+
runsetflags(minorSpec.isempty, {
|
|
185
|
+
null = false
|
|
186
|
+
}, isempty)
|
|
187
|
+
end)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
test("minor-isfunc", function()
|
|
191
|
+
runset(minorSpec.isfunc, isfunc)
|
|
192
|
+
|
|
193
|
+
-- Additional explicit function tests
|
|
194
|
+
local f0 = function()
|
|
195
|
+
return nil
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
assert.equal(isfunc(f0), true)
|
|
199
|
+
assert.equal(isfunc(function()
|
|
200
|
+
return nil
|
|
201
|
+
end), true)
|
|
202
|
+
end)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
test("minor-clone", function()
|
|
206
|
+
runsetflags(minorSpec.clone, {
|
|
207
|
+
null = false
|
|
208
|
+
}, clone)
|
|
209
|
+
|
|
210
|
+
-- Additional function cloning test
|
|
211
|
+
local f0 = function()
|
|
212
|
+
return nil
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
local original = {
|
|
216
|
+
a = f0
|
|
217
|
+
}
|
|
218
|
+
local copied = clone(original)
|
|
219
|
+
assert.are.same(original, copied)
|
|
220
|
+
end)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
test("minor-filter", function()
|
|
224
|
+
local checkmap = {
|
|
225
|
+
gt3 = function(n) return n[2] > 3 end,
|
|
226
|
+
lt3 = function(n) return n[2] < 3 end,
|
|
227
|
+
}
|
|
228
|
+
runset(minorSpec.filter, function(vin)
|
|
229
|
+
return filter(vin.val, checkmap[vin.check])
|
|
230
|
+
end)
|
|
231
|
+
end)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
test("minor-flatten", function()
|
|
235
|
+
runset(minorSpec.flatten, function(vin)
|
|
236
|
+
return flatten(vin.val, vin.depth)
|
|
237
|
+
end)
|
|
238
|
+
end)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
test("minor-escre", function()
|
|
242
|
+
runset(minorSpec.escre, escre)
|
|
243
|
+
end)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
test("minor-escurl", function()
|
|
247
|
+
runset(minorSpec.escurl, function(vin)
|
|
248
|
+
-- Ensure spaces are properly replaced like in the Go implementation
|
|
249
|
+
return escurl(vin):gsub("+", "%%20")
|
|
250
|
+
end)
|
|
251
|
+
end)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
test("minor-stringify", function()
|
|
255
|
+
runset(minorSpec.stringify, function(vin)
|
|
256
|
+
if NULLMARK == vin.val then
|
|
257
|
+
return stringify("null", vin.max)
|
|
258
|
+
else
|
|
259
|
+
return stringify(vin.val, vin.max)
|
|
260
|
+
end
|
|
261
|
+
end)
|
|
262
|
+
end)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
test('minor-pathify', function()
|
|
266
|
+
runsetflags(minorSpec.pathify, {
|
|
267
|
+
null = true
|
|
268
|
+
}, function(vin)
|
|
269
|
+
local path
|
|
270
|
+
if NULLMARK == vin.path then
|
|
271
|
+
path = nil
|
|
272
|
+
else
|
|
273
|
+
path = vin.path
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
local pathstr = pathify(path, vin.from):gsub('__NULL__%.', '')
|
|
277
|
+
pathstr = NULLMARK == vin.path and pathstr:gsub('>', ':null>') or pathstr
|
|
278
|
+
return pathstr
|
|
279
|
+
end)
|
|
280
|
+
end)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
test("minor-items", function()
|
|
284
|
+
runset(minorSpec.items, items)
|
|
285
|
+
end)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
test("minor-edge-items", function()
|
|
289
|
+
local a0 = {11, 22, 33}
|
|
290
|
+
a0.x = 1
|
|
291
|
+
assert.same(items(a0), {{'0', 11}, {'1', 22}, {'2', 33}})
|
|
292
|
+
end)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
test("minor-getprop", function()
|
|
296
|
+
runsetflags(minorSpec.getprop, {
|
|
297
|
+
null = false
|
|
298
|
+
}, function(vin)
|
|
299
|
+
if vin.alt == nil then
|
|
300
|
+
return getprop(vin.val, vin.key)
|
|
301
|
+
else
|
|
302
|
+
return getprop(vin.val, vin.key, vin.alt)
|
|
303
|
+
end
|
|
304
|
+
end)
|
|
305
|
+
end)
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
test("minor-edge-getprop", function()
|
|
309
|
+
local strarr = { "a", "b", "c", "d", "e" }
|
|
310
|
+
assert.same(getprop(strarr, 2), "c")
|
|
311
|
+
assert.same(getprop(strarr, "2"), "c")
|
|
312
|
+
|
|
313
|
+
local intarr = { 2, 3, 5, 7, 11 }
|
|
314
|
+
assert.same(getprop(intarr, 2), 5)
|
|
315
|
+
assert.same(getprop(intarr, "2"), 5)
|
|
316
|
+
end)
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
test("minor-setprop", function()
|
|
320
|
+
runset(minorSpec.setprop, function(vin)
|
|
321
|
+
return setprop(vin.parent, vin.key, vin.val)
|
|
322
|
+
end)
|
|
323
|
+
end)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
test("minor-edge-setprop", function()
|
|
327
|
+
local strarr0 = { "a", "b", "c", "d", "e" }
|
|
328
|
+
local strarr1 = { "a", "b", "c", "d", "e" }
|
|
329
|
+
assert.same({ "a", "b", "C", "d", "e" }, setprop(strarr0, 2, "C"))
|
|
330
|
+
assert.same({ "a", "b", "CC", "d", "e" }, setprop(strarr1, "2", "CC"))
|
|
331
|
+
|
|
332
|
+
local intarr0 = { 2, 3, 5, 7, 11 }
|
|
333
|
+
local intarr1 = { 2, 3, 5, 7, 11 }
|
|
334
|
+
assert.same({ 2, 3, 55, 7, 11 }, setprop(intarr0, 2, 55))
|
|
335
|
+
assert.same({ 2, 3, 555, 7, 11 }, setprop(intarr1, "2", 555))
|
|
336
|
+
end)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
test("minor-haskey", function()
|
|
340
|
+
runsetflags(minorSpec.haskey, {
|
|
341
|
+
null = false
|
|
342
|
+
}, function(vin)
|
|
343
|
+
return haskey(vin.src, vin.key)
|
|
344
|
+
end)
|
|
345
|
+
end)
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
test("minor-keysof", function()
|
|
349
|
+
runset(minorSpec.keysof, keysof)
|
|
350
|
+
end)
|
|
351
|
+
|
|
352
|
+
test("minor-edge-keysof", function()
|
|
353
|
+
local a0 = {11, 22, 33}
|
|
354
|
+
a0.x = 1
|
|
355
|
+
assert.same(keysof(a0), {'0', '1', '2'})
|
|
356
|
+
end)
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
test("minor-join", function()
|
|
360
|
+
runsetflags(minorSpec.join, {
|
|
361
|
+
null = false
|
|
362
|
+
}, function(vin)
|
|
363
|
+
return join(vin.val, vin.sep, vin.url)
|
|
364
|
+
end)
|
|
365
|
+
end)
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
test("minor-typename", function()
|
|
369
|
+
runset(minorSpec.typename, typename)
|
|
370
|
+
end)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
test("minor-typify", function()
|
|
374
|
+
-- Filter out JSON null 'in' entries: Lua typify(nil) returns T_null,
|
|
375
|
+
-- but TS typify(null) returns T_scalar|T_null.
|
|
376
|
+
local filtered = { set = {} }
|
|
377
|
+
setmetatable(filtered.set, { __jsontype = "array" })
|
|
378
|
+
for _, entry in ipairs(minorSpec.typify.set) do
|
|
379
|
+
if entry["in"] ~= JSON_NULL then
|
|
380
|
+
table.insert(filtered.set, entry)
|
|
381
|
+
end
|
|
382
|
+
end
|
|
383
|
+
runsetflags(filtered, {
|
|
384
|
+
null = false
|
|
385
|
+
}, typify)
|
|
386
|
+
end)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
test("minor-getelem", function()
|
|
390
|
+
runsetflags(minorSpec.getelem, {
|
|
391
|
+
null = false
|
|
392
|
+
}, function(vin)
|
|
393
|
+
if vin.alt == nil then
|
|
394
|
+
return getelem(vin.val, vin.key)
|
|
395
|
+
else
|
|
396
|
+
return getelem(vin.val, vin.key, vin.alt)
|
|
397
|
+
end
|
|
398
|
+
end)
|
|
399
|
+
end)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
test("minor-size", function()
|
|
403
|
+
runsetflags(minorSpec.size, {
|
|
404
|
+
null = false
|
|
405
|
+
}, size)
|
|
406
|
+
end)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
test("minor-slice", function()
|
|
410
|
+
runsetflags(minorSpec.slice, {
|
|
411
|
+
null = false
|
|
412
|
+
}, function(vin)
|
|
413
|
+
return slice(vin.val, vin.start, vin['end'])
|
|
414
|
+
end)
|
|
415
|
+
end)
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
test("minor-pad", function()
|
|
419
|
+
runsetflags(minorSpec.pad, {
|
|
420
|
+
null = false
|
|
421
|
+
}, function(vin)
|
|
422
|
+
return pad(vin.val, vin.pad, vin.char)
|
|
423
|
+
end)
|
|
424
|
+
end)
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
test("minor-setpath", function()
|
|
428
|
+
runsetflags(minorSpec.setpath, {
|
|
429
|
+
null = false
|
|
430
|
+
}, function(vin)
|
|
431
|
+
return setpath(vin.store, vin.path, vin.val)
|
|
432
|
+
end)
|
|
433
|
+
end)
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
test("minor-delprop", function()
|
|
437
|
+
runset(minorSpec.delprop, function(vin)
|
|
438
|
+
return delprop(vin.parent, vin.key)
|
|
439
|
+
end)
|
|
440
|
+
end)
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
test("minor-edge-delprop", function()
|
|
444
|
+
local strarr0 = { "a", "b", "c", "d", "e" }
|
|
445
|
+
local strarr1 = { "a", "b", "c", "d", "e" }
|
|
446
|
+
assert.same({ "a", "b", "d", "e" }, delprop(strarr0, 2))
|
|
447
|
+
assert.same({ "a", "b", "d", "e" }, delprop(strarr1, "2"))
|
|
448
|
+
|
|
449
|
+
local intarr0 = { 2, 3, 5, 7, 11 }
|
|
450
|
+
local intarr1 = { 2, 3, 5, 7, 11 }
|
|
451
|
+
assert.same({ 2, 3, 7, 11 }, delprop(intarr0, 2))
|
|
452
|
+
assert.same({ 2, 3, 7, 11 }, delprop(intarr1, "2"))
|
|
453
|
+
end)
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
test("minor-jsonify", function()
|
|
457
|
+
runsetflags(minorSpec.jsonify, {
|
|
458
|
+
null = false
|
|
459
|
+
}, function(vin)
|
|
460
|
+
return jsonify(vin.val, vin.flags)
|
|
461
|
+
end)
|
|
462
|
+
end)
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
----------------------------------------------------------
|
|
466
|
+
-- Walk Tests
|
|
467
|
+
----------------------------------------------------------
|
|
468
|
+
|
|
469
|
+
test("walk-log", function()
|
|
470
|
+
local walktest = clone(walkSpec.log)
|
|
471
|
+
|
|
472
|
+
local function walklog(key, val, parent, path)
|
|
473
|
+
return "k=" .. stringify(key) .. ", v=" .. stringify(val) .. ", p=" ..
|
|
474
|
+
stringify(parent) .. ", t=" .. pathify(path)
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
-- Test before callback
|
|
478
|
+
local logb = array()
|
|
479
|
+
local function walklog_before(key, val, parent, path)
|
|
480
|
+
table.insert(logb, walklog(key, val, parent, path))
|
|
481
|
+
return val
|
|
482
|
+
end
|
|
483
|
+
walk(walktest["in"], walklog_before)
|
|
484
|
+
assert.same(logb, walktest.out.before)
|
|
485
|
+
|
|
486
|
+
-- Test after callback
|
|
487
|
+
local loga = array()
|
|
488
|
+
local function walklog_after(key, val, parent, path)
|
|
489
|
+
table.insert(loga, walklog(key, val, parent, path))
|
|
490
|
+
return val
|
|
491
|
+
end
|
|
492
|
+
walk(walktest["in"], nil, walklog_after)
|
|
493
|
+
assert.same(loga, walktest.out.after)
|
|
494
|
+
|
|
495
|
+
-- Test both callbacks
|
|
496
|
+
local logba = array()
|
|
497
|
+
local function walklog_both(key, val, parent, path)
|
|
498
|
+
table.insert(logba, walklog(key, val, parent, path))
|
|
499
|
+
return val
|
|
500
|
+
end
|
|
501
|
+
walk(walktest["in"], walklog_both, walklog_both)
|
|
502
|
+
assert.same(logba, walktest.out.both)
|
|
503
|
+
end)
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
test("walk-basic", function()
|
|
507
|
+
local function walkpath(_key, val, _parent, path)
|
|
508
|
+
if type(val) == "string" then
|
|
509
|
+
return val .. "~" .. table.concat(path, ".")
|
|
510
|
+
else
|
|
511
|
+
return val
|
|
512
|
+
end
|
|
513
|
+
end
|
|
514
|
+
runset(walkSpec.basic, function(vin)
|
|
515
|
+
return walk(vin, walkpath)
|
|
516
|
+
end)
|
|
517
|
+
end)
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
test("walk-depth", function()
|
|
521
|
+
runsetflags(walkSpec.depth, { null = false }, function(vin)
|
|
522
|
+
local top = nil
|
|
523
|
+
local cur = nil
|
|
524
|
+
local function copy(key, val, _parent, _path)
|
|
525
|
+
if key == nil or isnode(val) then
|
|
526
|
+
local child = islist(val) and array() or object()
|
|
527
|
+
if key == nil then
|
|
528
|
+
top = child
|
|
529
|
+
cur = child
|
|
530
|
+
else
|
|
531
|
+
cur[key] = child
|
|
532
|
+
cur = child
|
|
533
|
+
end
|
|
534
|
+
else
|
|
535
|
+
cur[key] = val
|
|
536
|
+
end
|
|
537
|
+
return val
|
|
538
|
+
end
|
|
539
|
+
walk(vin.src, copy, nil, vin.maxdepth)
|
|
540
|
+
return top
|
|
541
|
+
end)
|
|
542
|
+
end)
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
test("walk-copy", function()
|
|
546
|
+
local cur
|
|
547
|
+
|
|
548
|
+
local function walkcopy(key, val, _parent, path)
|
|
549
|
+
if key == nil then
|
|
550
|
+
cur = {}
|
|
551
|
+
cur[0] = ismap(val) and object() or islist(val) and array() or val
|
|
552
|
+
return val
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
local v = val
|
|
556
|
+
local i = size(path)
|
|
557
|
+
|
|
558
|
+
if isnode(v) then
|
|
559
|
+
v = ismap(v) and object() or array()
|
|
560
|
+
cur[i] = v
|
|
561
|
+
end
|
|
562
|
+
|
|
563
|
+
setprop(cur[i - 1], key, v)
|
|
564
|
+
|
|
565
|
+
return val
|
|
566
|
+
end
|
|
567
|
+
|
|
568
|
+
runset(walkSpec.copy, function(vin)
|
|
569
|
+
walk(vin, walkcopy)
|
|
570
|
+
return cur[0]
|
|
571
|
+
end)
|
|
572
|
+
end)
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
----------------------------------------------------------
|
|
576
|
+
-- Merge Tests
|
|
577
|
+
----------------------------------------------------------
|
|
578
|
+
|
|
579
|
+
test("merge-basic", function()
|
|
580
|
+
local mergetest = clone(mergeSpec.basic)
|
|
581
|
+
assert.same(mergetest.out, merge(mergetest['in']))
|
|
582
|
+
end)
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
test("merge-cases", function()
|
|
586
|
+
runset(mergeSpec.cases, merge)
|
|
587
|
+
end)
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
test("merge-array", function()
|
|
591
|
+
runset(mergeSpec.array, merge)
|
|
592
|
+
end)
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
test("merge-integrity", function()
|
|
596
|
+
runset(mergeSpec.integrity, merge)
|
|
597
|
+
end)
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
test("merge-special", function()
|
|
601
|
+
local f0 = function()
|
|
602
|
+
return nil
|
|
603
|
+
end
|
|
604
|
+
|
|
605
|
+
assert.same(f0, merge(array(f0)))
|
|
606
|
+
assert.same(f0, merge(array(nil, f0)))
|
|
607
|
+
assert.same(object({
|
|
608
|
+
a = f0
|
|
609
|
+
}), merge(array(object({
|
|
610
|
+
a = f0
|
|
611
|
+
}))))
|
|
612
|
+
assert.same(object({
|
|
613
|
+
a = object({
|
|
614
|
+
b = f0
|
|
615
|
+
})
|
|
616
|
+
}), merge(array(object({
|
|
617
|
+
a = object({
|
|
618
|
+
b = f0
|
|
619
|
+
})
|
|
620
|
+
}))))
|
|
621
|
+
end)
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
test("merge-depth", function()
|
|
625
|
+
runset(mergeSpec.depth, function(vin)
|
|
626
|
+
return merge(vin.val, vin.depth)
|
|
627
|
+
end)
|
|
628
|
+
end)
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
----------------------------------------------------------
|
|
632
|
+
-- GetPath Tests
|
|
633
|
+
----------------------------------------------------------
|
|
634
|
+
|
|
635
|
+
test("getpath-basic", function()
|
|
636
|
+
runset(getpathSpec.basic, function(vin)
|
|
637
|
+
return getpath(vin.store, vin.path)
|
|
638
|
+
end)
|
|
639
|
+
end)
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
test("getpath-relative", function()
|
|
643
|
+
runset(getpathSpec.relative, function(vin)
|
|
644
|
+
local dpath = vin.dpath
|
|
645
|
+
if type(dpath) == 'string' then
|
|
646
|
+
-- Split dpath string into array
|
|
647
|
+
local parts = {}
|
|
648
|
+
for part in dpath:gmatch('[^%.]+') do
|
|
649
|
+
table.insert(parts, part)
|
|
650
|
+
end
|
|
651
|
+
dpath = parts
|
|
652
|
+
end
|
|
653
|
+
return getpath(vin.store, vin.path, { dparent = vin.dparent, dpath = dpath })
|
|
654
|
+
end)
|
|
655
|
+
end)
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
test("getpath-special", function()
|
|
659
|
+
runset(spec.getpath.special, function(vin)
|
|
660
|
+
return getpath(vin.store, vin.path, vin.inj)
|
|
661
|
+
end)
|
|
662
|
+
end)
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
test("getpath-handler", function()
|
|
666
|
+
runset(spec.getpath.handler, function(vin)
|
|
667
|
+
return getpath(
|
|
668
|
+
{
|
|
669
|
+
["$TOP"] = vin.store,
|
|
670
|
+
["$FOO"] = function() return 'foo' end,
|
|
671
|
+
},
|
|
672
|
+
vin.path,
|
|
673
|
+
{
|
|
674
|
+
handler = function(_inj, val, _cur, _ref)
|
|
675
|
+
return val()
|
|
676
|
+
end
|
|
677
|
+
}
|
|
678
|
+
)
|
|
679
|
+
end)
|
|
680
|
+
end)
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
----------------------------------------------------------
|
|
684
|
+
-- Inject Tests
|
|
685
|
+
----------------------------------------------------------
|
|
686
|
+
|
|
687
|
+
test("inject-basic", function()
|
|
688
|
+
local injecttest = clone(injectSpec.basic)
|
|
689
|
+
assert.same(injecttest.out, inject(injecttest['in'].val, injecttest['in'].store))
|
|
690
|
+
end)
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
test("inject-string", function()
|
|
694
|
+
runset(injectSpec.string, function(vin)
|
|
695
|
+
local result = inject(vin.val, vin.store, { modify = nullModifier })
|
|
696
|
+
return result
|
|
697
|
+
end)
|
|
698
|
+
end)
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
test("inject-deep", function()
|
|
702
|
+
runset(injectSpec.deep, function(vin)
|
|
703
|
+
return inject(vin.val, vin.store)
|
|
704
|
+
end)
|
|
705
|
+
end)
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
----------------------------------------------------------
|
|
709
|
+
-- Transform Tests
|
|
710
|
+
----------------------------------------------------------
|
|
711
|
+
|
|
712
|
+
test("transform-basic", function()
|
|
713
|
+
local transformtest = clone(transformSpec.basic)
|
|
714
|
+
assert.same(transform(transformtest['in'].data, transformtest['in'].spec),
|
|
715
|
+
transformtest.out)
|
|
716
|
+
end)
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
test("transform-paths", function()
|
|
720
|
+
runset(transformSpec.paths, function(vin)
|
|
721
|
+
return transform(vin.data, vin.spec)
|
|
722
|
+
end)
|
|
723
|
+
end)
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
test("transform-cmds", function()
|
|
727
|
+
runset(transformSpec.cmds, function(vin)
|
|
728
|
+
return transform(vin.data, vin.spec)
|
|
729
|
+
end)
|
|
730
|
+
end)
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
test("transform-each", function()
|
|
734
|
+
runset(transformSpec.each, function(vin)
|
|
735
|
+
return transform(vin.data, vin.spec)
|
|
736
|
+
end)
|
|
737
|
+
end)
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
test("transform-pack", function()
|
|
741
|
+
runset(transformSpec.pack, function(vin)
|
|
742
|
+
return transform(vin.data, vin.spec)
|
|
743
|
+
end)
|
|
744
|
+
end)
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
test("transform-ref", function()
|
|
748
|
+
runset(transformSpec.ref, function(vin)
|
|
749
|
+
return transform(vin.data, vin.spec)
|
|
750
|
+
end)
|
|
751
|
+
end)
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
test("transform-format", function()
|
|
755
|
+
runsetflags(transformSpec.format, { null = false }, function(vin)
|
|
756
|
+
return transform(vin.data, vin.spec)
|
|
757
|
+
end)
|
|
758
|
+
end)
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
test("transform-apply", function()
|
|
762
|
+
runset(transformSpec.apply, function(vin)
|
|
763
|
+
return transform(vin.data, vin.spec)
|
|
764
|
+
end)
|
|
765
|
+
end)
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
test("transform-modify", function()
|
|
769
|
+
runset(transformSpec.modify, function(vin)
|
|
770
|
+
return transform(vin.data, vin.spec, {
|
|
771
|
+
modify = function(val, key, parent)
|
|
772
|
+
-- Modify string values by adding '@' prefix
|
|
773
|
+
if key ~= nil and parent ~= nil and type(val) == "string" then
|
|
774
|
+
parent[key] = "@" .. val
|
|
775
|
+
local modified_val = parent[key]
|
|
776
|
+
end
|
|
777
|
+
end
|
|
778
|
+
})
|
|
779
|
+
end)
|
|
780
|
+
end)
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
test("transform-extra", function()
|
|
784
|
+
-- Test advanced transform functionality
|
|
785
|
+
assert.same(transform({
|
|
786
|
+
a = 1
|
|
787
|
+
}, {
|
|
788
|
+
x = '`a`',
|
|
789
|
+
b = '`$COPY`',
|
|
790
|
+
c = '`$UPPER`'
|
|
791
|
+
}, {
|
|
792
|
+
extra = {
|
|
793
|
+
b = 2,
|
|
794
|
+
["$UPPER"] = function(inj)
|
|
795
|
+
local path = inj.path
|
|
796
|
+
return ('' .. tostring(getprop(path, #path - 1))):upper()
|
|
797
|
+
end
|
|
798
|
+
}
|
|
799
|
+
}), {
|
|
800
|
+
x = 1,
|
|
801
|
+
b = 2,
|
|
802
|
+
c = 'C'
|
|
803
|
+
})
|
|
804
|
+
end)
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
test("transform-funcval", function()
|
|
808
|
+
-- Test function handling in transform
|
|
809
|
+
local f0 = function()
|
|
810
|
+
return 99
|
|
811
|
+
end
|
|
812
|
+
|
|
813
|
+
assert.same(transform({}, {
|
|
814
|
+
x = 1
|
|
815
|
+
}), {
|
|
816
|
+
x = 1
|
|
817
|
+
})
|
|
818
|
+
assert.same(transform({}, {
|
|
819
|
+
x = f0
|
|
820
|
+
}), {
|
|
821
|
+
x = f0
|
|
822
|
+
})
|
|
823
|
+
assert.same(transform({
|
|
824
|
+
a = 1
|
|
825
|
+
}, {
|
|
826
|
+
x = '`a`'
|
|
827
|
+
}), {
|
|
828
|
+
x = 1
|
|
829
|
+
})
|
|
830
|
+
assert.same(transform({
|
|
831
|
+
f0 = f0
|
|
832
|
+
}, {
|
|
833
|
+
x = '`f0`'
|
|
834
|
+
}), {
|
|
835
|
+
x = f0
|
|
836
|
+
})
|
|
837
|
+
end)
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
----------------------------------------------------------
|
|
841
|
+
-- Validate Tests
|
|
842
|
+
----------------------------------------------------------
|
|
843
|
+
|
|
844
|
+
test("validate-basic", function()
|
|
845
|
+
runsetflags(validateSpec.basic, { null = false }, function(vin)
|
|
846
|
+
return validate(vin.data, vin.spec)
|
|
847
|
+
end)
|
|
848
|
+
end)
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
test("validate-child", function()
|
|
852
|
+
runset(validateSpec.child, function(vin)
|
|
853
|
+
return validate(vin.data, vin.spec)
|
|
854
|
+
end)
|
|
855
|
+
end)
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
test("validate-one", function()
|
|
859
|
+
runset(validateSpec.one, function(vin)
|
|
860
|
+
return validate(vin.data, vin.spec)
|
|
861
|
+
end)
|
|
862
|
+
end)
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
test("validate-exact", function()
|
|
866
|
+
runset(validateSpec.exact, function(vin)
|
|
867
|
+
return validate(vin.data, vin.spec)
|
|
868
|
+
end)
|
|
869
|
+
end)
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
test("validate-invalid", function()
|
|
873
|
+
runsetflags(validateSpec.invalid, { null = false }, function(vin)
|
|
874
|
+
return validate(vin.data, vin.spec)
|
|
875
|
+
end)
|
|
876
|
+
end)
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
test("validate-special", function()
|
|
880
|
+
runset(validateSpec.special, function(vin)
|
|
881
|
+
return validate(vin.data, vin.spec, vin.inj)
|
|
882
|
+
end)
|
|
883
|
+
end)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
test("validate-custom", function()
|
|
887
|
+
-- Test custom validation functions
|
|
888
|
+
local errs = array()
|
|
889
|
+
local extra = {
|
|
890
|
+
["$INTEGER"] = function(inj)
|
|
891
|
+
local key = inj.key
|
|
892
|
+
local out = getprop(inj.dparent, key)
|
|
893
|
+
|
|
894
|
+
local t = type(out)
|
|
895
|
+
-- Verify the value is an integer
|
|
896
|
+
if (t ~= "number") and (math.type(out) ~= "integer") then
|
|
897
|
+
-- Build path string from inj.path elements, starting at index 2
|
|
898
|
+
local path_parts = {}
|
|
899
|
+
for i = 2, #inj.path do
|
|
900
|
+
table.insert(path_parts, tostring(inj.path[i]))
|
|
901
|
+
end
|
|
902
|
+
local path_str = table.concat(path_parts, ".")
|
|
903
|
+
table.insert(inj.errs, "Not an integer at " .. path_str .. ": " ..
|
|
904
|
+
tostring(out))
|
|
905
|
+
return nil
|
|
906
|
+
end
|
|
907
|
+
return out
|
|
908
|
+
end
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
local shape = {
|
|
912
|
+
a = "`$INTEGER`"
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
local out = validate({
|
|
916
|
+
a = 1
|
|
917
|
+
}, shape, { extra = extra, errs = errs })
|
|
918
|
+
assert.same({
|
|
919
|
+
a = 1
|
|
920
|
+
}, out)
|
|
921
|
+
assert.equal(0, #errs)
|
|
922
|
+
|
|
923
|
+
out = validate({ a = "A" }, shape, { extra = extra, errs = errs })
|
|
924
|
+
assert.same({ a = "A" }, out)
|
|
925
|
+
assert.same(array("Not an integer at a: A"), errs)
|
|
926
|
+
end)
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
----------------------------------------------------------
|
|
930
|
+
-- Select Tests
|
|
931
|
+
----------------------------------------------------------
|
|
932
|
+
|
|
933
|
+
test("select-basic", function()
|
|
934
|
+
runset(selectSpec.basic, function(vin)
|
|
935
|
+
return select_fn(vin.obj, vin.query)
|
|
936
|
+
end)
|
|
937
|
+
end)
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
test("select-operators", function()
|
|
941
|
+
runset(selectSpec.operators, function(vin)
|
|
942
|
+
return select_fn(vin.obj, vin.query)
|
|
943
|
+
end)
|
|
944
|
+
end)
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
test("select-edge", function()
|
|
948
|
+
runset(selectSpec.edge, function(vin)
|
|
949
|
+
return select_fn(vin.obj, vin.query)
|
|
950
|
+
end)
|
|
951
|
+
end)
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
test("select-alts", function()
|
|
955
|
+
runset(selectSpec.alts, function(vin)
|
|
956
|
+
return select_fn(vin.obj, vin.query)
|
|
957
|
+
end)
|
|
958
|
+
end)
|
|
959
|
+
end)
|