#pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace NYql; using namespace NYql::NDom; using namespace NYql::NUdf; using namespace NYql::NJsonPath; using namespace NJson; using namespace NKikimr::NMiniKQL; class TJsonPathTestBase: public TTestBase { public: TJsonPathTestBase(); protected: const TVector LAX_MODES = {"", "lax "}; const TVector STRICT_MODES = {"strict "}; const TVector ALL_MODES = {"", "lax ", "strict "}; TIntrusivePtr FunctionRegistry; TScopedAlloc Alloc; TTypeEnvironment Env; TMemoryUsageInfo MemInfo; THolderFactory HolderFactory; TDefaultValueBuilder ValueBuilder; const int MAX_PARSE_ERRORS = 100; TIssueCode C(TIssuesIds::EIssueCode code); TUnboxedValue ParseJson(TStringBuf raw); struct TMultiOutputTestCase { TString Json; TString JsonPath; TVector Result; }; void RunTestCase(const TString& rawJson, const TString& rawJsonPath, const TVector& expectedResult); void RunParseErrorTestCase(const TString& rawJsonPath); struct TRuntimeErrorTestCase { TString Json; TString JsonPath; TIssueCode Error; }; void RunRuntimeErrorTestCase(const TString& rawJson, const TString& rawJsonPath, TIssueCode error); struct TVariablesTestCase { TString Json; THashMap Variables; TString JsonPath; TVector Result; }; void RunVariablesTestCase(const TString& rawJson, const THashMap& variables, const TString& rawJsonPath, const TVector& expectedResult); };