diff --git a/ast/parser.go b/ast/parser.go index 388e5e5926..f6edea84ba 100644 --- a/ast/parser.go +++ b/ast/parser.go @@ -50,6 +50,19 @@ func (v RegoVersion) Int() int { return 0 } +func (v RegoVersion) String() string { + switch v { + case RegoV0: + return "v0" + case RegoV1: + return "v1" + case RegoV0CompatV1: + return "v0v1" + default: + return "unknown" + } +} + func RegoVersionFromInt(i int) RegoVersion { if i == 1 { return RegoV1 diff --git a/format/format.go b/format/format.go index 4197a8cde5..e4c9afaeb7 100644 --- a/format/format.go +++ b/format/format.go @@ -28,6 +28,9 @@ type Opts struct { // RegoVersion is the version of Rego to format code for. RegoVersion ast.RegoVersion + + // ParserOptions is the parser options used when parsing the module to be formatted. + ParserOptions *ast.ParserOptions } // defaultLocationFile is the file name used in `Ast()` for terms @@ -43,11 +46,15 @@ func Source(filename string, src []byte) ([]byte, error) { } func SourceWithOpts(filename string, src []byte, opts Opts) ([]byte, error) { - parserOpts := ast.ParserOptions{} - if opts.RegoVersion == ast.RegoV1 { - // If the rego version is V1, wee need to parse it as such, to allow for future keywords not being imported. - // Otherwise, we'll default to RegoV0 - parserOpts.RegoVersion = ast.RegoV1 + var parserOpts ast.ParserOptions + if opts.ParserOptions != nil { + parserOpts = *opts.ParserOptions + } else { + if opts.RegoVersion == ast.RegoV1 { + // If the rego version is V1, we need to parse it as such, to allow for future keywords not being imported. + // Otherwise, we'll default to RegoV0 + parserOpts.RegoVersion = ast.RegoV1 + } } module, err := ast.ParseModuleWithOpts(filename, string(src), parserOpts) diff --git a/internal/wasm/sdk/test/e2e/external_test.go b/internal/wasm/sdk/test/e2e/external_test.go index 487ee5ae70..ded9e59592 100644 --- a/internal/wasm/sdk/test/e2e/external_test.go +++ b/internal/wasm/sdk/test/e2e/external_test.go @@ -29,7 +29,7 @@ import ( const opaRootDir = "../../../../../" -var caseDir = flag.String("case-dir", filepath.Join(opaRootDir, "test/cases/testdata"), "set directory to load test cases from") +var caseDir = flag.String("case-dir", filepath.Join(opaRootDir, "test/cases/testdata/"), "set directory to load test cases from") var exceptionsFile = flag.String("exceptions", "./exceptions.yaml", "set file to load a list of test names to exclude") var exceptions map[string]string @@ -57,52 +57,59 @@ func TestWasmE2E(t *testing.T) { ctx := context.Background() - for _, tc := range cases.MustLoad(*caseDir).Sorted().Cases { - name := fmt.Sprintf("%s/%s", strings.TrimPrefix(tc.Filename, opaRootDir), tc.Note) - t.Run(name, func(t *testing.T) { - - if shouldSkip(t, tc) { - t.SkipNow() - } - - for k, v := range tc.Env { - t.Setenv(k, v) - } - - opts := []func(*rego.Rego){ - rego.Query(tc.Query), - } - for i := range tc.Modules { - opts = append(opts, rego.Module(fmt.Sprintf("module-%d.rego", i), tc.Modules[i])) - } - if testing.Verbose() { - opts = append(opts, rego.Dump(os.Stderr)) - } - cr, err := rego.New(opts...).Compile(ctx) - if err != nil { - t.Fatal(err) - } - o := opa.New().WithPolicyBytes(cr.Bytes) - if tc.Data != nil { - o = o.WithDataJSON(tc.Data) - } - o, err = o.Init() - if err != nil { - t.Fatal(err) - } - - var input *interface{} - - if tc.InputTerm != nil { - var x interface{} = ast.MustParseTerm(*tc.InputTerm) - input = &x - } else if tc.Input != nil { - input = tc.Input - } - - result, err := o.Eval(ctx, opa.EvalOpts{Input: input}) - assert(t, tc, result, err) - }) + regoVersions := map[string]ast.RegoVersion{ + "v0": ast.RegoV0, + "v1": ast.RegoV1, + } + for versionName, regoVersion := range regoVersions { + for _, tc := range cases.MustLoad(filepath.Join(*caseDir, versionName)).Sorted().Cases { + name := fmt.Sprintf("%s/%s", strings.TrimPrefix(tc.Filename, opaRootDir), tc.Note) + t.Run(name, func(t *testing.T) { + + if shouldSkip(t, tc) { + t.SkipNow() + } + + for k, v := range tc.Env { + t.Setenv(k, v) + } + + opts := []func(*rego.Rego){ + rego.Query(tc.Query), + rego.SetRegoVersion(regoVersion), + } + for i := range tc.Modules { + opts = append(opts, rego.Module(fmt.Sprintf("module-%d.rego", i), tc.Modules[i])) + } + if testing.Verbose() { + opts = append(opts, rego.Dump(os.Stderr)) + } + cr, err := rego.New(opts...).Compile(ctx) + if err != nil { + t.Fatal(err) + } + o := opa.New().WithPolicyBytes(cr.Bytes) + if tc.Data != nil { + o = o.WithDataJSON(tc.Data) + } + o, err = o.Init() + if err != nil { + t.Fatal(err) + } + + var input *interface{} + + if tc.InputTerm != nil { + var x interface{} = ast.MustParseTerm(*tc.InputTerm) + input = &x + } else if tc.Input != nil { + input = tc.Input + } + + result, err := o.Eval(ctx, opa.EvalOpts{Input: input}) + assert(t, tc, result, err) + }) + } } } diff --git a/test/cases/cases.go b/test/cases/cases.go index 1b4a0f5a0b..457fbe83f9 100644 --- a/test/cases/cases.go +++ b/test/cases/cases.go @@ -14,6 +14,10 @@ import ( "github.com/open-policy-agent/opa/util" ) +// Create v1 test cases from v0 test cases. +// //go:generate ../../build/gen-run-go.sh internal/fmtcases/main.go testdata/v0 0 testdata/v1 1 +//go:generate ../../build/gen-run-go.sh internal/fmtcases/main.go testdata/v1 0 testdata/v1_2 1 + // Set represents a collection of test cases. type Set struct { Cases []TestCase `json:"cases"` @@ -31,20 +35,20 @@ func (s Set) Sorted() Set { // TestCase represents a single test case. type TestCase struct { - Filename string `json:"-"` // name of file that case was loaded from - Note string `json:"note"` // globally unique identifier for this test case - Query string `json:"query"` // policy query to execute - Modules []string `json:"modules,omitempty"` // policies to test against - Data *map[string]interface{} `json:"data,omitempty"` // data to test against - Input *interface{} `json:"input,omitempty"` // parsed input data to use - InputTerm *string `json:"input_term,omitempty"` // raw input data (serialized as a string, overrides input) - WantDefined *bool `json:"want_defined,omitempty"` // expect query result to be defined (or not) - WantResult *[]map[string]interface{} `json:"want_result,omitempty"` // expect query result (overrides defined) - WantErrorCode *string `json:"want_error_code,omitempty"` // expect query error code (overrides result) - WantError *string `json:"want_error,omitempty"` // expect query error message (overrides error code) - SortBindings bool `json:"sort_bindings,omitempty"` // indicates that binding values should be treated as sets - StrictError bool `json:"strict_error,omitempty"` // indicates that the error depends on strict builtin error mode - Env map[string]string `json:"env,omitempty"` // environment variables to be set during the test + Filename string `json:"-" yaml:"-"` // name of file that case was loaded from + Note string `json:"note" yaml:"note"` // globally unique identifier for this test case + Query string `json:"query" yaml:"query"` // policy query to execute + Modules []string `json:"modules,omitempty" yaml:"modules,omitempty"` // policies to test against + Data *map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"` // data to test against + Input *interface{} `json:"input,omitempty" yaml:"input,omitempty"` // parsed input data to use + InputTerm *string `json:"input_term,omitempty" yaml:"input_term,omitempty"` // raw input data (serialized as a string, overrides input) + WantDefined *bool `json:"want_defined,omitempty" yaml:"want_defined,omitempty"` // expect query result to be defined (or not) + WantResult *[]map[string]interface{} `json:"want_result,omitempty" yaml:"want_result,omitempty"` // expect query result (overrides defined) + WantErrorCode *string `json:"want_error_code,omitempty" yaml:"want_error_code,omitempty"` // expect query error code (overrides result) + WantError *string `json:"want_error,omitempty" yaml:"want_error,omitempty"` // expect query error message (overrides error code) + SortBindings bool `json:"sort_bindings,omitempty" yaml:"sort_bindings,omitempty"` // indicates that binding values should be treated as sets + StrictError bool `json:"strict_error,omitempty" yaml:"strict_error,omitempty"` // indicates that the error depends on strict builtin error mode + Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"` // environment variables to be set during the test } // Load returns a set of built-in test cases. diff --git a/test/cases/internal/fmtcases/main.go b/test/cases/internal/fmtcases/main.go new file mode 100644 index 0000000000..ffdae58629 --- /dev/null +++ b/test/cases/internal/fmtcases/main.go @@ -0,0 +1,124 @@ +// Copyright 2024 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package main + +import ( + "bytes" + "fmt" + "os" + "path/filepath" + "strconv" + + "github.com/open-policy-agent/opa/ast" + "github.com/open-policy-agent/opa/format" + "github.com/open-policy-agent/opa/test/cases" + "github.com/open-policy-agent/opa/util" + "gopkg.in/yaml.v3" +) + +func main() { + if len(os.Args) < 5 { + fmt.Println("Usage: main ") + os.Exit(1) + } + + s := os.Args[1] + sv, err := strconv.Atoi(os.Args[2]) + if err != nil { + fmt.Println("Version must be an integer") + os.Exit(1) + } + t := os.Args[3] + tv, err := strconv.Atoi(os.Args[4]) + if err != nil { + fmt.Println("Version must be an integer") + os.Exit(1) + } + sourceRegoVersion := ast.RegoVersionFromInt(sv) + targetRegoVersion := ast.RegoVersionFromInt(tv) + + fmt.Printf("Formatting test cases '%s'->'%s' to rego-version %s\n", s, t, targetRegoVersion) + + es, err := os.ReadDir(s) + if err != nil { + fmt.Println("Error reading source directory:", err) + os.Exit(1) + } + for _, e := range es { + if err := copyEntry(s, sourceRegoVersion, e, t, targetRegoVersion); err != nil { + fmt.Println("Error handling source entry:", err) + os.Exit(1) + } + } +} + +func copyEntry(sourceRoot string, sourceRegoVersion ast.RegoVersion, e os.DirEntry, targetRoot string, targetRegoVersion ast.RegoVersion) error { + i, err := e.Info() + if err != nil { + return err + } + + if i.IsDir() { + err = os.MkdirAll(filepath.Join(targetRoot, e.Name()), i.Mode()) + if err != nil { + return err + } + childSourceRoot := filepath.Join(sourceRoot, e.Name()) + childTargetRoot := filepath.Join(targetRoot, e.Name()) + es, err := os.ReadDir(childSourceRoot) + if err != nil { + return err + } + for _, c := range es { + if err := copyEntry(childSourceRoot, sourceRegoVersion, c, childTargetRoot, targetRegoVersion); err != nil { + return err + } + } + } else { + path := filepath.Join(sourceRoot, i.Name()) + bs, err := os.ReadFile(path) + if err != nil { + return err + } + + var testCases cases.Set + if err := util.Unmarshal(bs, &testCases); err != nil { + return err + } + + // Format test modules + for _, testCase := range testCases.Cases { + for i, module := range testCase.Modules { + bs, err := format.SourceWithOpts(fmt.Sprintf("mod%d.rego", i), []byte(module), + format.Opts{ + ParserOptions: &ast.ParserOptions{ + RegoVersion: sourceRegoVersion, + }, + RegoVersion: targetRegoVersion, + }) + if err != nil { + fmt.Printf("Error formatting module %s %s:%d: %v\n", path, testCase.Note, i, err) + } else { + testCase.Modules[i] = string(bs) + } + } + } + + // Write formatted test cases to target directory + targetPath := filepath.Join(targetRoot, i.Name()) + var buf bytes.Buffer + enc := yaml.NewEncoder(&buf) + enc.SetIndent(2) + if err := enc.Encode(testCases); err != nil { + return err + } + + text := fmt.Sprintf("---\n%s", buf.String()) + if err := os.WriteFile(targetPath, []byte(text), i.Mode()); err != nil { + return err + } + } + return nil +} diff --git a/test/cases/testdata/aggregates/test-aggregates-0001.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0001.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0001.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0001.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0002.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0002.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0002.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0002.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0003.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0003.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0003.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0003.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0004.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0004.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0004.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0004.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0005.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0005.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0005.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0005.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0006.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0006.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0006.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0006.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0007.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0007.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0007.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0007.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0008.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0008.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0008.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0008.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0009.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0009.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0009.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0009.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0010.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0010.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0010.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0010.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0011.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0011.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0011.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0011.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0012.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0012.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0012.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0012.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0013.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0013.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0013.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0013.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0014.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0014.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0014.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0014.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0015.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0015.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0015.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0015.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0016.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0016.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0016.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0016.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0017.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0017.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0017.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0017.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0018.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0018.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0018.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0018.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0019.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0019.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0019.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0019.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0020.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0020.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0020.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0020.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0021.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0021.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0021.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0021.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0022.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0022.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0022.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0022.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0023.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0023.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0023.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0023.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0024.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0024.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0024.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0024.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0025.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0025.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0025.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0025.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0026.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0026.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0026.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0026.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0027.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0027.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0027.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0027.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-0028.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-0028.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-0028.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-0028.yaml diff --git a/test/cases/testdata/aggregates/test-aggregates-bad-utf8-runes.yaml b/test/cases/testdata/v0/aggregates/test-aggregates-bad-utf8-runes.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-aggregates-bad-utf8-runes.yaml rename to test/cases/testdata/v0/aggregates/test-aggregates-bad-utf8-runes.yaml diff --git a/test/cases/testdata/aggregates/test-membership.yaml b/test/cases/testdata/v0/aggregates/test-membership.yaml similarity index 100% rename from test/cases/testdata/aggregates/test-membership.yaml rename to test/cases/testdata/v0/aggregates/test-membership.yaml diff --git a/test/cases/testdata/all/test-all-0027.yaml b/test/cases/testdata/v0/all/test-all-0027.yaml similarity index 100% rename from test/cases/testdata/all/test-all-0027.yaml rename to test/cases/testdata/v0/all/test-all-0027.yaml diff --git a/test/cases/testdata/all/test-all-0028.yaml b/test/cases/testdata/v0/all/test-all-0028.yaml similarity index 100% rename from test/cases/testdata/all/test-all-0028.yaml rename to test/cases/testdata/v0/all/test-all-0028.yaml diff --git a/test/cases/testdata/all/test-all-0029.yaml b/test/cases/testdata/v0/all/test-all-0029.yaml similarity index 100% rename from test/cases/testdata/all/test-all-0029.yaml rename to test/cases/testdata/v0/all/test-all-0029.yaml diff --git a/test/cases/testdata/all/test-all-0030.yaml b/test/cases/testdata/v0/all/test-all-0030.yaml similarity index 100% rename from test/cases/testdata/all/test-all-0030.yaml rename to test/cases/testdata/v0/all/test-all-0030.yaml diff --git a/test/cases/testdata/all/test-all-0031.yaml b/test/cases/testdata/v0/all/test-all-0031.yaml similarity index 100% rename from test/cases/testdata/all/test-all-0031.yaml rename to test/cases/testdata/v0/all/test-all-0031.yaml diff --git a/test/cases/testdata/all/test-all-0032.yaml b/test/cases/testdata/v0/all/test-all-0032.yaml similarity index 100% rename from test/cases/testdata/all/test-all-0032.yaml rename to test/cases/testdata/v0/all/test-all-0032.yaml diff --git a/test/cases/testdata/all/test-all-0033.yaml b/test/cases/testdata/v0/all/test-all-0033.yaml similarity index 100% rename from test/cases/testdata/all/test-all-0033.yaml rename to test/cases/testdata/v0/all/test-all-0033.yaml diff --git a/test/cases/testdata/any/test-any-0034.yaml b/test/cases/testdata/v0/any/test-any-0034.yaml similarity index 100% rename from test/cases/testdata/any/test-any-0034.yaml rename to test/cases/testdata/v0/any/test-any-0034.yaml diff --git a/test/cases/testdata/any/test-any-0035.yaml b/test/cases/testdata/v0/any/test-any-0035.yaml similarity index 100% rename from test/cases/testdata/any/test-any-0035.yaml rename to test/cases/testdata/v0/any/test-any-0035.yaml diff --git a/test/cases/testdata/any/test-any-0036.yaml b/test/cases/testdata/v0/any/test-any-0036.yaml similarity index 100% rename from test/cases/testdata/any/test-any-0036.yaml rename to test/cases/testdata/v0/any/test-any-0036.yaml diff --git a/test/cases/testdata/any/test-any-0037.yaml b/test/cases/testdata/v0/any/test-any-0037.yaml similarity index 100% rename from test/cases/testdata/any/test-any-0037.yaml rename to test/cases/testdata/v0/any/test-any-0037.yaml diff --git a/test/cases/testdata/any/test-any-0038.yaml b/test/cases/testdata/v0/any/test-any-0038.yaml similarity index 100% rename from test/cases/testdata/any/test-any-0038.yaml rename to test/cases/testdata/v0/any/test-any-0038.yaml diff --git a/test/cases/testdata/any/test-any-0039.yaml b/test/cases/testdata/v0/any/test-any-0039.yaml similarity index 100% rename from test/cases/testdata/any/test-any-0039.yaml rename to test/cases/testdata/v0/any/test-any-0039.yaml diff --git a/test/cases/testdata/any/test-any-0040.yaml b/test/cases/testdata/v0/any/test-any-0040.yaml similarity index 100% rename from test/cases/testdata/any/test-any-0040.yaml rename to test/cases/testdata/v0/any/test-any-0040.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0810.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0810.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0810.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0810.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0811.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0811.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0811.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0811.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0812.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0812.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0812.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0812.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0813.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0813.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0813.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0813.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0814.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0814.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0814.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0814.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0815.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0815.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0815.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0815.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0816.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0816.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0816.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0816.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0817.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0817.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0817.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0817.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0818.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0818.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0818.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0818.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0819.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0819.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0819.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0819.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0820.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0820.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0820.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0820.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0821.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0821.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0821.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0821.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0822.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0822.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0822.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0822.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0823.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0823.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0823.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0823.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0824.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0824.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0824.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0824.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-0825.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-0825.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-0825.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-0825.yaml diff --git a/test/cases/testdata/arithmetic/test-arithmetic-minus-type-error.yaml b/test/cases/testdata/v0/arithmetic/test-arithmetic-minus-type-error.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-arithmetic-minus-type-error.yaml rename to test/cases/testdata/v0/arithmetic/test-arithmetic-minus-type-error.yaml diff --git a/test/cases/testdata/arithmetic/test-big-int-0001.yaml b/test/cases/testdata/v0/arithmetic/test-big-int-0001.yaml similarity index 100% rename from test/cases/testdata/arithmetic/test-big-int-0001.yaml rename to test/cases/testdata/v0/arithmetic/test-big-int-0001.yaml diff --git a/test/cases/testdata/array/test-array-0041.yaml b/test/cases/testdata/v0/array/test-array-0041.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0041.yaml rename to test/cases/testdata/v0/array/test-array-0041.yaml diff --git a/test/cases/testdata/array/test-array-0042.yaml b/test/cases/testdata/v0/array/test-array-0042.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0042.yaml rename to test/cases/testdata/v0/array/test-array-0042.yaml diff --git a/test/cases/testdata/array/test-array-0043.yaml b/test/cases/testdata/v0/array/test-array-0043.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0043.yaml rename to test/cases/testdata/v0/array/test-array-0043.yaml diff --git a/test/cases/testdata/array/test-array-0044.yaml b/test/cases/testdata/v0/array/test-array-0044.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0044.yaml rename to test/cases/testdata/v0/array/test-array-0044.yaml diff --git a/test/cases/testdata/array/test-array-0045.yaml b/test/cases/testdata/v0/array/test-array-0045.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0045.yaml rename to test/cases/testdata/v0/array/test-array-0045.yaml diff --git a/test/cases/testdata/array/test-array-0046.yaml b/test/cases/testdata/v0/array/test-array-0046.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0046.yaml rename to test/cases/testdata/v0/array/test-array-0046.yaml diff --git a/test/cases/testdata/array/test-array-0047.yaml b/test/cases/testdata/v0/array/test-array-0047.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0047.yaml rename to test/cases/testdata/v0/array/test-array-0047.yaml diff --git a/test/cases/testdata/array/test-array-0048.yaml b/test/cases/testdata/v0/array/test-array-0048.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0048.yaml rename to test/cases/testdata/v0/array/test-array-0048.yaml diff --git a/test/cases/testdata/array/test-array-0049.yaml b/test/cases/testdata/v0/array/test-array-0049.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0049.yaml rename to test/cases/testdata/v0/array/test-array-0049.yaml diff --git a/test/cases/testdata/array/test-array-0050.yaml b/test/cases/testdata/v0/array/test-array-0050.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0050.yaml rename to test/cases/testdata/v0/array/test-array-0050.yaml diff --git a/test/cases/testdata/array/test-array-0051.yaml b/test/cases/testdata/v0/array/test-array-0051.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0051.yaml rename to test/cases/testdata/v0/array/test-array-0051.yaml diff --git a/test/cases/testdata/array/test-array-0052.yaml b/test/cases/testdata/v0/array/test-array-0052.yaml similarity index 100% rename from test/cases/testdata/array/test-array-0052.yaml rename to test/cases/testdata/v0/array/test-array-0052.yaml diff --git a/test/cases/testdata/assignments/test-file-level-assignments.yaml b/test/cases/testdata/v0/assignments/test-file-level-assignments.yaml similarity index 100% rename from test/cases/testdata/assignments/test-file-level-assignments.yaml rename to test/cases/testdata/v0/assignments/test-file-level-assignments.yaml diff --git a/test/cases/testdata/base64builtins/test-base64builtins-0929.yaml b/test/cases/testdata/v0/base64builtins/test-base64builtins-0929.yaml similarity index 100% rename from test/cases/testdata/base64builtins/test-base64builtins-0929.yaml rename to test/cases/testdata/v0/base64builtins/test-base64builtins-0929.yaml diff --git a/test/cases/testdata/base64builtins/test-base64builtins-0930.yaml b/test/cases/testdata/v0/base64builtins/test-base64builtins-0930.yaml similarity index 100% rename from test/cases/testdata/base64builtins/test-base64builtins-0930.yaml rename to test/cases/testdata/v0/base64builtins/test-base64builtins-0930.yaml diff --git a/test/cases/testdata/base64builtins/test-base64builtins-0931.yaml b/test/cases/testdata/v0/base64builtins/test-base64builtins-0931.yaml similarity index 100% rename from test/cases/testdata/base64builtins/test-base64builtins-0931.yaml rename to test/cases/testdata/v0/base64builtins/test-base64builtins-0931.yaml diff --git a/test/cases/testdata/base64builtins/test-base64builtins-0932.yaml b/test/cases/testdata/v0/base64builtins/test-base64builtins-0932.yaml similarity index 100% rename from test/cases/testdata/base64builtins/test-base64builtins-0932.yaml rename to test/cases/testdata/v0/base64builtins/test-base64builtins-0932.yaml diff --git a/test/cases/testdata/base64builtins/test-base64builtins-0933.yaml b/test/cases/testdata/v0/base64builtins/test-base64builtins-0933.yaml similarity index 100% rename from test/cases/testdata/base64builtins/test-base64builtins-0933.yaml rename to test/cases/testdata/v0/base64builtins/test-base64builtins-0933.yaml diff --git a/test/cases/testdata/base64builtins/test-base64builtins-0934.yaml b/test/cases/testdata/v0/base64builtins/test-base64builtins-0934.yaml similarity index 100% rename from test/cases/testdata/base64builtins/test-base64builtins-0934.yaml rename to test/cases/testdata/v0/base64builtins/test-base64builtins-0934.yaml diff --git a/test/cases/testdata/base64builtins/test-base64builtins-0935.yaml b/test/cases/testdata/v0/base64builtins/test-base64builtins-0935.yaml similarity index 100% rename from test/cases/testdata/base64builtins/test-base64builtins-0935.yaml rename to test/cases/testdata/v0/base64builtins/test-base64builtins-0935.yaml diff --git a/test/cases/testdata/base64urlbuiltins/test-base64urlbuiltins-0935.yaml b/test/cases/testdata/v0/base64urlbuiltins/test-base64urlbuiltins-0935.yaml similarity index 100% rename from test/cases/testdata/base64urlbuiltins/test-base64urlbuiltins-0935.yaml rename to test/cases/testdata/v0/base64urlbuiltins/test-base64urlbuiltins-0935.yaml diff --git a/test/cases/testdata/base64urlbuiltins/test-base64urlbuiltins-0937.yaml b/test/cases/testdata/v0/base64urlbuiltins/test-base64urlbuiltins-0937.yaml similarity index 100% rename from test/cases/testdata/base64urlbuiltins/test-base64urlbuiltins-0937.yaml rename to test/cases/testdata/v0/base64urlbuiltins/test-base64urlbuiltins-0937.yaml diff --git a/test/cases/testdata/base64urlbuiltins/test-base64urlbuiltins-0939.yaml b/test/cases/testdata/v0/base64urlbuiltins/test-base64urlbuiltins-0939.yaml similarity index 100% rename from test/cases/testdata/base64urlbuiltins/test-base64urlbuiltins-0939.yaml rename to test/cases/testdata/v0/base64urlbuiltins/test-base64urlbuiltins-0939.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0695.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0695.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0695.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0695.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0696.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0696.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0696.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0696.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0697.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0697.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0697.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0697.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0698.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0698.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0698.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0698.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0699.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0699.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0699.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0699.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0700.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0700.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0700.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0700.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0701.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0701.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0701.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0701.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0702.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0702.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0702.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0702.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0703.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0703.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0703.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0703.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0704.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0704.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0704.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0704.yaml diff --git a/test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0705.yaml b/test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0705.yaml similarity index 100% rename from test/cases/testdata/baseandvirtualdocs/test-baseandvirtualdocs-0705.yaml rename to test/cases/testdata/v0/baseandvirtualdocs/test-baseandvirtualdocs-0705.yaml diff --git a/test/cases/testdata/bitsand/test-bitsand-0055.yaml b/test/cases/testdata/v0/bitsand/test-bitsand-0055.yaml similarity index 100% rename from test/cases/testdata/bitsand/test-bitsand-0055.yaml rename to test/cases/testdata/v0/bitsand/test-bitsand-0055.yaml diff --git a/test/cases/testdata/bitsand/test-bitsand-0056.yaml b/test/cases/testdata/v0/bitsand/test-bitsand-0056.yaml similarity index 100% rename from test/cases/testdata/bitsand/test-bitsand-0056.yaml rename to test/cases/testdata/v0/bitsand/test-bitsand-0056.yaml diff --git a/test/cases/testdata/bitsand/test-bitsand-0057.yaml b/test/cases/testdata/v0/bitsand/test-bitsand-0057.yaml similarity index 100% rename from test/cases/testdata/bitsand/test-bitsand-0057.yaml rename to test/cases/testdata/v0/bitsand/test-bitsand-0057.yaml diff --git a/test/cases/testdata/bitsnegate/test-bitsnegate-0058.yaml b/test/cases/testdata/v0/bitsnegate/test-bitsnegate-0058.yaml similarity index 100% rename from test/cases/testdata/bitsnegate/test-bitsnegate-0058.yaml rename to test/cases/testdata/v0/bitsnegate/test-bitsnegate-0058.yaml diff --git a/test/cases/testdata/bitsnegate/test-bitsnegate-0059.yaml b/test/cases/testdata/v0/bitsnegate/test-bitsnegate-0059.yaml similarity index 100% rename from test/cases/testdata/bitsnegate/test-bitsnegate-0059.yaml rename to test/cases/testdata/v0/bitsnegate/test-bitsnegate-0059.yaml diff --git a/test/cases/testdata/bitsor/test-bitsor-0052.yaml b/test/cases/testdata/v0/bitsor/test-bitsor-0052.yaml similarity index 100% rename from test/cases/testdata/bitsor/test-bitsor-0052.yaml rename to test/cases/testdata/v0/bitsor/test-bitsor-0052.yaml diff --git a/test/cases/testdata/bitsor/test-bitsor-0053.yaml b/test/cases/testdata/v0/bitsor/test-bitsor-0053.yaml similarity index 100% rename from test/cases/testdata/bitsor/test-bitsor-0053.yaml rename to test/cases/testdata/v0/bitsor/test-bitsor-0053.yaml diff --git a/test/cases/testdata/bitsor/test-bitsor-0054.yaml b/test/cases/testdata/v0/bitsor/test-bitsor-0054.yaml similarity index 100% rename from test/cases/testdata/bitsor/test-bitsor-0054.yaml rename to test/cases/testdata/v0/bitsor/test-bitsor-0054.yaml diff --git a/test/cases/testdata/bitsshiftleft/test-bitsshiftleft-0063.yaml b/test/cases/testdata/v0/bitsshiftleft/test-bitsshiftleft-0063.yaml similarity index 100% rename from test/cases/testdata/bitsshiftleft/test-bitsshiftleft-0063.yaml rename to test/cases/testdata/v0/bitsshiftleft/test-bitsshiftleft-0063.yaml diff --git a/test/cases/testdata/bitsshiftleft/test-bitsshiftleft-0064.yaml b/test/cases/testdata/v0/bitsshiftleft/test-bitsshiftleft-0064.yaml similarity index 100% rename from test/cases/testdata/bitsshiftleft/test-bitsshiftleft-0064.yaml rename to test/cases/testdata/v0/bitsshiftleft/test-bitsshiftleft-0064.yaml diff --git a/test/cases/testdata/bitsshiftleft/test-bitsshiftleft-0065.yaml b/test/cases/testdata/v0/bitsshiftleft/test-bitsshiftleft-0065.yaml similarity index 100% rename from test/cases/testdata/bitsshiftleft/test-bitsshiftleft-0065.yaml rename to test/cases/testdata/v0/bitsshiftleft/test-bitsshiftleft-0065.yaml diff --git a/test/cases/testdata/bitsshiftleft/test-bitsshiftleft-0066.yaml b/test/cases/testdata/v0/bitsshiftleft/test-bitsshiftleft-0066.yaml similarity index 100% rename from test/cases/testdata/bitsshiftleft/test-bitsshiftleft-0066.yaml rename to test/cases/testdata/v0/bitsshiftleft/test-bitsshiftleft-0066.yaml diff --git a/test/cases/testdata/bitsshiftleft/test-bitsshiftleft-0067.yaml b/test/cases/testdata/v0/bitsshiftleft/test-bitsshiftleft-0067.yaml similarity index 100% rename from test/cases/testdata/bitsshiftleft/test-bitsshiftleft-0067.yaml rename to test/cases/testdata/v0/bitsshiftleft/test-bitsshiftleft-0067.yaml diff --git a/test/cases/testdata/bitsshiftright/test-bitsshiftright-0068.yaml b/test/cases/testdata/v0/bitsshiftright/test-bitsshiftright-0068.yaml similarity index 100% rename from test/cases/testdata/bitsshiftright/test-bitsshiftright-0068.yaml rename to test/cases/testdata/v0/bitsshiftright/test-bitsshiftright-0068.yaml diff --git a/test/cases/testdata/bitsshiftright/test-bitsshiftright-0069.yaml b/test/cases/testdata/v0/bitsshiftright/test-bitsshiftright-0069.yaml similarity index 100% rename from test/cases/testdata/bitsshiftright/test-bitsshiftright-0069.yaml rename to test/cases/testdata/v0/bitsshiftright/test-bitsshiftright-0069.yaml diff --git a/test/cases/testdata/bitsshiftright/test-bitsshiftright-0070.yaml b/test/cases/testdata/v0/bitsshiftright/test-bitsshiftright-0070.yaml similarity index 100% rename from test/cases/testdata/bitsshiftright/test-bitsshiftright-0070.yaml rename to test/cases/testdata/v0/bitsshiftright/test-bitsshiftright-0070.yaml diff --git a/test/cases/testdata/bitsxor/test-bitsxor-0060.yaml b/test/cases/testdata/v0/bitsxor/test-bitsxor-0060.yaml similarity index 100% rename from test/cases/testdata/bitsxor/test-bitsxor-0060.yaml rename to test/cases/testdata/v0/bitsxor/test-bitsxor-0060.yaml diff --git a/test/cases/testdata/bitsxor/test-bitsxor-0061.yaml b/test/cases/testdata/v0/bitsxor/test-bitsxor-0061.yaml similarity index 100% rename from test/cases/testdata/bitsxor/test-bitsxor-0061.yaml rename to test/cases/testdata/v0/bitsxor/test-bitsxor-0061.yaml diff --git a/test/cases/testdata/bitsxor/test-bitsxor-0062.yaml b/test/cases/testdata/v0/bitsxor/test-bitsxor-0062.yaml similarity index 100% rename from test/cases/testdata/bitsxor/test-bitsxor-0062.yaml rename to test/cases/testdata/v0/bitsxor/test-bitsxor-0062.yaml diff --git a/test/cases/testdata/casts/test-casts-0077.yaml b/test/cases/testdata/v0/casts/test-casts-0077.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0077.yaml rename to test/cases/testdata/v0/casts/test-casts-0077.yaml diff --git a/test/cases/testdata/casts/test-casts-0078.yaml b/test/cases/testdata/v0/casts/test-casts-0078.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0078.yaml rename to test/cases/testdata/v0/casts/test-casts-0078.yaml diff --git a/test/cases/testdata/casts/test-casts-0079.yaml b/test/cases/testdata/v0/casts/test-casts-0079.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0079.yaml rename to test/cases/testdata/v0/casts/test-casts-0079.yaml diff --git a/test/cases/testdata/casts/test-casts-0080.yaml b/test/cases/testdata/v0/casts/test-casts-0080.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0080.yaml rename to test/cases/testdata/v0/casts/test-casts-0080.yaml diff --git a/test/cases/testdata/casts/test-casts-0081.yaml b/test/cases/testdata/v0/casts/test-casts-0081.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0081.yaml rename to test/cases/testdata/v0/casts/test-casts-0081.yaml diff --git a/test/cases/testdata/casts/test-casts-0082.yaml b/test/cases/testdata/v0/casts/test-casts-0082.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0082.yaml rename to test/cases/testdata/v0/casts/test-casts-0082.yaml diff --git a/test/cases/testdata/casts/test-casts-0083.yaml b/test/cases/testdata/v0/casts/test-casts-0083.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0083.yaml rename to test/cases/testdata/v0/casts/test-casts-0083.yaml diff --git a/test/cases/testdata/casts/test-casts-0824.yaml b/test/cases/testdata/v0/casts/test-casts-0824.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0824.yaml rename to test/cases/testdata/v0/casts/test-casts-0824.yaml diff --git a/test/cases/testdata/casts/test-casts-0825.yaml b/test/cases/testdata/v0/casts/test-casts-0825.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0825.yaml rename to test/cases/testdata/v0/casts/test-casts-0825.yaml diff --git a/test/cases/testdata/casts/test-casts-0826.yaml b/test/cases/testdata/v0/casts/test-casts-0826.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0826.yaml rename to test/cases/testdata/v0/casts/test-casts-0826.yaml diff --git a/test/cases/testdata/casts/test-casts-0827.yaml b/test/cases/testdata/v0/casts/test-casts-0827.yaml similarity index 100% rename from test/cases/testdata/casts/test-casts-0827.yaml rename to test/cases/testdata/v0/casts/test-casts-0827.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0608.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0608.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0608.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0608.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0609.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0609.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0609.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0609.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0610.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0610.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0610.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0610.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0611.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0611.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0611.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0611.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0612.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0612.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0612.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0612.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0613.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0613.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0613.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0613.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0614.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0614.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0614.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0614.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0615.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0615.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0615.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0615.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0616.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0616.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0616.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0616.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0617.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0617.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0617.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0617.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0618.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0618.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0618.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0618.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0619.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0619.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0619.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0619.yaml diff --git a/test/cases/testdata/comparisonexpr/test-comparisonexpr-0620.yaml b/test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0620.yaml similarity index 100% rename from test/cases/testdata/comparisonexpr/test-comparisonexpr-0620.yaml rename to test/cases/testdata/v0/comparisonexpr/test-comparisonexpr-0620.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0495.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0495.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0495.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0495.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0496.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0496.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0496.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0496.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0497.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0497.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0497.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0497.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0498.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0498.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0498.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0498.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0499.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0499.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0499.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0499.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0500.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0500.yaml similarity index 83% rename from test/cases/testdata/completedoc/test-completedoc-0500.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0500.yaml index 00fa23a129..7109c5a0b6 100644 --- a/test/cases/testdata/completedoc/test-completedoc-0500.yaml +++ b/test/cases/testdata/v0/completedoc/test-completedoc-0500.yaml @@ -5,8 +5,8 @@ cases: - | package generated - p = 3 + p = 3.0 note: "completedoc/number: 3.0" query: data.generated.p = x want_result: - - x: 3 + - x: 3.0 diff --git a/test/cases/testdata/completedoc/test-completedoc-0501.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0501.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0501.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0501.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0502.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0502.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0502.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0502.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0503.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0503.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0503.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0503.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0504.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0504.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0504.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0504.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0505.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0505.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0505.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0505.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0506.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0506.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0506.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0506.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0507.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0507.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0507.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0507.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0508.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0508.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0508.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0508.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0509.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0509.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0509.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0509.yaml diff --git a/test/cases/testdata/completedoc/test-completedoc-0510.yaml b/test/cases/testdata/v0/completedoc/test-completedoc-0510.yaml similarity index 100% rename from test/cases/testdata/completedoc/test-completedoc-0510.yaml rename to test/cases/testdata/v0/completedoc/test-completedoc-0510.yaml diff --git a/test/cases/testdata/compositebasedereference/test-compositebasedereference-1073.yaml b/test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1073.yaml similarity index 100% rename from test/cases/testdata/compositebasedereference/test-compositebasedereference-1073.yaml rename to test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1073.yaml diff --git a/test/cases/testdata/compositebasedereference/test-compositebasedereference-1074.yaml b/test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1074.yaml similarity index 100% rename from test/cases/testdata/compositebasedereference/test-compositebasedereference-1074.yaml rename to test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1074.yaml diff --git a/test/cases/testdata/compositebasedereference/test-compositebasedereference-1075.yaml b/test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1075.yaml similarity index 100% rename from test/cases/testdata/compositebasedereference/test-compositebasedereference-1075.yaml rename to test/cases/testdata/v0/compositebasedereference/test-compositebasedereference-1075.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0743.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0743.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0743.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0743.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0744.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0744.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0744.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0744.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0745.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0745.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0745.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0745.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0746.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0746.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0746.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0746.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0747.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0747.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0747.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0747.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0748.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0748.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0748.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0748.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0749.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0749.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0749.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0749.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0750.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0750.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0750.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0750.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0751.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0751.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0751.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0751.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0752.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0752.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0752.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0752.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0753.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0753.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0753.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0753.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0754.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0754.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0754.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0754.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0755.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0755.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0755.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0755.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0756.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0756.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0756.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0756.yaml diff --git a/test/cases/testdata/compositereferences/test-compositereferences-0757.yaml b/test/cases/testdata/v0/compositereferences/test-compositereferences-0757.yaml similarity index 100% rename from test/cases/testdata/compositereferences/test-compositereferences-0757.yaml rename to test/cases/testdata/v0/compositereferences/test-compositereferences-0757.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0781.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0781.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0781.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0781.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0782.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0782.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0782.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0782.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0783.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0783.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0783.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0783.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0784.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0784.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0784.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0784.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0785.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0785.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0785.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0785.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0786.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0786.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0786.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0786.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0787.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0787.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0787.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0787.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0788.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0788.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0788.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0788.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0789.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0789.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0789.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0789.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0790.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0790.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0790.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0790.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0791.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0791.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0791.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0791.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0792.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0792.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0792.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0792.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0793.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0793.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0793.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0793.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0794.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0794.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0794.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0794.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0795.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0795.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0795.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0795.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0796.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0796.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0796.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0796.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0797.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0797.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0797.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0797.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0798.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0798.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0798.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0798.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0799.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0799.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0799.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0799.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0800.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0800.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0800.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0800.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0801.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0801.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0801.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0801.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0802.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0802.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0802.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0802.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-0803.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-0803.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-0803.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-0803.yaml diff --git a/test/cases/testdata/comprehensions/test-comprehensions-and-vars.yaml b/test/cases/testdata/v0/comprehensions/test-comprehensions-and-vars.yaml similarity index 100% rename from test/cases/testdata/comprehensions/test-comprehensions-and-vars.yaml rename to test/cases/testdata/v0/comprehensions/test-comprehensions-and-vars.yaml diff --git a/test/cases/testdata/containskeyword/test-contains-future-keyword.yaml b/test/cases/testdata/v0/containskeyword/test-contains-future-keyword.yaml similarity index 100% rename from test/cases/testdata/containskeyword/test-contains-future-keyword.yaml rename to test/cases/testdata/v0/containskeyword/test-contains-future-keyword.yaml diff --git a/test/cases/testdata/cryptohmacequal/test-cryptohmacequal.yaml b/test/cases/testdata/v0/cryptohmacequal/test-cryptohmacequal.yaml similarity index 100% rename from test/cases/testdata/cryptohmacequal/test-cryptohmacequal.yaml rename to test/cases/testdata/v0/cryptohmacequal/test-cryptohmacequal.yaml diff --git a/test/cases/testdata/cryptohmacmd5/test-cryptohmacmd5.yaml b/test/cases/testdata/v0/cryptohmacmd5/test-cryptohmacmd5.yaml similarity index 100% rename from test/cases/testdata/cryptohmacmd5/test-cryptohmacmd5.yaml rename to test/cases/testdata/v0/cryptohmacmd5/test-cryptohmacmd5.yaml diff --git a/test/cases/testdata/cryptohmacsha1/test-cryptohmacsha1.yaml b/test/cases/testdata/v0/cryptohmacsha1/test-cryptohmacsha1.yaml similarity index 100% rename from test/cases/testdata/cryptohmacsha1/test-cryptohmacsha1.yaml rename to test/cases/testdata/v0/cryptohmacsha1/test-cryptohmacsha1.yaml diff --git a/test/cases/testdata/cryptohmacsha256/test-cryptohmacsha256.yaml b/test/cases/testdata/v0/cryptohmacsha256/test-cryptohmacsha256.yaml similarity index 100% rename from test/cases/testdata/cryptohmacsha256/test-cryptohmacsha256.yaml rename to test/cases/testdata/v0/cryptohmacsha256/test-cryptohmacsha256.yaml diff --git a/test/cases/testdata/cryptohmacsha512/test-cryptohmacsha512.yaml b/test/cases/testdata/v0/cryptohmacsha512/test-cryptohmacsha512.yaml similarity index 100% rename from test/cases/testdata/cryptohmacsha512/test-cryptohmacsha512.yaml rename to test/cases/testdata/v0/cryptohmacsha512/test-cryptohmacsha512.yaml diff --git a/test/cases/testdata/cryptomd5/test-cryptomd5-0130.yaml b/test/cases/testdata/v0/cryptomd5/test-cryptomd5-0130.yaml similarity index 100% rename from test/cases/testdata/cryptomd5/test-cryptomd5-0130.yaml rename to test/cases/testdata/v0/cryptomd5/test-cryptomd5-0130.yaml diff --git a/test/cases/testdata/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml b/test/cases/testdata/v0/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml similarity index 100% rename from test/cases/testdata/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml rename to test/cases/testdata/v0/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml diff --git a/test/cases/testdata/cryptosha1/test-cryptosha1-0131.yaml b/test/cases/testdata/v0/cryptosha1/test-cryptosha1-0131.yaml similarity index 100% rename from test/cases/testdata/cryptosha1/test-cryptosha1-0131.yaml rename to test/cases/testdata/v0/cryptosha1/test-cryptosha1-0131.yaml diff --git a/test/cases/testdata/cryptosha256/test-cryptosha256-0132.yaml b/test/cases/testdata/v0/cryptosha256/test-cryptosha256-0132.yaml similarity index 100% rename from test/cases/testdata/cryptosha256/test-cryptosha256-0132.yaml rename to test/cases/testdata/v0/cryptosha256/test-cryptosha256-0132.yaml diff --git a/test/cases/testdata/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml b/test/cases/testdata/v0/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml similarity index 100% rename from test/cases/testdata/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml rename to test/cases/testdata/v0/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml diff --git a/test/cases/testdata/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml b/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml rename to test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml diff --git a/test/cases/testdata/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml b/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml rename to test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml diff --git a/test/cases/testdata/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml b/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml rename to test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml diff --git a/test/cases/testdata/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml b/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml rename to test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml diff --git a/test/cases/testdata/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml b/test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml rename to test/cases/testdata/v0/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml diff --git a/test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml b/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml rename to test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml diff --git a/test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml b/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml rename to test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml diff --git a/test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml b/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml rename to test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml diff --git a/test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml b/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml rename to test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml diff --git a/test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml b/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml rename to test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml diff --git a/test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml b/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml rename to test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml diff --git a/test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml b/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml rename to test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml diff --git a/test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml b/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml rename to test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml diff --git a/test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml b/test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml rename to test/cases/testdata/v0/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml diff --git a/test/cases/testdata/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml b/test/cases/testdata/v0/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml rename to test/cases/testdata/v0/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml diff --git a/test/cases/testdata/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml b/test/cases/testdata/v0/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml rename to test/cases/testdata/v0/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml diff --git a/test/cases/testdata/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml b/test/cases/testdata/v0/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml similarity index 100% rename from test/cases/testdata/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml rename to test/cases/testdata/v0/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml diff --git a/test/cases/testdata/dataderef/test-data-derefs.yaml b/test/cases/testdata/v0/dataderef/test-data-derefs.yaml similarity index 100% rename from test/cases/testdata/dataderef/test-data-derefs.yaml rename to test/cases/testdata/v0/dataderef/test-data-derefs.yaml diff --git a/test/cases/testdata/defaultkeyword/test-default-functions.yaml b/test/cases/testdata/v0/defaultkeyword/test-default-functions.yaml similarity index 100% rename from test/cases/testdata/defaultkeyword/test-default-functions.yaml rename to test/cases/testdata/v0/defaultkeyword/test-default-functions.yaml diff --git a/test/cases/testdata/defaultkeyword/test-defaultkeyword-0804.yaml b/test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0804.yaml similarity index 100% rename from test/cases/testdata/defaultkeyword/test-defaultkeyword-0804.yaml rename to test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0804.yaml diff --git a/test/cases/testdata/defaultkeyword/test-defaultkeyword-0805.yaml b/test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0805.yaml similarity index 100% rename from test/cases/testdata/defaultkeyword/test-defaultkeyword-0805.yaml rename to test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0805.yaml diff --git a/test/cases/testdata/defaultkeyword/test-defaultkeyword-0806.yaml b/test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0806.yaml similarity index 100% rename from test/cases/testdata/defaultkeyword/test-defaultkeyword-0806.yaml rename to test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0806.yaml diff --git a/test/cases/testdata/defaultkeyword/test-defaultkeyword-0807.yaml b/test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0807.yaml similarity index 100% rename from test/cases/testdata/defaultkeyword/test-defaultkeyword-0807.yaml rename to test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0807.yaml diff --git a/test/cases/testdata/defaultkeyword/test-defaultkeyword-0808.yaml b/test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0808.yaml similarity index 100% rename from test/cases/testdata/defaultkeyword/test-defaultkeyword-0808.yaml rename to test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0808.yaml diff --git a/test/cases/testdata/defaultkeyword/test-defaultkeyword-0809.yaml b/test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0809.yaml similarity index 100% rename from test/cases/testdata/defaultkeyword/test-defaultkeyword-0809.yaml rename to test/cases/testdata/v0/defaultkeyword/test-defaultkeyword-0809.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0763.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0763.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0763.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0763.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0764.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0764.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0764.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0764.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0765.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0765.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0765.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0765.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0766.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0766.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0766.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0766.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0767.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0767.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0767.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0767.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0768.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0768.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0768.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0768.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0769.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0769.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0769.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0769.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0770.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0770.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0770.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0770.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0771.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0771.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0771.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0771.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0772.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0772.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0772.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0772.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0773.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0773.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0773.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0773.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0774.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0774.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0774.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0774.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0775.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0775.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0775.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0775.yaml diff --git a/test/cases/testdata/disjunction/test-disjunction-0776.yaml b/test/cases/testdata/v0/disjunction/test-disjunction-0776.yaml similarity index 100% rename from test/cases/testdata/disjunction/test-disjunction-0776.yaml rename to test/cases/testdata/v0/disjunction/test-disjunction-0776.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1054.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1054.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1054.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1054.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1055.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1055.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1055.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1055.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1056.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1056.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1056.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1056.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1057.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1057.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1057.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1057.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1058.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1058.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1058.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1058.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1059.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1059.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1059.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1059.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1060.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1060.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1060.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1060.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1061.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1061.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1061.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1061.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1062.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1062.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1062.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1062.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1063.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1063.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1063.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1063.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1064.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1064.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1064.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1064.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1065.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1065.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1065.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1065.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1066.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1066.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1066.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1066.yaml diff --git a/test/cases/testdata/elsekeyword/test-elsekeyword-1067.yaml b/test/cases/testdata/v0/elsekeyword/test-elsekeyword-1067.yaml similarity index 100% rename from test/cases/testdata/elsekeyword/test-elsekeyword-1067.yaml rename to test/cases/testdata/v0/elsekeyword/test-elsekeyword-1067.yaml diff --git a/test/cases/testdata/embeddedvirtualdoc/test-embeddedvirtualdoc-0976.yaml b/test/cases/testdata/v0/embeddedvirtualdoc/test-embeddedvirtualdoc-0976.yaml similarity index 100% rename from test/cases/testdata/embeddedvirtualdoc/test-embeddedvirtualdoc-0976.yaml rename to test/cases/testdata/v0/embeddedvirtualdoc/test-embeddedvirtualdoc-0976.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0545.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0545.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0545.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0545.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0546.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0546.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0546.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0546.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0547.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0547.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0547.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0547.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0548.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0548.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0548.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0548.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0549.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0549.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0549.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0549.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0550.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0550.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0550.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0550.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0551.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0551.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0551.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0551.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0552.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0552.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0552.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0552.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0553.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0553.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0553.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0553.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0554.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0554.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0554.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0554.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0555.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0555.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0555.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0555.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0556.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0556.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0556.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0556.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0557.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0557.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0557.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0557.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0558.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0558.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0558.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0558.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0559.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0559.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0559.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0559.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0560.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0560.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0560.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0560.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0561.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0561.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0561.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0561.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0562.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0562.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0562.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0562.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0563.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0563.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0563.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0563.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0564.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0564.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0564.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0564.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0565.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0565.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0565.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0565.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0566.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0566.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0566.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0566.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0567.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0567.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0567.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0567.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0568.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0568.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0568.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0568.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0569.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0569.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0569.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0569.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0570.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0570.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0570.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0570.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0571.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0571.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0571.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0571.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0572.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0572.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0572.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0572.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0573.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0573.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0573.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0573.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0574.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0574.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0574.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0574.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0575.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0575.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0575.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0575.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0576.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0576.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0576.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0576.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0577.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0577.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0577.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0577.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0578.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0578.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0578.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0578.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0579.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0579.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0579.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0579.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0580.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0580.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0580.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0580.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0581.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0581.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0581.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0581.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0582.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0582.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0582.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0582.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0583.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0583.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0583.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0583.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0584.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0584.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0584.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0584.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0585.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0585.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0585.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0585.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0586.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0586.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0586.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0586.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0587.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0587.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0587.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0587.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0588.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0588.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0588.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0588.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0589.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0589.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0589.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0589.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0590.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0590.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0590.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0590.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0591.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0591.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0591.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0591.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0592.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0592.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0592.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0592.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0593.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0593.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0593.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0593.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0594.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0594.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0594.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0594.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0595.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0595.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0595.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0595.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0596.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0596.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0596.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0596.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0597.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0597.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0597.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0597.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0598.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0598.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0598.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0598.yaml diff --git a/test/cases/testdata/eqexpr/test-eqexpr-0599.yaml b/test/cases/testdata/v0/eqexpr/test-eqexpr-0599.yaml similarity index 100% rename from test/cases/testdata/eqexpr/test-eqexpr-0599.yaml rename to test/cases/testdata/v0/eqexpr/test-eqexpr-0599.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0525.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0525.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0525.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0525.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0526.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0526.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0526.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0526.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0527.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0527.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0527.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0527.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0528.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0528.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0528.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0528.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0529.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0529.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0529.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0529.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0530.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0530.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0530.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0530.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0531.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0531.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0531.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0531.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0532.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0532.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0532.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0532.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0533.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0533.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0533.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0533.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0534.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0534.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0534.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0534.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0535.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0535.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0535.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0535.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0536.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0536.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0536.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0536.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0537.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0537.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0537.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0537.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0538.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0538.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0538.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0538.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0539.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0539.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0539.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0539.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0540.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0540.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0540.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0540.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0541.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0541.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0541.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0541.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0542.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0542.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0542.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0542.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0543.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0543.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0543.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0543.yaml diff --git a/test/cases/testdata/evaltermexpr/test-evaltermexpr-0544.yaml b/test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0544.yaml similarity index 100% rename from test/cases/testdata/evaltermexpr/test-evaltermexpr-0544.yaml rename to test/cases/testdata/v0/evaltermexpr/test-evaltermexpr-0544.yaml diff --git a/test/cases/testdata/every/every.yaml b/test/cases/testdata/v0/every/every.yaml similarity index 100% rename from test/cases/testdata/every/every.yaml rename to test/cases/testdata/v0/every/every.yaml diff --git a/test/cases/testdata/every/non_iterable_domain.yaml b/test/cases/testdata/v0/every/non_iterable_domain.yaml similarity index 100% rename from test/cases/testdata/every/non_iterable_domain.yaml rename to test/cases/testdata/v0/every/non_iterable_domain.yaml diff --git a/test/cases/testdata/every/textbook.yaml b/test/cases/testdata/v0/every/textbook.yaml similarity index 100% rename from test/cases/testdata/every/textbook.yaml rename to test/cases/testdata/v0/every/textbook.yaml diff --git a/test/cases/testdata/example/test-example-1070.yaml b/test/cases/testdata/v0/example/test-example-1070.yaml similarity index 100% rename from test/cases/testdata/example/test-example-1070.yaml rename to test/cases/testdata/v0/example/test-example-1070.yaml diff --git a/test/cases/testdata/example/test-example-1071.yaml b/test/cases/testdata/v0/example/test-example-1071.yaml similarity index 100% rename from test/cases/testdata/example/test-example-1071.yaml rename to test/cases/testdata/v0/example/test-example-1071.yaml diff --git a/test/cases/testdata/example/test-example-1072.yaml b/test/cases/testdata/v0/example/test-example-1072.yaml similarity index 100% rename from test/cases/testdata/example/test-example-1072.yaml rename to test/cases/testdata/v0/example/test-example-1072.yaml diff --git a/test/cases/testdata/fix1863/test-fix1863-0706.yaml b/test/cases/testdata/v0/fix1863/test-fix1863-0706.yaml similarity index 100% rename from test/cases/testdata/fix1863/test-fix1863-0706.yaml rename to test/cases/testdata/v0/fix1863/test-fix1863-0706.yaml diff --git a/test/cases/testdata/fix1863/test-fix1863-0707.yaml b/test/cases/testdata/v0/fix1863/test-fix1863-0707.yaml similarity index 100% rename from test/cases/testdata/fix1863/test-fix1863-0707.yaml rename to test/cases/testdata/v0/fix1863/test-fix1863-0707.yaml diff --git a/test/cases/testdata/fix1863/test-fix1863-0708.yaml b/test/cases/testdata/v0/fix1863/test-fix1863-0708.yaml similarity index 100% rename from test/cases/testdata/fix1863/test-fix1863-0708.yaml rename to test/cases/testdata/v0/fix1863/test-fix1863-0708.yaml diff --git a/test/cases/testdata/functionerrors/test-conflicts.yaml b/test/cases/testdata/v0/functionerrors/test-conflicts.yaml similarity index 100% rename from test/cases/testdata/functionerrors/test-conflicts.yaml rename to test/cases/testdata/v0/functionerrors/test-conflicts.yaml diff --git a/test/cases/testdata/functionerrors/test-functionerrors-1012.yaml b/test/cases/testdata/v0/functionerrors/test-functionerrors-1012.yaml similarity index 100% rename from test/cases/testdata/functionerrors/test-functionerrors-1012.yaml rename to test/cases/testdata/v0/functionerrors/test-functionerrors-1012.yaml diff --git a/test/cases/testdata/functionerrors/test-functionerrors-1013.yaml b/test/cases/testdata/v0/functionerrors/test-functionerrors-1013.yaml similarity index 100% rename from test/cases/testdata/functionerrors/test-functionerrors-1013.yaml rename to test/cases/testdata/v0/functionerrors/test-functionerrors-1013.yaml diff --git a/test/cases/testdata/functionerrors/test-functionerrors-1014.yaml b/test/cases/testdata/v0/functionerrors/test-functionerrors-1014.yaml similarity index 100% rename from test/cases/testdata/functionerrors/test-functionerrors-1014.yaml rename to test/cases/testdata/v0/functionerrors/test-functionerrors-1014.yaml diff --git a/test/cases/testdata/functionerrors/test-functionerrors-undefined-builtin-result.yaml b/test/cases/testdata/v0/functionerrors/test-functionerrors-undefined-builtin-result.yaml similarity index 100% rename from test/cases/testdata/functionerrors/test-functionerrors-undefined-builtin-result.yaml rename to test/cases/testdata/v0/functionerrors/test-functionerrors-undefined-builtin-result.yaml diff --git a/test/cases/testdata/functions/test-functions-0990.yaml b/test/cases/testdata/v0/functions/test-functions-0990.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-0990.yaml rename to test/cases/testdata/v0/functions/test-functions-0990.yaml diff --git a/test/cases/testdata/functions/test-functions-0991.yaml b/test/cases/testdata/v0/functions/test-functions-0991.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-0991.yaml rename to test/cases/testdata/v0/functions/test-functions-0991.yaml diff --git a/test/cases/testdata/functions/test-functions-0992.yaml b/test/cases/testdata/v0/functions/test-functions-0992.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-0992.yaml rename to test/cases/testdata/v0/functions/test-functions-0992.yaml diff --git a/test/cases/testdata/functions/test-functions-0993.yaml b/test/cases/testdata/v0/functions/test-functions-0993.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-0993.yaml rename to test/cases/testdata/v0/functions/test-functions-0993.yaml diff --git a/test/cases/testdata/functions/test-functions-0994.yaml b/test/cases/testdata/v0/functions/test-functions-0994.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-0994.yaml rename to test/cases/testdata/v0/functions/test-functions-0994.yaml diff --git a/test/cases/testdata/functions/test-functions-0995.yaml b/test/cases/testdata/v0/functions/test-functions-0995.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-0995.yaml rename to test/cases/testdata/v0/functions/test-functions-0995.yaml diff --git a/test/cases/testdata/functions/test-functions-0996.yaml b/test/cases/testdata/v0/functions/test-functions-0996.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-0996.yaml rename to test/cases/testdata/v0/functions/test-functions-0996.yaml diff --git a/test/cases/testdata/functions/test-functions-0997.yaml b/test/cases/testdata/v0/functions/test-functions-0997.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-0997.yaml rename to test/cases/testdata/v0/functions/test-functions-0997.yaml diff --git a/test/cases/testdata/functions/test-functions-0998.yaml b/test/cases/testdata/v0/functions/test-functions-0998.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-0998.yaml rename to test/cases/testdata/v0/functions/test-functions-0998.yaml diff --git a/test/cases/testdata/functions/test-functions-0999.yaml b/test/cases/testdata/v0/functions/test-functions-0999.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-0999.yaml rename to test/cases/testdata/v0/functions/test-functions-0999.yaml diff --git a/test/cases/testdata/functions/test-functions-1000.yaml b/test/cases/testdata/v0/functions/test-functions-1000.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1000.yaml rename to test/cases/testdata/v0/functions/test-functions-1000.yaml diff --git a/test/cases/testdata/functions/test-functions-1001.yaml b/test/cases/testdata/v0/functions/test-functions-1001.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1001.yaml rename to test/cases/testdata/v0/functions/test-functions-1001.yaml diff --git a/test/cases/testdata/functions/test-functions-1002.yaml b/test/cases/testdata/v0/functions/test-functions-1002.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1002.yaml rename to test/cases/testdata/v0/functions/test-functions-1002.yaml diff --git a/test/cases/testdata/functions/test-functions-1003.yaml b/test/cases/testdata/v0/functions/test-functions-1003.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1003.yaml rename to test/cases/testdata/v0/functions/test-functions-1003.yaml diff --git a/test/cases/testdata/functions/test-functions-1004.yaml b/test/cases/testdata/v0/functions/test-functions-1004.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1004.yaml rename to test/cases/testdata/v0/functions/test-functions-1004.yaml diff --git a/test/cases/testdata/functions/test-functions-1005.yaml b/test/cases/testdata/v0/functions/test-functions-1005.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1005.yaml rename to test/cases/testdata/v0/functions/test-functions-1005.yaml diff --git a/test/cases/testdata/functions/test-functions-1006.yaml b/test/cases/testdata/v0/functions/test-functions-1006.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1006.yaml rename to test/cases/testdata/v0/functions/test-functions-1006.yaml diff --git a/test/cases/testdata/functions/test-functions-1007.yaml b/test/cases/testdata/v0/functions/test-functions-1007.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1007.yaml rename to test/cases/testdata/v0/functions/test-functions-1007.yaml diff --git a/test/cases/testdata/functions/test-functions-1008.yaml b/test/cases/testdata/v0/functions/test-functions-1008.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1008.yaml rename to test/cases/testdata/v0/functions/test-functions-1008.yaml diff --git a/test/cases/testdata/functions/test-functions-1009.yaml b/test/cases/testdata/v0/functions/test-functions-1009.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1009.yaml rename to test/cases/testdata/v0/functions/test-functions-1009.yaml diff --git a/test/cases/testdata/functions/test-functions-1010.yaml b/test/cases/testdata/v0/functions/test-functions-1010.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1010.yaml rename to test/cases/testdata/v0/functions/test-functions-1010.yaml diff --git a/test/cases/testdata/functions/test-functions-1011.yaml b/test/cases/testdata/v0/functions/test-functions-1011.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-1011.yaml rename to test/cases/testdata/v0/functions/test-functions-1011.yaml diff --git a/test/cases/testdata/functions/test-functions-default.yaml b/test/cases/testdata/v0/functions/test-functions-default.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-default.yaml rename to test/cases/testdata/v0/functions/test-functions-default.yaml diff --git a/test/cases/testdata/functions/test-functions-nested-with-early-exit.yaml b/test/cases/testdata/v0/functions/test-functions-nested-with-early-exit.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-nested-with-early-exit.yaml rename to test/cases/testdata/v0/functions/test-functions-nested-with-early-exit.yaml diff --git a/test/cases/testdata/functions/test-functions-unused-arg.yaml b/test/cases/testdata/v0/functions/test-functions-unused-arg.yaml similarity index 100% rename from test/cases/testdata/functions/test-functions-unused-arg.yaml rename to test/cases/testdata/v0/functions/test-functions-unused-arg.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0133.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0133.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0133.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0133.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0134.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0134.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0134.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0134.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0135.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0135.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0135.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0135.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0136.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0136.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0136.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0136.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0137.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0137.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0137.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0137.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0138.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0138.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0138.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0138.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0139.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0139.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0139.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0139.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0140.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0140.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0140.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0140.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0141.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0141.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0141.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0141.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0142.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0142.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0142.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0142.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0143.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0143.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0143.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0143.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0144.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0144.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0144.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0144.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0145.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0145.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0145.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0145.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0146.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0146.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0146.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0146.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0147.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0147.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0147.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0147.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0148.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0148.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0148.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0148.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0149.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0149.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0149.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0149.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0150.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0150.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0150.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0150.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0151.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0151.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0151.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0151.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0152.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0152.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0152.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0152.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0153.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0153.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0153.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0153.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0154.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0154.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0154.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0154.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0155.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0155.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0155.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0155.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0156.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0156.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0156.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0156.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0157.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0157.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0157.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0157.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0158.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0158.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0158.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0158.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-0159.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-0159.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-0159.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-0159.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-issue-5273.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-issue-5273.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-issue-5273.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-issue-5273.yaml diff --git a/test/cases/testdata/globmatch/test-globmatch-issue-5283.yaml b/test/cases/testdata/v0/globmatch/test-globmatch-issue-5283.yaml similarity index 100% rename from test/cases/testdata/globmatch/test-globmatch-issue-5283.yaml rename to test/cases/testdata/v0/globmatch/test-globmatch-issue-5283.yaml diff --git a/test/cases/testdata/globquotemeta/test-globquotemeta-0159.yaml b/test/cases/testdata/v0/globquotemeta/test-globquotemeta-0159.yaml similarity index 100% rename from test/cases/testdata/globquotemeta/test-globquotemeta-0159.yaml rename to test/cases/testdata/v0/globquotemeta/test-globquotemeta-0159.yaml diff --git a/test/cases/testdata/globsmatch/test-globsmatch-0865.yaml b/test/cases/testdata/v0/globsmatch/test-globsmatch-0865.yaml similarity index 100% rename from test/cases/testdata/globsmatch/test-globsmatch-0865.yaml rename to test/cases/testdata/v0/globsmatch/test-globsmatch-0865.yaml diff --git a/test/cases/testdata/globsmatch/test-globsmatch-0866.yaml b/test/cases/testdata/v0/globsmatch/test-globsmatch-0866.yaml similarity index 100% rename from test/cases/testdata/globsmatch/test-globsmatch-0866.yaml rename to test/cases/testdata/v0/globsmatch/test-globsmatch-0866.yaml diff --git a/test/cases/testdata/globsmatch/test-globsmatch-0867.yaml b/test/cases/testdata/v0/globsmatch/test-globsmatch-0867.yaml similarity index 100% rename from test/cases/testdata/globsmatch/test-globsmatch-0867.yaml rename to test/cases/testdata/v0/globsmatch/test-globsmatch-0867.yaml diff --git a/test/cases/testdata/globsmatch/test-globsmatch-0868.yaml b/test/cases/testdata/v0/globsmatch/test-globsmatch-0868.yaml similarity index 100% rename from test/cases/testdata/globsmatch/test-globsmatch-0868.yaml rename to test/cases/testdata/v0/globsmatch/test-globsmatch-0868.yaml diff --git a/test/cases/testdata/globsmatch/test-globsmatch-0869.yaml b/test/cases/testdata/v0/globsmatch/test-globsmatch-0869.yaml similarity index 100% rename from test/cases/testdata/globsmatch/test-globsmatch-0869.yaml rename to test/cases/testdata/v0/globsmatch/test-globsmatch-0869.yaml diff --git a/test/cases/testdata/globsmatch/test-globsmatch-0870.yaml b/test/cases/testdata/v0/globsmatch/test-globsmatch-0870.yaml similarity index 100% rename from test/cases/testdata/globsmatch/test-globsmatch-0870.yaml rename to test/cases/testdata/v0/globsmatch/test-globsmatch-0870.yaml diff --git a/test/cases/testdata/graphql/test-graphql-basic-ast.yaml b/test/cases/testdata/v0/graphql/test-graphql-basic-ast.yaml similarity index 100% rename from test/cases/testdata/graphql/test-graphql-basic-ast.yaml rename to test/cases/testdata/v0/graphql/test-graphql-basic-ast.yaml diff --git a/test/cases/testdata/graphql/test-graphql-is-valid.yaml b/test/cases/testdata/v0/graphql/test-graphql-is-valid.yaml similarity index 100% rename from test/cases/testdata/graphql/test-graphql-is-valid.yaml rename to test/cases/testdata/v0/graphql/test-graphql-is-valid.yaml diff --git a/test/cases/testdata/graphql/test-graphql-parse-and-verify.yaml b/test/cases/testdata/v0/graphql/test-graphql-parse-and-verify.yaml similarity index 100% rename from test/cases/testdata/graphql/test-graphql-parse-and-verify.yaml rename to test/cases/testdata/v0/graphql/test-graphql-parse-and-verify.yaml diff --git a/test/cases/testdata/graphql/test-graphql-parse-query.yaml b/test/cases/testdata/v0/graphql/test-graphql-parse-query.yaml similarity index 100% rename from test/cases/testdata/graphql/test-graphql-parse-query.yaml rename to test/cases/testdata/v0/graphql/test-graphql-parse-query.yaml diff --git a/test/cases/testdata/graphql/test-graphql-parse-schema.yaml b/test/cases/testdata/v0/graphql/test-graphql-parse-schema.yaml similarity index 100% rename from test/cases/testdata/graphql/test-graphql-parse-schema.yaml rename to test/cases/testdata/v0/graphql/test-graphql-parse-schema.yaml diff --git a/test/cases/testdata/graphql/test-graphql-parse.yaml b/test/cases/testdata/v0/graphql/test-graphql-parse.yaml similarity index 100% rename from test/cases/testdata/graphql/test-graphql-parse.yaml rename to test/cases/testdata/v0/graphql/test-graphql-parse.yaml diff --git a/test/cases/testdata/graphql/test-graphql-schema-is-valid.yaml b/test/cases/testdata/v0/graphql/test-graphql-schema-is-valid.yaml similarity index 100% rename from test/cases/testdata/graphql/test-graphql-schema-is-valid.yaml rename to test/cases/testdata/v0/graphql/test-graphql-schema-is-valid.yaml diff --git a/test/cases/testdata/helloworld/test-helloworld-1.yaml b/test/cases/testdata/v0/helloworld/test-helloworld-1.yaml similarity index 94% rename from test/cases/testdata/helloworld/test-helloworld-1.yaml rename to test/cases/testdata/v0/helloworld/test-helloworld-1.yaml index 08857eb2f3..4d7d8009c7 100644 --- a/test/cases/testdata/helloworld/test-helloworld-1.yaml +++ b/test/cases/testdata/v0/helloworld/test-helloworld-1.yaml @@ -21,7 +21,7 @@ # test cases. # # The OPA test suite (which is implemented using Go's standard testing framework) discovers tests -# added under ./topdown/testdata/cases. For example, to run only the tests in this file: +# added under ./topdown/testdata/v0/cases. For example, to run only the tests in this file: # # go test ./topdown -v -run 'TestRego/helloworld' # diff --git a/test/cases/testdata/hexbuiltins/test-hexbuiltins-0939.yaml b/test/cases/testdata/v0/hexbuiltins/test-hexbuiltins-0939.yaml similarity index 100% rename from test/cases/testdata/hexbuiltins/test-hexbuiltins-0939.yaml rename to test/cases/testdata/v0/hexbuiltins/test-hexbuiltins-0939.yaml diff --git a/test/cases/testdata/hexbuiltins/test-hexbuiltins-0940.yaml b/test/cases/testdata/v0/hexbuiltins/test-hexbuiltins-0940.yaml similarity index 100% rename from test/cases/testdata/hexbuiltins/test-hexbuiltins-0940.yaml rename to test/cases/testdata/v0/hexbuiltins/test-hexbuiltins-0940.yaml diff --git a/test/cases/testdata/hexbuiltins/test-hexbuiltins-0941.yaml b/test/cases/testdata/v0/hexbuiltins/test-hexbuiltins-0941.yaml similarity index 100% rename from test/cases/testdata/hexbuiltins/test-hexbuiltins-0941.yaml rename to test/cases/testdata/v0/hexbuiltins/test-hexbuiltins-0941.yaml diff --git a/test/cases/testdata/indexing/array-any.yaml b/test/cases/testdata/v0/indexing/array-any.yaml similarity index 100% rename from test/cases/testdata/indexing/array-any.yaml rename to test/cases/testdata/v0/indexing/array-any.yaml diff --git a/test/cases/testdata/indirectreferences/test-indirectreferences-0758.yaml b/test/cases/testdata/v0/indirectreferences/test-indirectreferences-0758.yaml similarity index 100% rename from test/cases/testdata/indirectreferences/test-indirectreferences-0758.yaml rename to test/cases/testdata/v0/indirectreferences/test-indirectreferences-0758.yaml diff --git a/test/cases/testdata/indirectreferences/test-indirectreferences-0759.yaml b/test/cases/testdata/v0/indirectreferences/test-indirectreferences-0759.yaml similarity index 100% rename from test/cases/testdata/indirectreferences/test-indirectreferences-0759.yaml rename to test/cases/testdata/v0/indirectreferences/test-indirectreferences-0759.yaml diff --git a/test/cases/testdata/indirectreferences/test-indirectreferences-0760.yaml b/test/cases/testdata/v0/indirectreferences/test-indirectreferences-0760.yaml similarity index 100% rename from test/cases/testdata/indirectreferences/test-indirectreferences-0760.yaml rename to test/cases/testdata/v0/indirectreferences/test-indirectreferences-0760.yaml diff --git a/test/cases/testdata/indirectreferences/test-indirectreferences-0761.yaml b/test/cases/testdata/v0/indirectreferences/test-indirectreferences-0761.yaml similarity index 100% rename from test/cases/testdata/indirectreferences/test-indirectreferences-0761.yaml rename to test/cases/testdata/v0/indirectreferences/test-indirectreferences-0761.yaml diff --git a/test/cases/testdata/indirectreferences/test-indirectreferences-0762.yaml b/test/cases/testdata/v0/indirectreferences/test-indirectreferences-0762.yaml similarity index 100% rename from test/cases/testdata/indirectreferences/test-indirectreferences-0762.yaml rename to test/cases/testdata/v0/indirectreferences/test-indirectreferences-0762.yaml diff --git a/test/cases/testdata/inputvalues/test-inputvalues-0977.yaml b/test/cases/testdata/v0/inputvalues/test-inputvalues-0977.yaml similarity index 100% rename from test/cases/testdata/inputvalues/test-inputvalues-0977.yaml rename to test/cases/testdata/v0/inputvalues/test-inputvalues-0977.yaml diff --git a/test/cases/testdata/inputvalues/test-inputvalues-0978.yaml b/test/cases/testdata/v0/inputvalues/test-inputvalues-0978.yaml similarity index 100% rename from test/cases/testdata/inputvalues/test-inputvalues-0978.yaml rename to test/cases/testdata/v0/inputvalues/test-inputvalues-0978.yaml diff --git a/test/cases/testdata/inputvalues/test-inputvalues-0979.yaml b/test/cases/testdata/v0/inputvalues/test-inputvalues-0979.yaml similarity index 100% rename from test/cases/testdata/inputvalues/test-inputvalues-0979.yaml rename to test/cases/testdata/v0/inputvalues/test-inputvalues-0979.yaml diff --git a/test/cases/testdata/inputvalues/test-inputvalues-0980.yaml b/test/cases/testdata/v0/inputvalues/test-inputvalues-0980.yaml similarity index 100% rename from test/cases/testdata/inputvalues/test-inputvalues-0980.yaml rename to test/cases/testdata/v0/inputvalues/test-inputvalues-0980.yaml diff --git a/test/cases/testdata/inputvalues/test-inputvalues-0981.yaml b/test/cases/testdata/v0/inputvalues/test-inputvalues-0981.yaml similarity index 100% rename from test/cases/testdata/inputvalues/test-inputvalues-0981.yaml rename to test/cases/testdata/v0/inputvalues/test-inputvalues-0981.yaml diff --git a/test/cases/testdata/inputvalues/test-inputvalues-0982.yaml b/test/cases/testdata/v0/inputvalues/test-inputvalues-0982.yaml similarity index 100% rename from test/cases/testdata/inputvalues/test-inputvalues-0982.yaml rename to test/cases/testdata/v0/inputvalues/test-inputvalues-0982.yaml diff --git a/test/cases/testdata/inputvalues/test-inputvalues-0983.yaml b/test/cases/testdata/v0/inputvalues/test-inputvalues-0983.yaml similarity index 100% rename from test/cases/testdata/inputvalues/test-inputvalues-0983.yaml rename to test/cases/testdata/v0/inputvalues/test-inputvalues-0983.yaml diff --git a/test/cases/testdata/intersection/test-intersection-0352.yaml b/test/cases/testdata/v0/intersection/test-intersection-0352.yaml similarity index 100% rename from test/cases/testdata/intersection/test-intersection-0352.yaml rename to test/cases/testdata/v0/intersection/test-intersection-0352.yaml diff --git a/test/cases/testdata/intersection/test-intersection-0353.yaml b/test/cases/testdata/v0/intersection/test-intersection-0353.yaml similarity index 100% rename from test/cases/testdata/intersection/test-intersection-0353.yaml rename to test/cases/testdata/v0/intersection/test-intersection-0353.yaml diff --git a/test/cases/testdata/intersection/test-intersection-0354.yaml b/test/cases/testdata/v0/intersection/test-intersection-0354.yaml similarity index 100% rename from test/cases/testdata/intersection/test-intersection-0354.yaml rename to test/cases/testdata/v0/intersection/test-intersection-0354.yaml diff --git a/test/cases/testdata/intersection/test-intersection-0355.yaml b/test/cases/testdata/v0/intersection/test-intersection-0355.yaml similarity index 100% rename from test/cases/testdata/intersection/test-intersection-0355.yaml rename to test/cases/testdata/v0/intersection/test-intersection-0355.yaml diff --git a/test/cases/testdata/intersection/test-intersection-0356.yaml b/test/cases/testdata/v0/intersection/test-intersection-0356.yaml similarity index 100% rename from test/cases/testdata/intersection/test-intersection-0356.yaml rename to test/cases/testdata/v0/intersection/test-intersection-0356.yaml diff --git a/test/cases/testdata/invalidkeyerror/test-invalidkeyerror-0176.yaml b/test/cases/testdata/v0/invalidkeyerror/test-invalidkeyerror-0176.yaml similarity index 100% rename from test/cases/testdata/invalidkeyerror/test-invalidkeyerror-0176.yaml rename to test/cases/testdata/v0/invalidkeyerror/test-invalidkeyerror-0176.yaml diff --git a/test/cases/testdata/invalidkeyerror/test-invalidkeyerror-0177.yaml b/test/cases/testdata/v0/invalidkeyerror/test-invalidkeyerror-0177.yaml similarity index 100% rename from test/cases/testdata/invalidkeyerror/test-invalidkeyerror-0177.yaml rename to test/cases/testdata/v0/invalidkeyerror/test-invalidkeyerror-0177.yaml diff --git a/test/cases/testdata/jsonbuiltins/test-is-valid.yaml b/test/cases/testdata/v0/jsonbuiltins/test-is-valid.yaml similarity index 100% rename from test/cases/testdata/jsonbuiltins/test-is-valid.yaml rename to test/cases/testdata/v0/jsonbuiltins/test-is-valid.yaml diff --git a/test/cases/testdata/jsonbuiltins/test-json-marshal-with-options.yaml b/test/cases/testdata/v0/jsonbuiltins/test-json-marshal-with-options.yaml similarity index 100% rename from test/cases/testdata/jsonbuiltins/test-json-marshal-with-options.yaml rename to test/cases/testdata/v0/jsonbuiltins/test-json-marshal-with-options.yaml diff --git a/test/cases/testdata/jsonbuiltins/test-jsonbuiltins-0924.yaml b/test/cases/testdata/v0/jsonbuiltins/test-jsonbuiltins-0924.yaml similarity index 100% rename from test/cases/testdata/jsonbuiltins/test-jsonbuiltins-0924.yaml rename to test/cases/testdata/v0/jsonbuiltins/test-jsonbuiltins-0924.yaml diff --git a/test/cases/testdata/jsonbuiltins/test-jsonbuiltins-0925.yaml b/test/cases/testdata/v0/jsonbuiltins/test-jsonbuiltins-0925.yaml similarity index 100% rename from test/cases/testdata/jsonbuiltins/test-jsonbuiltins-0925.yaml rename to test/cases/testdata/v0/jsonbuiltins/test-jsonbuiltins-0925.yaml diff --git a/test/cases/testdata/jsonbuiltins/test-jsonbuiltins-0926.yaml b/test/cases/testdata/v0/jsonbuiltins/test-jsonbuiltins-0926.yaml similarity index 100% rename from test/cases/testdata/jsonbuiltins/test-jsonbuiltins-0926.yaml rename to test/cases/testdata/v0/jsonbuiltins/test-jsonbuiltins-0926.yaml diff --git a/test/cases/testdata/jsonbuiltins/test-jsonbuiltins-0927.yaml b/test/cases/testdata/v0/jsonbuiltins/test-jsonbuiltins-0927.yaml similarity index 100% rename from test/cases/testdata/jsonbuiltins/test-jsonbuiltins-0927.yaml rename to test/cases/testdata/v0/jsonbuiltins/test-jsonbuiltins-0927.yaml diff --git a/test/cases/testdata/jsonbuiltins/test-jsonbuiltins-0928.yaml b/test/cases/testdata/v0/jsonbuiltins/test-jsonbuiltins-0928.yaml similarity index 100% rename from test/cases/testdata/jsonbuiltins/test-jsonbuiltins-0928.yaml rename to test/cases/testdata/v0/jsonbuiltins/test-jsonbuiltins-0928.yaml diff --git a/test/cases/testdata/jsonbuiltins/test-marshal-large-ints.yaml b/test/cases/testdata/v0/jsonbuiltins/test-marshal-large-ints.yaml similarity index 100% rename from test/cases/testdata/jsonbuiltins/test-marshal-large-ints.yaml rename to test/cases/testdata/v0/jsonbuiltins/test-marshal-large-ints.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0218.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0218.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0218.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0218.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0219.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0219.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0219.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0219.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0220.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0220.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0220.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0220.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0221.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0221.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0221.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0221.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0222.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0222.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0222.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0222.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0223.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0223.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0223.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0223.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0224.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0224.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0224.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0224.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0225.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0225.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0225.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0225.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0226.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0226.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0226.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0226.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0227.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0227.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0227.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0227.yaml diff --git a/test/cases/testdata/jsonfilter/test-jsonfilter-0228.yaml b/test/cases/testdata/v0/jsonfilter/test-jsonfilter-0228.yaml similarity index 100% rename from test/cases/testdata/jsonfilter/test-jsonfilter-0228.yaml rename to test/cases/testdata/v0/jsonfilter/test-jsonfilter-0228.yaml diff --git a/test/cases/testdata/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml b/test/cases/testdata/v0/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml similarity index 100% rename from test/cases/testdata/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml rename to test/cases/testdata/v0/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml diff --git a/test/cases/testdata/jsonpatch/coverage.yaml b/test/cases/testdata/v0/jsonpatch/coverage.yaml similarity index 100% rename from test/cases/testdata/jsonpatch/coverage.yaml rename to test/cases/testdata/v0/jsonpatch/coverage.yaml diff --git a/test/cases/testdata/jsonpatch/json-patch-tests.yaml b/test/cases/testdata/v0/jsonpatch/json-patch-tests.yaml similarity index 100% rename from test/cases/testdata/jsonpatch/json-patch-tests.yaml rename to test/cases/testdata/v0/jsonpatch/json-patch-tests.yaml diff --git a/test/cases/testdata/jsonpatch/set.yaml b/test/cases/testdata/v0/jsonpatch/set.yaml similarity index 100% rename from test/cases/testdata/jsonpatch/set.yaml rename to test/cases/testdata/v0/jsonpatch/set.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0230.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0230.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0230.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0230.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0231.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0231.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0231.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0231.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0232.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0232.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0232.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0232.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0233.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0233.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0233.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0233.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0234.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0234.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0234.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0234.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0235.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0235.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0235.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0235.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0236.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0236.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0236.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0236.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0237.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0237.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0237.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0237.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0238.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0238.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0238.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0238.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0239.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0239.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0239.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0239.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0240.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0240.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0240.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0240.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0241.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0241.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0241.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0241.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0242.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0242.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0242.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0242.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0243.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0243.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0243.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0243.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0244.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0244.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0244.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0244.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0245.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0245.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0245.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0245.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0246.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0246.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0246.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0246.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0247.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0247.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0247.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0247.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0248.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0248.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0248.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0248.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0249.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0249.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0249.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0249.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0250.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0250.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0250.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0250.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0251.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0251.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0251.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0251.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0252.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0252.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0252.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0252.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0253.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0253.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0253.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0253.yaml diff --git a/test/cases/testdata/jsonremove/test-jsonremove-0254.yaml b/test/cases/testdata/v0/jsonremove/test-jsonremove-0254.yaml similarity index 100% rename from test/cases/testdata/jsonremove/test-jsonremove-0254.yaml rename to test/cases/testdata/v0/jsonremove/test-jsonremove-0254.yaml diff --git a/test/cases/testdata/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml b/test/cases/testdata/v0/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml similarity index 100% rename from test/cases/testdata/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml rename to test/cases/testdata/v0/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml diff --git a/test/cases/testdata/jsonschema/test-json-match_schema.yaml b/test/cases/testdata/v0/jsonschema/test-json-match_schema.yaml similarity index 100% rename from test/cases/testdata/jsonschema/test-json-match_schema.yaml rename to test/cases/testdata/v0/jsonschema/test-json-match_schema.yaml diff --git a/test/cases/testdata/jsonschema/test-json-verify_schema.yaml b/test/cases/testdata/v0/jsonschema/test-json-verify_schema.yaml similarity index 100% rename from test/cases/testdata/jsonschema/test-json-verify_schema.yaml rename to test/cases/testdata/v0/jsonschema/test-json-verify_schema.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0389.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0389.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0389.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0389.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0390.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0390.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0390.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0390.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0391.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0391.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0391.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0391.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0392.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0392.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0392.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0392.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0393.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0393.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0393.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0393.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0394.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0394.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0394.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0394.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0395.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0395.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0395.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0395.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0396.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0396.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0396.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0396.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0397.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0397.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0397.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0397.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0398.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0398.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0398.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0398.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0399.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0399.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0399.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0399.yaml diff --git a/test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0400.yaml b/test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0400.yaml similarity index 100% rename from test/cases/testdata/jwtbuiltins/test-jwtbuiltins-0400.yaml rename to test/cases/testdata/v0/jwtbuiltins/test-jwtbuiltins-0400.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0449.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0449.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0449.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0449.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0450.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0450.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0450.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0450.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0451.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0451.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0451.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0451.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0452.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0452.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0452.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0452.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0453.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0453.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0453.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0453.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0454.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0454.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0454.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0454.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0455.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0455.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0455.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0455.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0456.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0456.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0456.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0456.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0457.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0457.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0457.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0457.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0458.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0458.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0458.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0458.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0459.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0459.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0459.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0459.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0460.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0460.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0460.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0460.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0461.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0461.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0461.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0461.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0462.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0462.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0462.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0462.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0463.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0463.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0463.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0463.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0464.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0464.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0464.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0464.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0465.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0465.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0465.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0465.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0466.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0466.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0466.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0466.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0467.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0467.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0467.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0467.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0468.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0468.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0468.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0468.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0469.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0469.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0469.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0469.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0470.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0470.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0470.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0470.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0471.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0471.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0471.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0471.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0472.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0472.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0472.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0472.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0473.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0473.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0473.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0473.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0474.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0474.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0474.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0474.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0475.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0475.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0475.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0475.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0476.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0476.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0476.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0476.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0477.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0477.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0477.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0477.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0478.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0478.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0478.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0478.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0479.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0479.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0479.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0479.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0480.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0480.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0480.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0480.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0481.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0481.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0481.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0481.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0482.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0482.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0482.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0482.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0483.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0483.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0483.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0483.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0484.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0484.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0484.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0484.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0485.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0485.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0485.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0485.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0486.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0486.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0486.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0486.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0487.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0487.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0487.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0487.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0488.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0488.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0488.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0488.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0489.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0489.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0489.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0489.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0490.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0490.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0490.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0490.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0491.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0491.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-0491.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-0491.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml diff --git a/test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml b/test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml similarity index 100% rename from test/cases/testdata/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml rename to test/cases/testdata/v0/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml diff --git a/test/cases/testdata/jwtencodesign/test-jwtencodesign-0492.yaml b/test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-0492.yaml similarity index 100% rename from test/cases/testdata/jwtencodesign/test-jwtencodesign-0492.yaml rename to test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-0492.yaml diff --git a/test/cases/testdata/jwtencodesign/test-jwtencodesign-0493.yaml b/test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-0493.yaml similarity index 100% rename from test/cases/testdata/jwtencodesign/test-jwtencodesign-0493.yaml rename to test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-0493.yaml diff --git a/test/cases/testdata/jwtencodesign/test-jwtencodesign-0494.yaml b/test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-0494.yaml similarity index 100% rename from test/cases/testdata/jwtencodesign/test-jwtencodesign-0494.yaml rename to test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-0494.yaml diff --git a/test/cases/testdata/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml b/test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml similarity index 100% rename from test/cases/testdata/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml rename to test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml diff --git a/test/cases/testdata/jwtencodesign/test-jwtencodesign-set-data.yaml b/test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-set-data.yaml similarity index 100% rename from test/cases/testdata/jwtencodesign/test-jwtencodesign-set-data.yaml rename to test/cases/testdata/v0/jwtencodesign/test-jwtencodesign-set-data.yaml diff --git a/test/cases/testdata/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml b/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml rename to test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml diff --git a/test/cases/testdata/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml b/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml rename to test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml diff --git a/test/cases/testdata/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml b/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml rename to test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml diff --git a/test/cases/testdata/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml b/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml rename to test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml diff --git a/test/cases/testdata/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml b/test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml rename to test/cases/testdata/v0/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml diff --git a/test/cases/testdata/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml b/test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml rename to test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml diff --git a/test/cases/testdata/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml b/test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml rename to test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml diff --git a/test/cases/testdata/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml b/test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml rename to test/cases/testdata/v0/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml diff --git a/test/cases/testdata/jwtencodesignraw/test-jwtencodesignraw-0384.yaml b/test/cases/testdata/v0/jwtencodesignraw/test-jwtencodesignraw-0384.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignraw/test-jwtencodesignraw-0384.yaml rename to test/cases/testdata/v0/jwtencodesignraw/test-jwtencodesignraw-0384.yaml diff --git a/test/cases/testdata/jwtencodesignraw/test-jwtencodesignraw-0385.yaml b/test/cases/testdata/v0/jwtencodesignraw/test-jwtencodesignraw-0385.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignraw/test-jwtencodesignraw-0385.yaml rename to test/cases/testdata/v0/jwtencodesignraw/test-jwtencodesignraw-0385.yaml diff --git a/test/cases/testdata/jwtencodesignraw/test-jwtencodesignraw-0386.yaml b/test/cases/testdata/v0/jwtencodesignraw/test-jwtencodesignraw-0386.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignraw/test-jwtencodesignraw-0386.yaml rename to test/cases/testdata/v0/jwtencodesignraw/test-jwtencodesignraw-0386.yaml diff --git a/test/cases/testdata/jwtencodesignraw/test-jwtencodesignraw-0387.yaml b/test/cases/testdata/v0/jwtencodesignraw/test-jwtencodesignraw-0387.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignraw/test-jwtencodesignraw-0387.yaml rename to test/cases/testdata/v0/jwtencodesignraw/test-jwtencodesignraw-0387.yaml diff --git a/test/cases/testdata/jwtencodesignraw/test-jwtencodesignraw-0388.yaml b/test/cases/testdata/v0/jwtencodesignraw/test-jwtencodesignraw-0388.yaml similarity index 100% rename from test/cases/testdata/jwtencodesignraw/test-jwtencodesignraw-0388.yaml rename to test/cases/testdata/v0/jwtencodesignraw/test-jwtencodesignraw-0388.yaml diff --git a/test/cases/testdata/jwtverifyhs256/test-jwtverifyhs256-0440.yaml b/test/cases/testdata/v0/jwtverifyhs256/test-jwtverifyhs256-0440.yaml similarity index 100% rename from test/cases/testdata/jwtverifyhs256/test-jwtverifyhs256-0440.yaml rename to test/cases/testdata/v0/jwtverifyhs256/test-jwtverifyhs256-0440.yaml diff --git a/test/cases/testdata/jwtverifyhs256/test-jwtverifyhs256-0441.yaml b/test/cases/testdata/v0/jwtverifyhs256/test-jwtverifyhs256-0441.yaml similarity index 100% rename from test/cases/testdata/jwtverifyhs256/test-jwtverifyhs256-0441.yaml rename to test/cases/testdata/v0/jwtverifyhs256/test-jwtverifyhs256-0441.yaml diff --git a/test/cases/testdata/jwtverifyhs256/test-jwtverifyhs256-0442.yaml b/test/cases/testdata/v0/jwtverifyhs256/test-jwtverifyhs256-0442.yaml similarity index 100% rename from test/cases/testdata/jwtverifyhs256/test-jwtverifyhs256-0442.yaml rename to test/cases/testdata/v0/jwtverifyhs256/test-jwtverifyhs256-0442.yaml diff --git a/test/cases/testdata/jwtverifyhs384/test-jwtverifyhs384-0443.yaml b/test/cases/testdata/v0/jwtverifyhs384/test-jwtverifyhs384-0443.yaml similarity index 100% rename from test/cases/testdata/jwtverifyhs384/test-jwtverifyhs384-0443.yaml rename to test/cases/testdata/v0/jwtverifyhs384/test-jwtverifyhs384-0443.yaml diff --git a/test/cases/testdata/jwtverifyhs384/test-jwtverifyhs384-0444.yaml b/test/cases/testdata/v0/jwtverifyhs384/test-jwtverifyhs384-0444.yaml similarity index 100% rename from test/cases/testdata/jwtverifyhs384/test-jwtverifyhs384-0444.yaml rename to test/cases/testdata/v0/jwtverifyhs384/test-jwtverifyhs384-0444.yaml diff --git a/test/cases/testdata/jwtverifyhs384/test-jwtverifyhs384-0445.yaml b/test/cases/testdata/v0/jwtverifyhs384/test-jwtverifyhs384-0445.yaml similarity index 100% rename from test/cases/testdata/jwtverifyhs384/test-jwtverifyhs384-0445.yaml rename to test/cases/testdata/v0/jwtverifyhs384/test-jwtverifyhs384-0445.yaml diff --git a/test/cases/testdata/jwtverifyhs512/test-jwtverifyhs512-0446.yaml b/test/cases/testdata/v0/jwtverifyhs512/test-jwtverifyhs512-0446.yaml similarity index 100% rename from test/cases/testdata/jwtverifyhs512/test-jwtverifyhs512-0446.yaml rename to test/cases/testdata/v0/jwtverifyhs512/test-jwtverifyhs512-0446.yaml diff --git a/test/cases/testdata/jwtverifyhs512/test-jwtverifyhs512-0447.yaml b/test/cases/testdata/v0/jwtverifyhs512/test-jwtverifyhs512-0447.yaml similarity index 100% rename from test/cases/testdata/jwtverifyhs512/test-jwtverifyhs512-0447.yaml rename to test/cases/testdata/v0/jwtverifyhs512/test-jwtverifyhs512-0447.yaml diff --git a/test/cases/testdata/jwtverifyhs512/test-jwtverifyhs512-0448.yaml b/test/cases/testdata/v0/jwtverifyhs512/test-jwtverifyhs512-0448.yaml similarity index 100% rename from test/cases/testdata/jwtverifyhs512/test-jwtverifyhs512-0448.yaml rename to test/cases/testdata/v0/jwtverifyhs512/test-jwtverifyhs512-0448.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0401.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0401.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0401.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0401.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0402.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0402.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0402.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0402.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0403.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0403.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0403.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0403.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0404.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0404.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0404.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0404.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0405.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0405.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0405.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0405.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0406.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0406.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0406.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0406.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0407.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0407.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0407.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0407.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0408.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0408.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0408.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0408.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0409.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0409.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0409.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0409.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0410.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0410.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0410.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0410.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0411.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0411.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0411.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0411.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0412.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0412.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0412.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0412.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0413.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0413.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0413.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0413.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0414.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0414.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0414.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0414.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0415.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0415.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0415.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0415.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0416.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0416.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0416.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0416.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0417.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0417.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0417.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0417.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0418.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0418.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0418.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0418.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0419.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0419.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0419.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0419.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0420.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0420.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0420.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0420.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0421.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0421.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0421.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0421.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0422.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0422.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0422.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0422.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0423.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0423.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0423.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0423.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0424.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0424.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0424.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0424.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0425.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0425.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0425.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0425.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0426.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0426.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0426.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0426.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0427.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0427.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0427.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0427.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0428.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0428.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0428.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0428.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0429.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0429.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0429.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0429.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0430.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0430.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0430.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0430.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0431.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0431.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0431.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0431.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0432.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0432.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0432.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0432.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0433.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0433.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0433.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0433.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0434.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0434.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0434.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0434.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0435.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0435.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0435.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0435.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0436.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0436.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0436.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0436.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0437.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0437.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0437.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0437.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0438.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0438.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0438.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0438.yaml diff --git a/test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0439.yaml b/test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0439.yaml similarity index 100% rename from test/cases/testdata/jwtverifyrsa/test-jwtverifyrsa-0439.yaml rename to test/cases/testdata/v0/jwtverifyrsa/test-jwtverifyrsa-0439.yaml diff --git a/test/cases/testdata/negation/test-negation-0777.yaml b/test/cases/testdata/v0/negation/test-negation-0777.yaml similarity index 100% rename from test/cases/testdata/negation/test-negation-0777.yaml rename to test/cases/testdata/v0/negation/test-negation-0777.yaml diff --git a/test/cases/testdata/negation/test-negation-0778.yaml b/test/cases/testdata/v0/negation/test-negation-0778.yaml similarity index 100% rename from test/cases/testdata/negation/test-negation-0778.yaml rename to test/cases/testdata/v0/negation/test-negation-0778.yaml diff --git a/test/cases/testdata/negation/test-negation-0779.yaml b/test/cases/testdata/v0/negation/test-negation-0779.yaml similarity index 100% rename from test/cases/testdata/negation/test-negation-0779.yaml rename to test/cases/testdata/v0/negation/test-negation-0779.yaml diff --git a/test/cases/testdata/negation/test-negation-0780.yaml b/test/cases/testdata/v0/negation/test-negation-0780.yaml similarity index 100% rename from test/cases/testdata/negation/test-negation-0780.yaml rename to test/cases/testdata/v0/negation/test-negation-0780.yaml diff --git a/test/cases/testdata/negation/test-negation-data-ref-with-var.yaml b/test/cases/testdata/v0/negation/test-negation-data-ref-with-var.yaml similarity index 100% rename from test/cases/testdata/negation/test-negation-data-ref-with-var.yaml rename to test/cases/testdata/v0/negation/test-negation-data-ref-with-var.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0709.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0709.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0709.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0709.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0710.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0710.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0710.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0710.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0711.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0711.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0711.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0711.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0712.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0712.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0712.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0712.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0713.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0713.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0713.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0713.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0714.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0714.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0714.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0714.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0715.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0715.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0715.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0715.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0716.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0716.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0716.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0716.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0717.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0717.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0717.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0717.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0718.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0718.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0718.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0718.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0719.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0719.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0719.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0719.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0720.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0720.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0720.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0720.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0721.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0721.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0721.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0721.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0722.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0722.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0722.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0722.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0723.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0723.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0723.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0723.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0724.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0724.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0724.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0724.yaml diff --git a/test/cases/testdata/nestedreferences/test-nestedreferences-0725.yaml b/test/cases/testdata/v0/nestedreferences/test-nestedreferences-0725.yaml similarity index 100% rename from test/cases/testdata/nestedreferences/test-nestedreferences-0725.yaml rename to test/cases/testdata/v0/nestedreferences/test-nestedreferences-0725.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0092.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0092.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0092.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0092.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0093.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0093.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0093.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0093.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0094.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0094.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0094.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0094.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0095.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0095.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0095.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0095.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0096.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0096.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0096.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0096.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0097.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0097.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0097.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0097.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0098.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0098.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0098.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0098.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0099.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0099.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0099.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0099.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0100.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0100.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0100.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0100.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0101.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0101.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0101.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0101.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0102.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0102.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0102.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0102.yaml diff --git a/test/cases/testdata/netcidrcontains/test-netcidrcontains-0103.yaml b/test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0103.yaml similarity index 100% rename from test/cases/testdata/netcidrcontains/test-netcidrcontains-0103.yaml rename to test/cases/testdata/v0/netcidrcontains/test-netcidrcontains-0103.yaml diff --git a/test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml b/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml similarity index 100% rename from test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml rename to test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml diff --git a/test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml b/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml similarity index 100% rename from test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml rename to test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml diff --git a/test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml b/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml similarity index 100% rename from test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml rename to test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml diff --git a/test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml b/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml similarity index 100% rename from test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml rename to test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml diff --git a/test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml b/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml similarity index 100% rename from test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml rename to test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml diff --git a/test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml b/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml similarity index 100% rename from test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml rename to test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml diff --git a/test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml b/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml similarity index 100% rename from test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml rename to test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml diff --git a/test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml b/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml similarity index 100% rename from test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml rename to test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml diff --git a/test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml b/test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml similarity index 100% rename from test/cases/testdata/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml rename to test/cases/testdata/v0/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml diff --git a/test/cases/testdata/netcidrexpand/test-netcidrexpand-0113.yaml b/test/cases/testdata/v0/netcidrexpand/test-netcidrexpand-0113.yaml similarity index 100% rename from test/cases/testdata/netcidrexpand/test-netcidrexpand-0113.yaml rename to test/cases/testdata/v0/netcidrexpand/test-netcidrexpand-0113.yaml diff --git a/test/cases/testdata/netcidrexpand/test-netcidrexpand-0114.yaml b/test/cases/testdata/v0/netcidrexpand/test-netcidrexpand-0114.yaml similarity index 100% rename from test/cases/testdata/netcidrexpand/test-netcidrexpand-0114.yaml rename to test/cases/testdata/v0/netcidrexpand/test-netcidrexpand-0114.yaml diff --git a/test/cases/testdata/netcidrexpand/test-netcidrexpand-0115.yaml b/test/cases/testdata/v0/netcidrexpand/test-netcidrexpand-0115.yaml similarity index 100% rename from test/cases/testdata/netcidrexpand/test-netcidrexpand-0115.yaml rename to test/cases/testdata/v0/netcidrexpand/test-netcidrexpand-0115.yaml diff --git a/test/cases/testdata/netcidrexpand/test-netcidrexpand-0116.yaml b/test/cases/testdata/v0/netcidrexpand/test-netcidrexpand-0116.yaml similarity index 100% rename from test/cases/testdata/netcidrexpand/test-netcidrexpand-0116.yaml rename to test/cases/testdata/v0/netcidrexpand/test-netcidrexpand-0116.yaml diff --git a/test/cases/testdata/netcidrintersects/test-netcidrintersects-0086.yaml b/test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0086.yaml similarity index 100% rename from test/cases/testdata/netcidrintersects/test-netcidrintersects-0086.yaml rename to test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0086.yaml diff --git a/test/cases/testdata/netcidrintersects/test-netcidrintersects-0087.yaml b/test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0087.yaml similarity index 100% rename from test/cases/testdata/netcidrintersects/test-netcidrintersects-0087.yaml rename to test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0087.yaml diff --git a/test/cases/testdata/netcidrintersects/test-netcidrintersects-0088.yaml b/test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0088.yaml similarity index 100% rename from test/cases/testdata/netcidrintersects/test-netcidrintersects-0088.yaml rename to test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0088.yaml diff --git a/test/cases/testdata/netcidrintersects/test-netcidrintersects-0089.yaml b/test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0089.yaml similarity index 100% rename from test/cases/testdata/netcidrintersects/test-netcidrintersects-0089.yaml rename to test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0089.yaml diff --git a/test/cases/testdata/netcidrintersects/test-netcidrintersects-0090.yaml b/test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0090.yaml similarity index 100% rename from test/cases/testdata/netcidrintersects/test-netcidrintersects-0090.yaml rename to test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0090.yaml diff --git a/test/cases/testdata/netcidrintersects/test-netcidrintersects-0091.yaml b/test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0091.yaml similarity index 100% rename from test/cases/testdata/netcidrintersects/test-netcidrintersects-0091.yaml rename to test/cases/testdata/v0/netcidrintersects/test-netcidrintersects-0091.yaml diff --git a/test/cases/testdata/netcidrisvalid/test_netcidrisvalid-0001.yaml b/test/cases/testdata/v0/netcidrisvalid/test_netcidrisvalid-0001.yaml similarity index 100% rename from test/cases/testdata/netcidrisvalid/test_netcidrisvalid-0001.yaml rename to test/cases/testdata/v0/netcidrisvalid/test_netcidrisvalid-0001.yaml diff --git a/test/cases/testdata/netcidrmerge/test-ipv6-with-and-without-prefix.yaml b/test/cases/testdata/v0/netcidrmerge/test-ipv6-with-and-without-prefix.yaml similarity index 100% rename from test/cases/testdata/netcidrmerge/test-ipv6-with-and-without-prefix.yaml rename to test/cases/testdata/v0/netcidrmerge/test-ipv6-with-and-without-prefix.yaml diff --git a/test/cases/testdata/netcidrmerge/test-netcidrmerge0117.yaml b/test/cases/testdata/v0/netcidrmerge/test-netcidrmerge0117.yaml similarity index 100% rename from test/cases/testdata/netcidrmerge/test-netcidrmerge0117.yaml rename to test/cases/testdata/v0/netcidrmerge/test-netcidrmerge0117.yaml diff --git a/test/cases/testdata/netcidroverlap/test-netcidroverlap-0084.yaml b/test/cases/testdata/v0/netcidroverlap/test-netcidroverlap-0084.yaml similarity index 100% rename from test/cases/testdata/netcidroverlap/test-netcidroverlap-0084.yaml rename to test/cases/testdata/v0/netcidroverlap/test-netcidroverlap-0084.yaml diff --git a/test/cases/testdata/netcidroverlap/test-netcidroverlap-0085.yaml b/test/cases/testdata/v0/netcidroverlap/test-netcidroverlap-0085.yaml similarity index 100% rename from test/cases/testdata/netcidroverlap/test-netcidroverlap-0085.yaml rename to test/cases/testdata/v0/netcidroverlap/test-netcidroverlap-0085.yaml diff --git a/test/cases/testdata/netlookupipaddr/test-netlookupipaddr.yaml b/test/cases/testdata/v0/netlookupipaddr/test-netlookupipaddr.yaml similarity index 100% rename from test/cases/testdata/netlookupipaddr/test-netlookupipaddr.yaml rename to test/cases/testdata/v0/netlookupipaddr/test-netlookupipaddr.yaml diff --git a/test/cases/testdata/numbersrange/test-numbersrange-0256.yaml b/test/cases/testdata/v0/numbersrange/test-numbersrange-0256.yaml similarity index 100% rename from test/cases/testdata/numbersrange/test-numbersrange-0256.yaml rename to test/cases/testdata/v0/numbersrange/test-numbersrange-0256.yaml diff --git a/test/cases/testdata/numbersrange/test-numbersrange-0257.yaml b/test/cases/testdata/v0/numbersrange/test-numbersrange-0257.yaml similarity index 100% rename from test/cases/testdata/numbersrange/test-numbersrange-0257.yaml rename to test/cases/testdata/v0/numbersrange/test-numbersrange-0257.yaml diff --git a/test/cases/testdata/numbersrange/test-numbersrange-0258.yaml b/test/cases/testdata/v0/numbersrange/test-numbersrange-0258.yaml similarity index 100% rename from test/cases/testdata/numbersrange/test-numbersrange-0258.yaml rename to test/cases/testdata/v0/numbersrange/test-numbersrange-0258.yaml diff --git a/test/cases/testdata/numbersrange/test-numbersrange-0259.yaml b/test/cases/testdata/v0/numbersrange/test-numbersrange-0259.yaml similarity index 100% rename from test/cases/testdata/numbersrange/test-numbersrange-0259.yaml rename to test/cases/testdata/v0/numbersrange/test-numbersrange-0259.yaml diff --git a/test/cases/testdata/numbersrange/test-numbersrange-0260.yaml b/test/cases/testdata/v0/numbersrange/test-numbersrange-0260.yaml similarity index 100% rename from test/cases/testdata/numbersrange/test-numbersrange-0260.yaml rename to test/cases/testdata/v0/numbersrange/test-numbersrange-0260.yaml diff --git a/test/cases/testdata/numbersrange/test-numbersrange-0261.yaml b/test/cases/testdata/v0/numbersrange/test-numbersrange-0261.yaml similarity index 100% rename from test/cases/testdata/numbersrange/test-numbersrange-0261.yaml rename to test/cases/testdata/v0/numbersrange/test-numbersrange-0261.yaml diff --git a/test/cases/testdata/numbersrangestep/test-numbersrangestep.yaml b/test/cases/testdata/v0/numbersrangestep/test-numbersrangestep.yaml similarity index 100% rename from test/cases/testdata/numbersrangestep/test-numbersrangestep.yaml rename to test/cases/testdata/v0/numbersrangestep/test-numbersrangestep.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0300.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0300.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0300.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0300.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0301.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0301.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0301.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0301.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0302.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0302.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0302.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0302.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0303.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0303.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0303.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0303.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0304.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0304.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0304.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0304.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0305.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0305.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0305.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0305.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0306.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0306.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0306.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0306.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0307.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0307.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0307.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0307.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0308.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0308.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0308.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0308.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0309.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0309.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0309.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0309.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0310.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0310.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0310.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0310.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0311.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0311.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0311.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0311.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0312.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0312.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0312.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0312.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0313.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0313.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0313.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0313.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0314.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0314.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0314.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0314.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0315.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0315.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0315.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0315.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0316.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0316.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0316.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0316.yaml diff --git a/test/cases/testdata/objectfilter/test-objectfilter-0317.yaml b/test/cases/testdata/v0/objectfilter/test-objectfilter-0317.yaml similarity index 100% rename from test/cases/testdata/objectfilter/test-objectfilter-0317.yaml rename to test/cases/testdata/v0/objectfilter/test-objectfilter-0317.yaml diff --git a/test/cases/testdata/objectfilteridempotent/test-objectfilteridempotent-0319.yaml b/test/cases/testdata/v0/objectfilteridempotent/test-objectfilteridempotent-0319.yaml similarity index 100% rename from test/cases/testdata/objectfilteridempotent/test-objectfilteridempotent-0319.yaml rename to test/cases/testdata/v0/objectfilteridempotent/test-objectfilteridempotent-0319.yaml diff --git a/test/cases/testdata/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml b/test/cases/testdata/v0/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml similarity index 100% rename from test/cases/testdata/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml rename to test/cases/testdata/v0/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml diff --git a/test/cases/testdata/objectget/test-objectget-0262.yaml b/test/cases/testdata/v0/objectget/test-objectget-0262.yaml similarity index 100% rename from test/cases/testdata/objectget/test-objectget-0262.yaml rename to test/cases/testdata/v0/objectget/test-objectget-0262.yaml diff --git a/test/cases/testdata/objectget/test-objectget-0263.yaml b/test/cases/testdata/v0/objectget/test-objectget-0263.yaml similarity index 100% rename from test/cases/testdata/objectget/test-objectget-0263.yaml rename to test/cases/testdata/v0/objectget/test-objectget-0263.yaml diff --git a/test/cases/testdata/objectget/test-objectget-0264.yaml b/test/cases/testdata/v0/objectget/test-objectget-0264.yaml similarity index 100% rename from test/cases/testdata/objectget/test-objectget-0264.yaml rename to test/cases/testdata/v0/objectget/test-objectget-0264.yaml diff --git a/test/cases/testdata/objectget/test-objectget-0265.yaml b/test/cases/testdata/v0/objectget/test-objectget-0265.yaml similarity index 100% rename from test/cases/testdata/objectget/test-objectget-0265.yaml rename to test/cases/testdata/v0/objectget/test-objectget-0265.yaml diff --git a/test/cases/testdata/objectget/test-objectget-0266.yaml b/test/cases/testdata/v0/objectget/test-objectget-0266.yaml similarity index 100% rename from test/cases/testdata/objectget/test-objectget-0266.yaml rename to test/cases/testdata/v0/objectget/test-objectget-0266.yaml diff --git a/test/cases/testdata/objectget/test-objectget-0267.yaml b/test/cases/testdata/v0/objectget/test-objectget-0267.yaml similarity index 100% rename from test/cases/testdata/objectget/test-objectget-0267.yaml rename to test/cases/testdata/v0/objectget/test-objectget-0267.yaml diff --git a/test/cases/testdata/objectget/test-objectget-path.yaml b/test/cases/testdata/v0/objectget/test-objectget-path.yaml similarity index 100% rename from test/cases/testdata/objectget/test-objectget-path.yaml rename to test/cases/testdata/v0/objectget/test-objectget-path.yaml diff --git a/test/cases/testdata/objectkeys/test-objectkeys.yaml b/test/cases/testdata/v0/objectkeys/test-objectkeys.yaml similarity index 100% rename from test/cases/testdata/objectkeys/test-objectkeys.yaml rename to test/cases/testdata/v0/objectkeys/test-objectkeys.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0279.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0279.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0279.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0279.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0280.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0280.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0280.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0280.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0281.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0281.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0281.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0281.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0282.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0282.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0282.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0282.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0283.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0283.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0283.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0283.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0284.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0284.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0284.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0284.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0285.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0285.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0285.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0285.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0286.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0286.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0286.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0286.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0287.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0287.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0287.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0287.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0288.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0288.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0288.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0288.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0289.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0289.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0289.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0289.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0290.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0290.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0290.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0290.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0291.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0291.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0291.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0291.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0292.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0292.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0292.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0292.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0293.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0293.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0293.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0293.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0294.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0294.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0294.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0294.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0295.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0295.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0295.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0295.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0296.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0296.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0296.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0296.yaml diff --git a/test/cases/testdata/objectremove/test-objectremove-0297.yaml b/test/cases/testdata/v0/objectremove/test-objectremove-0297.yaml similarity index 100% rename from test/cases/testdata/objectremove/test-objectremove-0297.yaml rename to test/cases/testdata/v0/objectremove/test-objectremove-0297.yaml diff --git a/test/cases/testdata/objectremoveidempotent/test-objectremoveidempotent-0298.yaml b/test/cases/testdata/v0/objectremoveidempotent/test-objectremoveidempotent-0298.yaml similarity index 100% rename from test/cases/testdata/objectremoveidempotent/test-objectremoveidempotent-0298.yaml rename to test/cases/testdata/v0/objectremoveidempotent/test-objectremoveidempotent-0298.yaml diff --git a/test/cases/testdata/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml b/test/cases/testdata/v0/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml similarity index 100% rename from test/cases/testdata/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml rename to test/cases/testdata/v0/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0268.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0268.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0268.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0268.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0269.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0269.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0269.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0269.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0270.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0270.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0270.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0270.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0271.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0271.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0271.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0271.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0272.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0272.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0272.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0272.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0273.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0273.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0273.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0273.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0274.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0274.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0274.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0274.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0275.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0275.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0275.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0275.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0276.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0276.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0276.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0276.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0277.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0277.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0277.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0277.yaml diff --git a/test/cases/testdata/objectunion/test-objectunion-0278.yaml b/test/cases/testdata/v0/objectunion/test-objectunion-0278.yaml similarity index 100% rename from test/cases/testdata/objectunion/test-objectunion-0278.yaml rename to test/cases/testdata/v0/objectunion/test-objectunion-0278.yaml diff --git a/test/cases/testdata/objectunionn/test-objectunionn-0001.yaml b/test/cases/testdata/v0/objectunionn/test-objectunionn-0001.yaml similarity index 100% rename from test/cases/testdata/objectunionn/test-objectunionn-0001.yaml rename to test/cases/testdata/v0/objectunionn/test-objectunionn-0001.yaml diff --git a/test/cases/testdata/partialdocconstants/test-partialdocconstants-0984.yaml b/test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0984.yaml similarity index 100% rename from test/cases/testdata/partialdocconstants/test-partialdocconstants-0984.yaml rename to test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0984.yaml diff --git a/test/cases/testdata/partialdocconstants/test-partialdocconstants-0985.yaml b/test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0985.yaml similarity index 100% rename from test/cases/testdata/partialdocconstants/test-partialdocconstants-0985.yaml rename to test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0985.yaml diff --git a/test/cases/testdata/partialdocconstants/test-partialdocconstants-0986.yaml b/test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0986.yaml similarity index 100% rename from test/cases/testdata/partialdocconstants/test-partialdocconstants-0986.yaml rename to test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0986.yaml diff --git a/test/cases/testdata/partialdocconstants/test-partialdocconstants-0987.yaml b/test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0987.yaml similarity index 100% rename from test/cases/testdata/partialdocconstants/test-partialdocconstants-0987.yaml rename to test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0987.yaml diff --git a/test/cases/testdata/partialdocconstants/test-partialdocconstants-0988.yaml b/test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0988.yaml similarity index 100% rename from test/cases/testdata/partialdocconstants/test-partialdocconstants-0988.yaml rename to test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0988.yaml diff --git a/test/cases/testdata/partialdocconstants/test-partialdocconstants-0989.yaml b/test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0989.yaml similarity index 100% rename from test/cases/testdata/partialdocconstants/test-partialdocconstants-0989.yaml rename to test/cases/testdata/v0/partialdocconstants/test-partialdocconstants-0989.yaml diff --git a/test/cases/testdata/partialiter/test-partialiter-001.yaml b/test/cases/testdata/v0/partialiter/test-partialiter-001.yaml similarity index 100% rename from test/cases/testdata/partialiter/test-partialiter-001.yaml rename to test/cases/testdata/v0/partialiter/test-partialiter-001.yaml diff --git a/test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0519.yaml b/test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0519.yaml similarity index 100% rename from test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0519.yaml rename to test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0519.yaml diff --git a/test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0520.yaml b/test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0520.yaml similarity index 100% rename from test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0520.yaml rename to test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0520.yaml diff --git a/test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0521.yaml b/test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0521.yaml similarity index 100% rename from test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0521.yaml rename to test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0521.yaml diff --git a/test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0522.yaml b/test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0522.yaml similarity index 100% rename from test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0522.yaml rename to test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0522.yaml diff --git a/test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0523.yaml b/test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0523.yaml similarity index 100% rename from test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0523.yaml rename to test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0523.yaml diff --git a/test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0524.yaml b/test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0524.yaml similarity index 100% rename from test/cases/testdata/partialobjectdoc/test-partialobjectdoc-0524.yaml rename to test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-0524.yaml diff --git a/test/cases/testdata/partialobjectdoc/test-partialobjectdoc-ref.yaml b/test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-ref.yaml similarity index 100% rename from test/cases/testdata/partialobjectdoc/test-partialobjectdoc-ref.yaml rename to test/cases/testdata/v0/partialobjectdoc/test-partialobjectdoc-ref.yaml diff --git a/test/cases/testdata/partialobjectdoc/test-wasm-cases.yaml b/test/cases/testdata/v0/partialobjectdoc/test-wasm-cases.yaml similarity index 100% rename from test/cases/testdata/partialobjectdoc/test-wasm-cases.yaml rename to test/cases/testdata/v0/partialobjectdoc/test-wasm-cases.yaml diff --git a/test/cases/testdata/partialsetdoc/test-issue-3369.yaml b/test/cases/testdata/v0/partialsetdoc/test-issue-3369.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-issue-3369.yaml rename to test/cases/testdata/v0/partialsetdoc/test-issue-3369.yaml diff --git a/test/cases/testdata/partialsetdoc/test-issue-3376.yaml b/test/cases/testdata/v0/partialsetdoc/test-issue-3376.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-issue-3376.yaml rename to test/cases/testdata/v0/partialsetdoc/test-issue-3376.yaml diff --git a/test/cases/testdata/partialsetdoc/test-issue-3819.yaml b/test/cases/testdata/v0/partialsetdoc/test-issue-3819.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-issue-3819.yaml rename to test/cases/testdata/v0/partialsetdoc/test-issue-3819.yaml diff --git a/test/cases/testdata/partialsetdoc/test-partialsetdoc-0511.yaml b/test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0511.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-partialsetdoc-0511.yaml rename to test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0511.yaml diff --git a/test/cases/testdata/partialsetdoc/test-partialsetdoc-0512.yaml b/test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0512.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-partialsetdoc-0512.yaml rename to test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0512.yaml diff --git a/test/cases/testdata/partialsetdoc/test-partialsetdoc-0513.yaml b/test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0513.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-partialsetdoc-0513.yaml rename to test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0513.yaml diff --git a/test/cases/testdata/partialsetdoc/test-partialsetdoc-0514.yaml b/test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0514.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-partialsetdoc-0514.yaml rename to test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0514.yaml diff --git a/test/cases/testdata/partialsetdoc/test-partialsetdoc-0515.yaml b/test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0515.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-partialsetdoc-0515.yaml rename to test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0515.yaml diff --git a/test/cases/testdata/partialsetdoc/test-partialsetdoc-0516.yaml b/test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0516.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-partialsetdoc-0516.yaml rename to test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0516.yaml diff --git a/test/cases/testdata/partialsetdoc/test-partialsetdoc-0517.yaml b/test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0517.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-partialsetdoc-0517.yaml rename to test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0517.yaml diff --git a/test/cases/testdata/partialsetdoc/test-partialsetdoc-0518.yaml b/test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0518.yaml similarity index 100% rename from test/cases/testdata/partialsetdoc/test-partialsetdoc-0518.yaml rename to test/cases/testdata/v0/partialsetdoc/test-partialsetdoc-0518.yaml diff --git a/test/cases/testdata/planner-ir/test-array-ir-unify.yaml b/test/cases/testdata/v0/planner-ir/test-array-ir-unify.yaml similarity index 100% rename from test/cases/testdata/planner-ir/test-array-ir-unify.yaml rename to test/cases/testdata/v0/planner-ir/test-array-ir-unify.yaml diff --git a/test/cases/testdata/planner-ir/test-call-dynamic.yaml b/test/cases/testdata/v0/planner-ir/test-call-dynamic.yaml similarity index 100% rename from test/cases/testdata/planner-ir/test-call-dynamic.yaml rename to test/cases/testdata/v0/planner-ir/test-call-dynamic.yaml diff --git a/test/cases/testdata/providers-aws/aws-sign_req-errors.yaml b/test/cases/testdata/v0/providers-aws/aws-sign_req-errors.yaml similarity index 100% rename from test/cases/testdata/providers-aws/aws-sign_req-errors.yaml rename to test/cases/testdata/v0/providers-aws/aws-sign_req-errors.yaml diff --git a/test/cases/testdata/providers-aws/aws-sign_req.yaml b/test/cases/testdata/v0/providers-aws/aws-sign_req.yaml similarity index 100% rename from test/cases/testdata/providers-aws/aws-sign_req.yaml rename to test/cases/testdata/v0/providers-aws/aws-sign_req.yaml diff --git a/test/cases/testdata/rand/test-rand.intn.yaml b/test/cases/testdata/v0/rand/test-rand.intn.yaml similarity index 100% rename from test/cases/testdata/rand/test-rand.intn.yaml rename to test/cases/testdata/v0/rand/test-rand.intn.yaml diff --git a/test/cases/testdata/reachable/test-reachable-0322.yaml b/test/cases/testdata/v0/reachable/test-reachable-0322.yaml similarity index 100% rename from test/cases/testdata/reachable/test-reachable-0322.yaml rename to test/cases/testdata/v0/reachable/test-reachable-0322.yaml diff --git a/test/cases/testdata/reachable/test-reachable-0323.yaml b/test/cases/testdata/v0/reachable/test-reachable-0323.yaml similarity index 100% rename from test/cases/testdata/reachable/test-reachable-0323.yaml rename to test/cases/testdata/v0/reachable/test-reachable-0323.yaml diff --git a/test/cases/testdata/reachable/test-reachable-0324.yaml b/test/cases/testdata/v0/reachable/test-reachable-0324.yaml similarity index 100% rename from test/cases/testdata/reachable/test-reachable-0324.yaml rename to test/cases/testdata/v0/reachable/test-reachable-0324.yaml diff --git a/test/cases/testdata/reachable/test-reachable-0325.yaml b/test/cases/testdata/v0/reachable/test-reachable-0325.yaml similarity index 100% rename from test/cases/testdata/reachable/test-reachable-0325.yaml rename to test/cases/testdata/v0/reachable/test-reachable-0325.yaml diff --git a/test/cases/testdata/reachable/test-reachable-0326.yaml b/test/cases/testdata/v0/reachable/test-reachable-0326.yaml similarity index 100% rename from test/cases/testdata/reachable/test-reachable-0326.yaml rename to test/cases/testdata/v0/reachable/test-reachable-0326.yaml diff --git a/test/cases/testdata/reachable/test-reachable-0327.yaml b/test/cases/testdata/v0/reachable/test-reachable-0327.yaml similarity index 100% rename from test/cases/testdata/reachable/test-reachable-0327.yaml rename to test/cases/testdata/v0/reachable/test-reachable-0327.yaml diff --git a/test/cases/testdata/reachable/test-reachable-0328.yaml b/test/cases/testdata/v0/reachable/test-reachable-0328.yaml similarity index 100% rename from test/cases/testdata/reachable/test-reachable-0328.yaml rename to test/cases/testdata/v0/reachable/test-reachable-0328.yaml diff --git a/test/cases/testdata/reachable/test-reachable-paths-0422.yaml b/test/cases/testdata/v0/reachable/test-reachable-paths-0422.yaml similarity index 100% rename from test/cases/testdata/reachable/test-reachable-paths-0422.yaml rename to test/cases/testdata/v0/reachable/test-reachable-paths-0422.yaml diff --git a/test/cases/testdata/reachable/test-reachable-paths-1022.yaml b/test/cases/testdata/v0/reachable/test-reachable-paths-1022.yaml similarity index 100% rename from test/cases/testdata/reachable/test-reachable-paths-1022.yaml rename to test/cases/testdata/v0/reachable/test-reachable-paths-1022.yaml diff --git a/test/cases/testdata/refheads/test-generic-refs.yaml b/test/cases/testdata/v0/refheads/test-generic-refs.yaml similarity index 100% rename from test/cases/testdata/refheads/test-generic-refs.yaml rename to test/cases/testdata/v0/refheads/test-generic-refs.yaml diff --git a/test/cases/testdata/refheads/test-refs-as-rule-heads.yaml b/test/cases/testdata/v0/refheads/test-refs-as-rule-heads.yaml similarity index 100% rename from test/cases/testdata/refheads/test-refs-as-rule-heads.yaml rename to test/cases/testdata/v0/refheads/test-refs-as-rule-heads.yaml diff --git a/test/cases/testdata/refheads/test-regressions.yaml b/test/cases/testdata/v0/refheads/test-regressions.yaml similarity index 100% rename from test/cases/testdata/refheads/test-regressions.yaml rename to test/cases/testdata/v0/refheads/test-regressions.yaml diff --git a/test/cases/testdata/regexfind/test-regexfind-0334.yaml b/test/cases/testdata/v0/regexfind/test-regexfind-0334.yaml similarity index 100% rename from test/cases/testdata/regexfind/test-regexfind-0334.yaml rename to test/cases/testdata/v0/regexfind/test-regexfind-0334.yaml diff --git a/test/cases/testdata/regexfind/test-regexfind-0335.yaml b/test/cases/testdata/v0/regexfind/test-regexfind-0335.yaml similarity index 100% rename from test/cases/testdata/regexfind/test-regexfind-0335.yaml rename to test/cases/testdata/v0/regexfind/test-regexfind-0335.yaml diff --git a/test/cases/testdata/regexfind/test-regexfind-0336.yaml b/test/cases/testdata/v0/regexfind/test-regexfind-0336.yaml similarity index 100% rename from test/cases/testdata/regexfind/test-regexfind-0336.yaml rename to test/cases/testdata/v0/regexfind/test-regexfind-0336.yaml diff --git a/test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml b/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml similarity index 100% rename from test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml rename to test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml diff --git a/test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml b/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml similarity index 100% rename from test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml rename to test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml diff --git a/test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml b/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml similarity index 100% rename from test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml rename to test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml diff --git a/test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml b/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml similarity index 100% rename from test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml rename to test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml diff --git a/test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml b/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml similarity index 100% rename from test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml rename to test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml diff --git a/test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml b/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml similarity index 100% rename from test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml rename to test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml diff --git a/test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml b/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml similarity index 100% rename from test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml rename to test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml diff --git a/test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml b/test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml similarity index 100% rename from test/cases/testdata/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml rename to test/cases/testdata/v0/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml diff --git a/test/cases/testdata/regexisvalid/test-regexisvalid-0329.yaml b/test/cases/testdata/v0/regexisvalid/test-regexisvalid-0329.yaml similarity index 100% rename from test/cases/testdata/regexisvalid/test-regexisvalid-0329.yaml rename to test/cases/testdata/v0/regexisvalid/test-regexisvalid-0329.yaml diff --git a/test/cases/testdata/regexisvalid/test-regexisvalid-0330.yaml b/test/cases/testdata/v0/regexisvalid/test-regexisvalid-0330.yaml similarity index 100% rename from test/cases/testdata/regexisvalid/test-regexisvalid-0330.yaml rename to test/cases/testdata/v0/regexisvalid/test-regexisvalid-0330.yaml diff --git a/test/cases/testdata/regexisvalid/test-regexisvalid-0331.yaml b/test/cases/testdata/v0/regexisvalid/test-regexisvalid-0331.yaml similarity index 100% rename from test/cases/testdata/regexisvalid/test-regexisvalid-0331.yaml rename to test/cases/testdata/v0/regexisvalid/test-regexisvalid-0331.yaml diff --git a/test/cases/testdata/regexmatch/test-regexmatch-0855.yaml b/test/cases/testdata/v0/regexmatch/test-regexmatch-0855.yaml similarity index 100% rename from test/cases/testdata/regexmatch/test-regexmatch-0855.yaml rename to test/cases/testdata/v0/regexmatch/test-regexmatch-0855.yaml diff --git a/test/cases/testdata/regexmatch/test-regexmatch-0856.yaml b/test/cases/testdata/v0/regexmatch/test-regexmatch-0856.yaml similarity index 100% rename from test/cases/testdata/regexmatch/test-regexmatch-0856.yaml rename to test/cases/testdata/v0/regexmatch/test-regexmatch-0856.yaml diff --git a/test/cases/testdata/regexmatch/test-regexmatch-0857.yaml b/test/cases/testdata/v0/regexmatch/test-regexmatch-0857.yaml similarity index 100% rename from test/cases/testdata/regexmatch/test-regexmatch-0857.yaml rename to test/cases/testdata/v0/regexmatch/test-regexmatch-0857.yaml diff --git a/test/cases/testdata/regexmatch/test-regexmatch-0858.yaml b/test/cases/testdata/v0/regexmatch/test-regexmatch-0858.yaml similarity index 100% rename from test/cases/testdata/regexmatch/test-regexmatch-0858.yaml rename to test/cases/testdata/v0/regexmatch/test-regexmatch-0858.yaml diff --git a/test/cases/testdata/regexmatch/test-regexmatch-0859.yaml b/test/cases/testdata/v0/regexmatch/test-regexmatch-0859.yaml similarity index 100% rename from test/cases/testdata/regexmatch/test-regexmatch-0859.yaml rename to test/cases/testdata/v0/regexmatch/test-regexmatch-0859.yaml diff --git a/test/cases/testdata/regexmatch/test-regexmatch-0860.yaml b/test/cases/testdata/v0/regexmatch/test-regexmatch-0860.yaml similarity index 100% rename from test/cases/testdata/regexmatch/test-regexmatch-0860.yaml rename to test/cases/testdata/v0/regexmatch/test-regexmatch-0860.yaml diff --git a/test/cases/testdata/regexmatch/test-regexmatch-0861.yaml b/test/cases/testdata/v0/regexmatch/test-regexmatch-0861.yaml similarity index 100% rename from test/cases/testdata/regexmatch/test-regexmatch-0861.yaml rename to test/cases/testdata/v0/regexmatch/test-regexmatch-0861.yaml diff --git a/test/cases/testdata/regexmatchtemplate/test-regexmatchtemplate-0332.yaml b/test/cases/testdata/v0/regexmatchtemplate/test-regexmatchtemplate-0332.yaml similarity index 100% rename from test/cases/testdata/regexmatchtemplate/test-regexmatchtemplate-0332.yaml rename to test/cases/testdata/v0/regexmatchtemplate/test-regexmatchtemplate-0332.yaml diff --git a/test/cases/testdata/regexmatchtemplate/test-regexmatchtemplate-0333.yaml b/test/cases/testdata/v0/regexmatchtemplate/test-regexmatchtemplate-0333.yaml similarity index 100% rename from test/cases/testdata/regexmatchtemplate/test-regexmatchtemplate-0333.yaml rename to test/cases/testdata/v0/regexmatchtemplate/test-regexmatchtemplate-0333.yaml diff --git a/test/cases/testdata/regexreplace/test-regexreplace-0001.yaml b/test/cases/testdata/v0/regexreplace/test-regexreplace-0001.yaml similarity index 100% rename from test/cases/testdata/regexreplace/test-regexreplace-0001.yaml rename to test/cases/testdata/v0/regexreplace/test-regexreplace-0001.yaml diff --git a/test/cases/testdata/regexsplit/test-regexsplit-0862.yaml b/test/cases/testdata/v0/regexsplit/test-regexsplit-0862.yaml similarity index 100% rename from test/cases/testdata/regexsplit/test-regexsplit-0862.yaml rename to test/cases/testdata/v0/regexsplit/test-regexsplit-0862.yaml diff --git a/test/cases/testdata/regexsplit/test-regexsplit-0863.yaml b/test/cases/testdata/v0/regexsplit/test-regexsplit-0863.yaml similarity index 100% rename from test/cases/testdata/regexsplit/test-regexsplit-0863.yaml rename to test/cases/testdata/v0/regexsplit/test-regexsplit-0863.yaml diff --git a/test/cases/testdata/regexsplit/test-regexsplit-0864.yaml b/test/cases/testdata/v0/regexsplit/test-regexsplit-0864.yaml similarity index 100% rename from test/cases/testdata/regexsplit/test-regexsplit-0864.yaml rename to test/cases/testdata/v0/regexsplit/test-regexsplit-0864.yaml diff --git a/test/cases/testdata/regometadatachain/test-regometadatachain-1.yaml b/test/cases/testdata/v0/regometadatachain/test-regometadatachain-1.yaml similarity index 100% rename from test/cases/testdata/regometadatachain/test-regometadatachain-1.yaml rename to test/cases/testdata/v0/regometadatachain/test-regometadatachain-1.yaml diff --git a/test/cases/testdata/regometadatarule/test-regometadatarule-1.yaml b/test/cases/testdata/v0/regometadatarule/test-regometadatarule-1.yaml similarity index 100% rename from test/cases/testdata/regometadatarule/test-regometadatarule-1.yaml rename to test/cases/testdata/v0/regometadatarule/test-regometadatarule-1.yaml diff --git a/test/cases/testdata/regoparsemodule/test-regoparsemodule-0320.yaml b/test/cases/testdata/v0/regoparsemodule/test-regoparsemodule-0320.yaml similarity index 100% rename from test/cases/testdata/regoparsemodule/test-regoparsemodule-0320.yaml rename to test/cases/testdata/v0/regoparsemodule/test-regoparsemodule-0320.yaml diff --git a/test/cases/testdata/regoparsemodule/test-regoparsemodule-0321.yaml b/test/cases/testdata/v0/regoparsemodule/test-regoparsemodule-0321.yaml similarity index 100% rename from test/cases/testdata/regoparsemodule/test-regoparsemodule-0321.yaml rename to test/cases/testdata/v0/regoparsemodule/test-regoparsemodule-0321.yaml diff --git a/test/cases/testdata/rendertemplate/rendertemplate.yaml b/test/cases/testdata/v0/rendertemplate/rendertemplate.yaml similarity index 100% rename from test/cases/testdata/rendertemplate/rendertemplate.yaml rename to test/cases/testdata/v0/rendertemplate/rendertemplate.yaml diff --git a/test/cases/testdata/replacen/test-replacen-0374.yaml b/test/cases/testdata/v0/replacen/test-replacen-0374.yaml similarity index 100% rename from test/cases/testdata/replacen/test-replacen-0374.yaml rename to test/cases/testdata/v0/replacen/test-replacen-0374.yaml diff --git a/test/cases/testdata/replacen/test-replacen-0375.yaml b/test/cases/testdata/v0/replacen/test-replacen-0375.yaml similarity index 100% rename from test/cases/testdata/replacen/test-replacen-0375.yaml rename to test/cases/testdata/v0/replacen/test-replacen-0375.yaml diff --git a/test/cases/testdata/replacen/test-replacen-bad-operands.yaml b/test/cases/testdata/v0/replacen/test-replacen-bad-operands.yaml similarity index 100% rename from test/cases/testdata/replacen/test-replacen-bad-operands.yaml rename to test/cases/testdata/v0/replacen/test-replacen-bad-operands.yaml diff --git a/test/cases/testdata/semvercompare/test-semvercompare-0344.yaml b/test/cases/testdata/v0/semvercompare/test-semvercompare-0344.yaml similarity index 100% rename from test/cases/testdata/semvercompare/test-semvercompare-0344.yaml rename to test/cases/testdata/v0/semvercompare/test-semvercompare-0344.yaml diff --git a/test/cases/testdata/semvercompare/test-semvercompare-0345.yaml b/test/cases/testdata/v0/semvercompare/test-semvercompare-0345.yaml similarity index 100% rename from test/cases/testdata/semvercompare/test-semvercompare-0345.yaml rename to test/cases/testdata/v0/semvercompare/test-semvercompare-0345.yaml diff --git a/test/cases/testdata/semvercompare/test-semvercompare-0346.yaml b/test/cases/testdata/v0/semvercompare/test-semvercompare-0346.yaml similarity index 100% rename from test/cases/testdata/semvercompare/test-semvercompare-0346.yaml rename to test/cases/testdata/v0/semvercompare/test-semvercompare-0346.yaml diff --git a/test/cases/testdata/semvercompare/test-semvercompare-0347.yaml b/test/cases/testdata/v0/semvercompare/test-semvercompare-0347.yaml similarity index 100% rename from test/cases/testdata/semvercompare/test-semvercompare-0347.yaml rename to test/cases/testdata/v0/semvercompare/test-semvercompare-0347.yaml diff --git a/test/cases/testdata/semvercompare/test-semvercompare-0348.yaml b/test/cases/testdata/v0/semvercompare/test-semvercompare-0348.yaml similarity index 100% rename from test/cases/testdata/semvercompare/test-semvercompare-0348.yaml rename to test/cases/testdata/v0/semvercompare/test-semvercompare-0348.yaml diff --git a/test/cases/testdata/semverisvalid/test-semverisvalid-0349.yaml b/test/cases/testdata/v0/semverisvalid/test-semverisvalid-0349.yaml similarity index 100% rename from test/cases/testdata/semverisvalid/test-semverisvalid-0349.yaml rename to test/cases/testdata/v0/semverisvalid/test-semverisvalid-0349.yaml diff --git a/test/cases/testdata/semverisvalid/test-semverisvalid-0350.yaml b/test/cases/testdata/v0/semverisvalid/test-semverisvalid-0350.yaml similarity index 100% rename from test/cases/testdata/semverisvalid/test-semverisvalid-0350.yaml rename to test/cases/testdata/v0/semverisvalid/test-semverisvalid-0350.yaml diff --git a/test/cases/testdata/semverisvalid/test-semverisvalid-0351.yaml b/test/cases/testdata/v0/semverisvalid/test-semverisvalid-0351.yaml similarity index 100% rename from test/cases/testdata/semverisvalid/test-semverisvalid-0351.yaml rename to test/cases/testdata/v0/semverisvalid/test-semverisvalid-0351.yaml diff --git a/test/cases/testdata/sets/test-sets-0871.yaml b/test/cases/testdata/v0/sets/test-sets-0871.yaml similarity index 100% rename from test/cases/testdata/sets/test-sets-0871.yaml rename to test/cases/testdata/v0/sets/test-sets-0871.yaml diff --git a/test/cases/testdata/sets/test-sets-0872.yaml b/test/cases/testdata/v0/sets/test-sets-0872.yaml similarity index 100% rename from test/cases/testdata/sets/test-sets-0872.yaml rename to test/cases/testdata/v0/sets/test-sets-0872.yaml diff --git a/test/cases/testdata/sets/test-sets-0873.yaml b/test/cases/testdata/v0/sets/test-sets-0873.yaml similarity index 100% rename from test/cases/testdata/sets/test-sets-0873.yaml rename to test/cases/testdata/v0/sets/test-sets-0873.yaml diff --git a/test/cases/testdata/sets/test-sets-0874.yaml b/test/cases/testdata/v0/sets/test-sets-0874.yaml similarity index 100% rename from test/cases/testdata/sets/test-sets-0874.yaml rename to test/cases/testdata/v0/sets/test-sets-0874.yaml diff --git a/test/cases/testdata/sets/test-sets-0875.yaml b/test/cases/testdata/v0/sets/test-sets-0875.yaml similarity index 100% rename from test/cases/testdata/sets/test-sets-0875.yaml rename to test/cases/testdata/v0/sets/test-sets-0875.yaml diff --git a/test/cases/testdata/sets/test-sets-0876.yaml b/test/cases/testdata/v0/sets/test-sets-0876.yaml similarity index 100% rename from test/cases/testdata/sets/test-sets-0876.yaml rename to test/cases/testdata/v0/sets/test-sets-0876.yaml diff --git a/test/cases/testdata/sprintf/test-sprintf.yaml b/test/cases/testdata/v0/sprintf/test-sprintf.yaml similarity index 100% rename from test/cases/testdata/sprintf/test-sprintf.yaml rename to test/cases/testdata/v0/sprintf/test-sprintf.yaml diff --git a/test/cases/testdata/strings/test-anyprefixmatch.yaml b/test/cases/testdata/v0/strings/test-anyprefixmatch.yaml similarity index 100% rename from test/cases/testdata/strings/test-anyprefixmatch.yaml rename to test/cases/testdata/v0/strings/test-anyprefixmatch.yaml diff --git a/test/cases/testdata/strings/test-anysuffixmatch.yaml b/test/cases/testdata/v0/strings/test-anysuffixmatch.yaml similarity index 100% rename from test/cases/testdata/strings/test-anysuffixmatch.yaml rename to test/cases/testdata/v0/strings/test-anysuffixmatch.yaml diff --git a/test/cases/testdata/strings/test-strings-0877.yaml b/test/cases/testdata/v0/strings/test-strings-0877.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0877.yaml rename to test/cases/testdata/v0/strings/test-strings-0877.yaml diff --git a/test/cases/testdata/strings/test-strings-0878.yaml b/test/cases/testdata/v0/strings/test-strings-0878.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0878.yaml rename to test/cases/testdata/v0/strings/test-strings-0878.yaml diff --git a/test/cases/testdata/strings/test-strings-0879.yaml b/test/cases/testdata/v0/strings/test-strings-0879.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0879.yaml rename to test/cases/testdata/v0/strings/test-strings-0879.yaml diff --git a/test/cases/testdata/strings/test-strings-0880.yaml b/test/cases/testdata/v0/strings/test-strings-0880.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0880.yaml rename to test/cases/testdata/v0/strings/test-strings-0880.yaml diff --git a/test/cases/testdata/strings/test-strings-0881.yaml b/test/cases/testdata/v0/strings/test-strings-0881.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0881.yaml rename to test/cases/testdata/v0/strings/test-strings-0881.yaml diff --git a/test/cases/testdata/strings/test-strings-0882.yaml b/test/cases/testdata/v0/strings/test-strings-0882.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0882.yaml rename to test/cases/testdata/v0/strings/test-strings-0882.yaml diff --git a/test/cases/testdata/strings/test-strings-0883.yaml b/test/cases/testdata/v0/strings/test-strings-0883.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0883.yaml rename to test/cases/testdata/v0/strings/test-strings-0883.yaml diff --git a/test/cases/testdata/strings/test-strings-0884.yaml b/test/cases/testdata/v0/strings/test-strings-0884.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0884.yaml rename to test/cases/testdata/v0/strings/test-strings-0884.yaml diff --git a/test/cases/testdata/strings/test-strings-0885.yaml b/test/cases/testdata/v0/strings/test-strings-0885.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0885.yaml rename to test/cases/testdata/v0/strings/test-strings-0885.yaml diff --git a/test/cases/testdata/strings/test-strings-0886.yaml b/test/cases/testdata/v0/strings/test-strings-0886.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0886.yaml rename to test/cases/testdata/v0/strings/test-strings-0886.yaml diff --git a/test/cases/testdata/strings/test-strings-0887.yaml b/test/cases/testdata/v0/strings/test-strings-0887.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0887.yaml rename to test/cases/testdata/v0/strings/test-strings-0887.yaml diff --git a/test/cases/testdata/strings/test-strings-0888.yaml b/test/cases/testdata/v0/strings/test-strings-0888.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0888.yaml rename to test/cases/testdata/v0/strings/test-strings-0888.yaml diff --git a/test/cases/testdata/strings/test-strings-0889.yaml b/test/cases/testdata/v0/strings/test-strings-0889.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0889.yaml rename to test/cases/testdata/v0/strings/test-strings-0889.yaml diff --git a/test/cases/testdata/strings/test-strings-0890.yaml b/test/cases/testdata/v0/strings/test-strings-0890.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0890.yaml rename to test/cases/testdata/v0/strings/test-strings-0890.yaml diff --git a/test/cases/testdata/strings/test-strings-0891.yaml b/test/cases/testdata/v0/strings/test-strings-0891.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0891.yaml rename to test/cases/testdata/v0/strings/test-strings-0891.yaml diff --git a/test/cases/testdata/strings/test-strings-0892.yaml b/test/cases/testdata/v0/strings/test-strings-0892.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0892.yaml rename to test/cases/testdata/v0/strings/test-strings-0892.yaml diff --git a/test/cases/testdata/strings/test-strings-0893.yaml b/test/cases/testdata/v0/strings/test-strings-0893.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0893.yaml rename to test/cases/testdata/v0/strings/test-strings-0893.yaml diff --git a/test/cases/testdata/strings/test-strings-0894.yaml b/test/cases/testdata/v0/strings/test-strings-0894.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0894.yaml rename to test/cases/testdata/v0/strings/test-strings-0894.yaml diff --git a/test/cases/testdata/strings/test-strings-0895.yaml b/test/cases/testdata/v0/strings/test-strings-0895.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0895.yaml rename to test/cases/testdata/v0/strings/test-strings-0895.yaml diff --git a/test/cases/testdata/strings/test-strings-0896.yaml b/test/cases/testdata/v0/strings/test-strings-0896.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0896.yaml rename to test/cases/testdata/v0/strings/test-strings-0896.yaml diff --git a/test/cases/testdata/strings/test-strings-0897.yaml b/test/cases/testdata/v0/strings/test-strings-0897.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0897.yaml rename to test/cases/testdata/v0/strings/test-strings-0897.yaml diff --git a/test/cases/testdata/strings/test-strings-0898.yaml b/test/cases/testdata/v0/strings/test-strings-0898.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0898.yaml rename to test/cases/testdata/v0/strings/test-strings-0898.yaml diff --git a/test/cases/testdata/strings/test-strings-0899.yaml b/test/cases/testdata/v0/strings/test-strings-0899.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0899.yaml rename to test/cases/testdata/v0/strings/test-strings-0899.yaml diff --git a/test/cases/testdata/strings/test-strings-0900.yaml b/test/cases/testdata/v0/strings/test-strings-0900.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0900.yaml rename to test/cases/testdata/v0/strings/test-strings-0900.yaml diff --git a/test/cases/testdata/strings/test-strings-0901.yaml b/test/cases/testdata/v0/strings/test-strings-0901.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0901.yaml rename to test/cases/testdata/v0/strings/test-strings-0901.yaml diff --git a/test/cases/testdata/strings/test-strings-0902.yaml b/test/cases/testdata/v0/strings/test-strings-0902.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0902.yaml rename to test/cases/testdata/v0/strings/test-strings-0902.yaml diff --git a/test/cases/testdata/strings/test-strings-0903.yaml b/test/cases/testdata/v0/strings/test-strings-0903.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0903.yaml rename to test/cases/testdata/v0/strings/test-strings-0903.yaml diff --git a/test/cases/testdata/strings/test-strings-0904.yaml b/test/cases/testdata/v0/strings/test-strings-0904.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0904.yaml rename to test/cases/testdata/v0/strings/test-strings-0904.yaml diff --git a/test/cases/testdata/strings/test-strings-0905.yaml b/test/cases/testdata/v0/strings/test-strings-0905.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0905.yaml rename to test/cases/testdata/v0/strings/test-strings-0905.yaml diff --git a/test/cases/testdata/strings/test-strings-0906.yaml b/test/cases/testdata/v0/strings/test-strings-0906.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0906.yaml rename to test/cases/testdata/v0/strings/test-strings-0906.yaml diff --git a/test/cases/testdata/strings/test-strings-0907.yaml b/test/cases/testdata/v0/strings/test-strings-0907.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0907.yaml rename to test/cases/testdata/v0/strings/test-strings-0907.yaml diff --git a/test/cases/testdata/strings/test-strings-0908.yaml b/test/cases/testdata/v0/strings/test-strings-0908.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0908.yaml rename to test/cases/testdata/v0/strings/test-strings-0908.yaml diff --git a/test/cases/testdata/strings/test-strings-0909.yaml b/test/cases/testdata/v0/strings/test-strings-0909.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0909.yaml rename to test/cases/testdata/v0/strings/test-strings-0909.yaml diff --git a/test/cases/testdata/strings/test-strings-0910.yaml b/test/cases/testdata/v0/strings/test-strings-0910.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0910.yaml rename to test/cases/testdata/v0/strings/test-strings-0910.yaml diff --git a/test/cases/testdata/strings/test-strings-0911.yaml b/test/cases/testdata/v0/strings/test-strings-0911.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0911.yaml rename to test/cases/testdata/v0/strings/test-strings-0911.yaml diff --git a/test/cases/testdata/strings/test-strings-0912.yaml b/test/cases/testdata/v0/strings/test-strings-0912.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0912.yaml rename to test/cases/testdata/v0/strings/test-strings-0912.yaml diff --git a/test/cases/testdata/strings/test-strings-0913.yaml b/test/cases/testdata/v0/strings/test-strings-0913.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0913.yaml rename to test/cases/testdata/v0/strings/test-strings-0913.yaml diff --git a/test/cases/testdata/strings/test-strings-0914.yaml b/test/cases/testdata/v0/strings/test-strings-0914.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0914.yaml rename to test/cases/testdata/v0/strings/test-strings-0914.yaml diff --git a/test/cases/testdata/strings/test-strings-0915.yaml b/test/cases/testdata/v0/strings/test-strings-0915.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0915.yaml rename to test/cases/testdata/v0/strings/test-strings-0915.yaml diff --git a/test/cases/testdata/strings/test-strings-0916.yaml b/test/cases/testdata/v0/strings/test-strings-0916.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0916.yaml rename to test/cases/testdata/v0/strings/test-strings-0916.yaml diff --git a/test/cases/testdata/strings/test-strings-0917.yaml b/test/cases/testdata/v0/strings/test-strings-0917.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0917.yaml rename to test/cases/testdata/v0/strings/test-strings-0917.yaml diff --git a/test/cases/testdata/strings/test-strings-0918.yaml b/test/cases/testdata/v0/strings/test-strings-0918.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0918.yaml rename to test/cases/testdata/v0/strings/test-strings-0918.yaml diff --git a/test/cases/testdata/strings/test-strings-0919.yaml b/test/cases/testdata/v0/strings/test-strings-0919.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0919.yaml rename to test/cases/testdata/v0/strings/test-strings-0919.yaml diff --git a/test/cases/testdata/strings/test-strings-0920.yaml b/test/cases/testdata/v0/strings/test-strings-0920.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0920.yaml rename to test/cases/testdata/v0/strings/test-strings-0920.yaml diff --git a/test/cases/testdata/strings/test-strings-0921.yaml b/test/cases/testdata/v0/strings/test-strings-0921.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0921.yaml rename to test/cases/testdata/v0/strings/test-strings-0921.yaml diff --git a/test/cases/testdata/strings/test-strings-0922.yaml b/test/cases/testdata/v0/strings/test-strings-0922.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0922.yaml rename to test/cases/testdata/v0/strings/test-strings-0922.yaml diff --git a/test/cases/testdata/strings/test-strings-0923.yaml b/test/cases/testdata/v0/strings/test-strings-0923.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0923.yaml rename to test/cases/testdata/v0/strings/test-strings-0923.yaml diff --git a/test/cases/testdata/strings/test-strings-0924.yaml b/test/cases/testdata/v0/strings/test-strings-0924.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0924.yaml rename to test/cases/testdata/v0/strings/test-strings-0924.yaml diff --git a/test/cases/testdata/strings/test-strings-0925.yaml b/test/cases/testdata/v0/strings/test-strings-0925.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0925.yaml rename to test/cases/testdata/v0/strings/test-strings-0925.yaml diff --git a/test/cases/testdata/strings/test-strings-0926.yaml b/test/cases/testdata/v0/strings/test-strings-0926.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-0926.yaml rename to test/cases/testdata/v0/strings/test-strings-0926.yaml diff --git a/test/cases/testdata/strings/test-strings-indexof-unicode.yaml b/test/cases/testdata/v0/strings/test-strings-indexof-unicode.yaml similarity index 100% rename from test/cases/testdata/strings/test-strings-indexof-unicode.yaml rename to test/cases/testdata/v0/strings/test-strings-indexof-unicode.yaml diff --git a/test/cases/testdata/subset/test-subset.yaml b/test/cases/testdata/v0/subset/test-subset.yaml similarity index 100% rename from test/cases/testdata/subset/test-subset.yaml rename to test/cases/testdata/v0/subset/test-subset.yaml diff --git a/test/cases/testdata/time/test-time-0947.yaml b/test/cases/testdata/v0/time/test-time-0947.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0947.yaml rename to test/cases/testdata/v0/time/test-time-0947.yaml diff --git a/test/cases/testdata/time/test-time-0948.yaml b/test/cases/testdata/v0/time/test-time-0948.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0948.yaml rename to test/cases/testdata/v0/time/test-time-0948.yaml diff --git a/test/cases/testdata/time/test-time-0949.yaml b/test/cases/testdata/v0/time/test-time-0949.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0949.yaml rename to test/cases/testdata/v0/time/test-time-0949.yaml diff --git a/test/cases/testdata/time/test-time-0950.yaml b/test/cases/testdata/v0/time/test-time-0950.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0950.yaml rename to test/cases/testdata/v0/time/test-time-0950.yaml diff --git a/test/cases/testdata/time/test-time-0951.yaml b/test/cases/testdata/v0/time/test-time-0951.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0951.yaml rename to test/cases/testdata/v0/time/test-time-0951.yaml diff --git a/test/cases/testdata/time/test-time-0952.yaml b/test/cases/testdata/v0/time/test-time-0952.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0952.yaml rename to test/cases/testdata/v0/time/test-time-0952.yaml diff --git a/test/cases/testdata/time/test-time-0953.yaml b/test/cases/testdata/v0/time/test-time-0953.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0953.yaml rename to test/cases/testdata/v0/time/test-time-0953.yaml diff --git a/test/cases/testdata/time/test-time-0954.yaml b/test/cases/testdata/v0/time/test-time-0954.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0954.yaml rename to test/cases/testdata/v0/time/test-time-0954.yaml diff --git a/test/cases/testdata/time/test-time-0955.yaml b/test/cases/testdata/v0/time/test-time-0955.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0955.yaml rename to test/cases/testdata/v0/time/test-time-0955.yaml diff --git a/test/cases/testdata/time/test-time-0956.yaml b/test/cases/testdata/v0/time/test-time-0956.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0956.yaml rename to test/cases/testdata/v0/time/test-time-0956.yaml diff --git a/test/cases/testdata/time/test-time-0957.yaml b/test/cases/testdata/v0/time/test-time-0957.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0957.yaml rename to test/cases/testdata/v0/time/test-time-0957.yaml diff --git a/test/cases/testdata/time/test-time-0958.yaml b/test/cases/testdata/v0/time/test-time-0958.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0958.yaml rename to test/cases/testdata/v0/time/test-time-0958.yaml diff --git a/test/cases/testdata/time/test-time-0959.yaml b/test/cases/testdata/v0/time/test-time-0959.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0959.yaml rename to test/cases/testdata/v0/time/test-time-0959.yaml diff --git a/test/cases/testdata/time/test-time-0960.yaml b/test/cases/testdata/v0/time/test-time-0960.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0960.yaml rename to test/cases/testdata/v0/time/test-time-0960.yaml diff --git a/test/cases/testdata/time/test-time-0961.yaml b/test/cases/testdata/v0/time/test-time-0961.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0961.yaml rename to test/cases/testdata/v0/time/test-time-0961.yaml diff --git a/test/cases/testdata/time/test-time-0962.yaml b/test/cases/testdata/v0/time/test-time-0962.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0962.yaml rename to test/cases/testdata/v0/time/test-time-0962.yaml diff --git a/test/cases/testdata/time/test-time-0963.yaml b/test/cases/testdata/v0/time/test-time-0963.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0963.yaml rename to test/cases/testdata/v0/time/test-time-0963.yaml diff --git a/test/cases/testdata/time/test-time-0964.yaml b/test/cases/testdata/v0/time/test-time-0964.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0964.yaml rename to test/cases/testdata/v0/time/test-time-0964.yaml diff --git a/test/cases/testdata/time/test-time-0965.yaml b/test/cases/testdata/v0/time/test-time-0965.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0965.yaml rename to test/cases/testdata/v0/time/test-time-0965.yaml diff --git a/test/cases/testdata/time/test-time-0966.yaml b/test/cases/testdata/v0/time/test-time-0966.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0966.yaml rename to test/cases/testdata/v0/time/test-time-0966.yaml diff --git a/test/cases/testdata/time/test-time-0967.yaml b/test/cases/testdata/v0/time/test-time-0967.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0967.yaml rename to test/cases/testdata/v0/time/test-time-0967.yaml diff --git a/test/cases/testdata/time/test-time-0968.yaml b/test/cases/testdata/v0/time/test-time-0968.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0968.yaml rename to test/cases/testdata/v0/time/test-time-0968.yaml diff --git a/test/cases/testdata/time/test-time-0969.yaml b/test/cases/testdata/v0/time/test-time-0969.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0969.yaml rename to test/cases/testdata/v0/time/test-time-0969.yaml diff --git a/test/cases/testdata/time/test-time-0970.yaml b/test/cases/testdata/v0/time/test-time-0970.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0970.yaml rename to test/cases/testdata/v0/time/test-time-0970.yaml diff --git a/test/cases/testdata/time/test-time-0971.yaml b/test/cases/testdata/v0/time/test-time-0971.yaml similarity index 100% rename from test/cases/testdata/time/test-time-0971.yaml rename to test/cases/testdata/v0/time/test-time-0971.yaml diff --git a/test/cases/testdata/toarray/test-toarray-0071.yaml b/test/cases/testdata/v0/toarray/test-toarray-0071.yaml similarity index 100% rename from test/cases/testdata/toarray/test-toarray-0071.yaml rename to test/cases/testdata/v0/toarray/test-toarray-0071.yaml diff --git a/test/cases/testdata/toarray/test-toarray-0072.yaml b/test/cases/testdata/v0/toarray/test-toarray-0072.yaml similarity index 100% rename from test/cases/testdata/toarray/test-toarray-0072.yaml rename to test/cases/testdata/v0/toarray/test-toarray-0072.yaml diff --git a/test/cases/testdata/toarray/test-toarray-0073.yaml b/test/cases/testdata/v0/toarray/test-toarray-0073.yaml similarity index 100% rename from test/cases/testdata/toarray/test-toarray-0073.yaml rename to test/cases/testdata/v0/toarray/test-toarray-0073.yaml diff --git a/test/cases/testdata/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml b/test/cases/testdata/v0/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml similarity index 100% rename from test/cases/testdata/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml rename to test/cases/testdata/v0/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml diff --git a/test/cases/testdata/toset/test-toset-0074.yaml b/test/cases/testdata/v0/toset/test-toset-0074.yaml similarity index 100% rename from test/cases/testdata/toset/test-toset-0074.yaml rename to test/cases/testdata/v0/toset/test-toset-0074.yaml diff --git a/test/cases/testdata/toset/test-toset-0075.yaml b/test/cases/testdata/v0/toset/test-toset-0075.yaml similarity index 100% rename from test/cases/testdata/toset/test-toset-0075.yaml rename to test/cases/testdata/v0/toset/test-toset-0075.yaml diff --git a/test/cases/testdata/toset/test-toset-0076.yaml b/test/cases/testdata/v0/toset/test-toset-0076.yaml similarity index 100% rename from test/cases/testdata/toset/test-toset-0076.yaml rename to test/cases/testdata/v0/toset/test-toset-0076.yaml diff --git a/test/cases/testdata/trim/test-trim-0362.yaml b/test/cases/testdata/v0/trim/test-trim-0362.yaml similarity index 100% rename from test/cases/testdata/trim/test-trim-0362.yaml rename to test/cases/testdata/v0/trim/test-trim-0362.yaml diff --git a/test/cases/testdata/trim/test-trim-0363.yaml b/test/cases/testdata/v0/trim/test-trim-0363.yaml similarity index 100% rename from test/cases/testdata/trim/test-trim-0363.yaml rename to test/cases/testdata/v0/trim/test-trim-0363.yaml diff --git a/test/cases/testdata/trimleft/test-trimleft-0364.yaml b/test/cases/testdata/v0/trimleft/test-trimleft-0364.yaml similarity index 100% rename from test/cases/testdata/trimleft/test-trimleft-0364.yaml rename to test/cases/testdata/v0/trimleft/test-trimleft-0364.yaml diff --git a/test/cases/testdata/trimleft/test-trimleft-0365.yaml b/test/cases/testdata/v0/trimleft/test-trimleft-0365.yaml similarity index 100% rename from test/cases/testdata/trimleft/test-trimleft-0365.yaml rename to test/cases/testdata/v0/trimleft/test-trimleft-0365.yaml diff --git a/test/cases/testdata/trimprefix/test-trimprefix-0366.yaml b/test/cases/testdata/v0/trimprefix/test-trimprefix-0366.yaml similarity index 100% rename from test/cases/testdata/trimprefix/test-trimprefix-0366.yaml rename to test/cases/testdata/v0/trimprefix/test-trimprefix-0366.yaml diff --git a/test/cases/testdata/trimprefix/test-trimprefix-0367.yaml b/test/cases/testdata/v0/trimprefix/test-trimprefix-0367.yaml similarity index 100% rename from test/cases/testdata/trimprefix/test-trimprefix-0367.yaml rename to test/cases/testdata/v0/trimprefix/test-trimprefix-0367.yaml diff --git a/test/cases/testdata/trimright/test-trimright-0368.yaml b/test/cases/testdata/v0/trimright/test-trimright-0368.yaml similarity index 100% rename from test/cases/testdata/trimright/test-trimright-0368.yaml rename to test/cases/testdata/v0/trimright/test-trimright-0368.yaml diff --git a/test/cases/testdata/trimright/test-trimright-0369.yaml b/test/cases/testdata/v0/trimright/test-trimright-0369.yaml similarity index 100% rename from test/cases/testdata/trimright/test-trimright-0369.yaml rename to test/cases/testdata/v0/trimright/test-trimright-0369.yaml diff --git a/test/cases/testdata/trimspace/test-trimspace-0372.yaml b/test/cases/testdata/v0/trimspace/test-trimspace-0372.yaml similarity index 100% rename from test/cases/testdata/trimspace/test-trimspace-0372.yaml rename to test/cases/testdata/v0/trimspace/test-trimspace-0372.yaml diff --git a/test/cases/testdata/trimspace/test-trimspace-0373.yaml b/test/cases/testdata/v0/trimspace/test-trimspace-0373.yaml similarity index 100% rename from test/cases/testdata/trimspace/test-trimspace-0373.yaml rename to test/cases/testdata/v0/trimspace/test-trimspace-0373.yaml diff --git a/test/cases/testdata/trimsuffix/test-trimsuffix-0370.yaml b/test/cases/testdata/v0/trimsuffix/test-trimsuffix-0370.yaml similarity index 100% rename from test/cases/testdata/trimsuffix/test-trimsuffix-0370.yaml rename to test/cases/testdata/v0/trimsuffix/test-trimsuffix-0370.yaml diff --git a/test/cases/testdata/trimsuffix/test-trimsuffix-0371.yaml b/test/cases/testdata/v0/trimsuffix/test-trimsuffix-0371.yaml similarity index 100% rename from test/cases/testdata/trimsuffix/test-trimsuffix-0371.yaml rename to test/cases/testdata/v0/trimsuffix/test-trimsuffix-0371.yaml diff --git a/test/cases/testdata/type/test-regressions.yaml b/test/cases/testdata/v0/type/test-regressions.yaml similarity index 100% rename from test/cases/testdata/type/test-regressions.yaml rename to test/cases/testdata/v0/type/test-regressions.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0828.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0828.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0828.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0828.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0829.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0829.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0829.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0829.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0830.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0830.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0830.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0830.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0831.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0831.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0831.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0831.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0832.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0832.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0832.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0832.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0833.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0833.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0833.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0833.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0834.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0834.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0834.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0834.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0835.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0835.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0835.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0835.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0836.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0836.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0836.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0836.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0837.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0837.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0837.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0837.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0838.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0838.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0838.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0838.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0839.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0839.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0839.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0839.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0840.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0840.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0840.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0840.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0841.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0841.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0841.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0841.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0842.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0842.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0842.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0842.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0843.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0843.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0843.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0843.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0844.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0844.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0844.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0844.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0845.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0845.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0845.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0845.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0846.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0846.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0846.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0846.yaml diff --git a/test/cases/testdata/typebuiltin/test-typebuiltin-0847.yaml b/test/cases/testdata/v0/typebuiltin/test-typebuiltin-0847.yaml similarity index 100% rename from test/cases/testdata/typebuiltin/test-typebuiltin-0847.yaml rename to test/cases/testdata/v0/typebuiltin/test-typebuiltin-0847.yaml diff --git a/test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0848.yaml b/test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0848.yaml similarity index 100% rename from test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0848.yaml rename to test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0848.yaml diff --git a/test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0849.yaml b/test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0849.yaml similarity index 100% rename from test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0849.yaml rename to test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0849.yaml diff --git a/test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0850.yaml b/test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0850.yaml similarity index 100% rename from test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0850.yaml rename to test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0850.yaml diff --git a/test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0851.yaml b/test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0851.yaml similarity index 100% rename from test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0851.yaml rename to test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0851.yaml diff --git a/test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0852.yaml b/test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0852.yaml similarity index 100% rename from test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0852.yaml rename to test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0852.yaml diff --git a/test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0853.yaml b/test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0853.yaml similarity index 100% rename from test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0853.yaml rename to test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0853.yaml diff --git a/test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0854.yaml b/test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0854.yaml similarity index 100% rename from test/cases/testdata/typenamebuiltin/test-typenamebuiltin-0854.yaml rename to test/cases/testdata/v0/typenamebuiltin/test-typenamebuiltin-0854.yaml diff --git a/test/cases/testdata/undos/test-undos-0599.yaml b/test/cases/testdata/v0/undos/test-undos-0599.yaml similarity index 100% rename from test/cases/testdata/undos/test-undos-0599.yaml rename to test/cases/testdata/v0/undos/test-undos-0599.yaml diff --git a/test/cases/testdata/undos/test-undos-0600.yaml b/test/cases/testdata/v0/undos/test-undos-0600.yaml similarity index 100% rename from test/cases/testdata/undos/test-undos-0600.yaml rename to test/cases/testdata/v0/undos/test-undos-0600.yaml diff --git a/test/cases/testdata/undos/test-undos-0601.yaml b/test/cases/testdata/v0/undos/test-undos-0601.yaml similarity index 100% rename from test/cases/testdata/undos/test-undos-0601.yaml rename to test/cases/testdata/v0/undos/test-undos-0601.yaml diff --git a/test/cases/testdata/undos/test-undos-0602.yaml b/test/cases/testdata/v0/undos/test-undos-0602.yaml similarity index 100% rename from test/cases/testdata/undos/test-undos-0602.yaml rename to test/cases/testdata/v0/undos/test-undos-0602.yaml diff --git a/test/cases/testdata/undos/test-undos-0603.yaml b/test/cases/testdata/v0/undos/test-undos-0603.yaml similarity index 100% rename from test/cases/testdata/undos/test-undos-0603.yaml rename to test/cases/testdata/v0/undos/test-undos-0603.yaml diff --git a/test/cases/testdata/undos/test-undos-0604.yaml b/test/cases/testdata/v0/undos/test-undos-0604.yaml similarity index 100% rename from test/cases/testdata/undos/test-undos-0604.yaml rename to test/cases/testdata/v0/undos/test-undos-0604.yaml diff --git a/test/cases/testdata/undos/test-undos-0605.yaml b/test/cases/testdata/v0/undos/test-undos-0605.yaml similarity index 100% rename from test/cases/testdata/undos/test-undos-0605.yaml rename to test/cases/testdata/v0/undos/test-undos-0605.yaml diff --git a/test/cases/testdata/undos/test-undos-0606.yaml b/test/cases/testdata/v0/undos/test-undos-0606.yaml similarity index 100% rename from test/cases/testdata/undos/test-undos-0606.yaml rename to test/cases/testdata/v0/undos/test-undos-0606.yaml diff --git a/test/cases/testdata/undos/test-undos-0607.yaml b/test/cases/testdata/v0/undos/test-undos-0607.yaml similarity index 100% rename from test/cases/testdata/undos/test-undos-0607.yaml rename to test/cases/testdata/v0/undos/test-undos-0607.yaml diff --git a/test/cases/testdata/union/test-union-0357.yaml b/test/cases/testdata/v0/union/test-union-0357.yaml similarity index 100% rename from test/cases/testdata/union/test-union-0357.yaml rename to test/cases/testdata/v0/union/test-union-0357.yaml diff --git a/test/cases/testdata/union/test-union-0358.yaml b/test/cases/testdata/v0/union/test-union-0358.yaml similarity index 100% rename from test/cases/testdata/union/test-union-0358.yaml rename to test/cases/testdata/v0/union/test-union-0358.yaml diff --git a/test/cases/testdata/union/test-union-0359.yaml b/test/cases/testdata/v0/union/test-union-0359.yaml similarity index 100% rename from test/cases/testdata/union/test-union-0359.yaml rename to test/cases/testdata/v0/union/test-union-0359.yaml diff --git a/test/cases/testdata/union/test-union-0360.yaml b/test/cases/testdata/v0/union/test-union-0360.yaml similarity index 100% rename from test/cases/testdata/union/test-union-0360.yaml rename to test/cases/testdata/v0/union/test-union-0360.yaml diff --git a/test/cases/testdata/union/test-union-0361.yaml b/test/cases/testdata/v0/union/test-union-0361.yaml similarity index 100% rename from test/cases/testdata/union/test-union-0361.yaml rename to test/cases/testdata/v0/union/test-union-0361.yaml diff --git a/test/cases/testdata/units/test-issue-4856.yaml b/test/cases/testdata/v0/units/test-issue-4856.yaml similarity index 100% rename from test/cases/testdata/units/test-issue-4856.yaml rename to test/cases/testdata/v0/units/test-issue-4856.yaml diff --git a/test/cases/testdata/units/test-parse-bytes-comparisons.yaml b/test/cases/testdata/v0/units/test-parse-bytes-comparisons.yaml similarity index 100% rename from test/cases/testdata/units/test-parse-bytes-comparisons.yaml rename to test/cases/testdata/v0/units/test-parse-bytes-comparisons.yaml diff --git a/test/cases/testdata/units/test-parse-bytes-errors.yaml b/test/cases/testdata/v0/units/test-parse-bytes-errors.yaml similarity index 100% rename from test/cases/testdata/units/test-parse-bytes-errors.yaml rename to test/cases/testdata/v0/units/test-parse-bytes-errors.yaml diff --git a/test/cases/testdata/units/test-parse-bytes.yaml b/test/cases/testdata/v0/units/test-parse-bytes.yaml similarity index 100% rename from test/cases/testdata/units/test-parse-bytes.yaml rename to test/cases/testdata/v0/units/test-parse-bytes.yaml diff --git a/test/cases/testdata/units/test-parse-units-comparisons.yaml b/test/cases/testdata/v0/units/test-parse-units-comparisons.yaml similarity index 100% rename from test/cases/testdata/units/test-parse-units-comparisons.yaml rename to test/cases/testdata/v0/units/test-parse-units-comparisons.yaml diff --git a/test/cases/testdata/units/test-parse-units-errors.yaml b/test/cases/testdata/v0/units/test-parse-units-errors.yaml similarity index 100% rename from test/cases/testdata/units/test-parse-units-errors.yaml rename to test/cases/testdata/v0/units/test-parse-units-errors.yaml diff --git a/test/cases/testdata/units/test-parse-units.yaml b/test/cases/testdata/v0/units/test-parse-units.yaml similarity index 100% rename from test/cases/testdata/units/test-parse-units.yaml rename to test/cases/testdata/v0/units/test-parse-units.yaml diff --git a/test/cases/testdata/units/test-units-precision.yaml b/test/cases/testdata/v0/units/test-units-precision.yaml similarity index 100% rename from test/cases/testdata/units/test-units-precision.yaml rename to test/cases/testdata/v0/units/test-units-precision.yaml diff --git a/test/cases/testdata/urlbuiltins/test-urlbuiltins-0939.yaml b/test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0939.yaml similarity index 100% rename from test/cases/testdata/urlbuiltins/test-urlbuiltins-0939.yaml rename to test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0939.yaml diff --git a/test/cases/testdata/urlbuiltins/test-urlbuiltins-0940.yaml b/test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0940.yaml similarity index 100% rename from test/cases/testdata/urlbuiltins/test-urlbuiltins-0940.yaml rename to test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0940.yaml diff --git a/test/cases/testdata/urlbuiltins/test-urlbuiltins-0941.yaml b/test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0941.yaml similarity index 100% rename from test/cases/testdata/urlbuiltins/test-urlbuiltins-0941.yaml rename to test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0941.yaml diff --git a/test/cases/testdata/urlbuiltins/test-urlbuiltins-0942.yaml b/test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0942.yaml similarity index 100% rename from test/cases/testdata/urlbuiltins/test-urlbuiltins-0942.yaml rename to test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0942.yaml diff --git a/test/cases/testdata/urlbuiltins/test-urlbuiltins-0943.yaml b/test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0943.yaml similarity index 100% rename from test/cases/testdata/urlbuiltins/test-urlbuiltins-0943.yaml rename to test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0943.yaml diff --git a/test/cases/testdata/urlbuiltins/test-urlbuiltins-0944.yaml b/test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0944.yaml similarity index 100% rename from test/cases/testdata/urlbuiltins/test-urlbuiltins-0944.yaml rename to test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0944.yaml diff --git a/test/cases/testdata/urlbuiltins/test-urlbuiltins-0945.yaml b/test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0945.yaml similarity index 100% rename from test/cases/testdata/urlbuiltins/test-urlbuiltins-0945.yaml rename to test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0945.yaml diff --git a/test/cases/testdata/urlbuiltins/test-urlbuiltins-0946.yaml b/test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0946.yaml similarity index 100% rename from test/cases/testdata/urlbuiltins/test-urlbuiltins-0946.yaml rename to test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-0946.yaml diff --git a/test/cases/testdata/urlbuiltins/test-urlbuiltins-1076.yaml b/test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-1076.yaml similarity index 100% rename from test/cases/testdata/urlbuiltins/test-urlbuiltins-1076.yaml rename to test/cases/testdata/v0/urlbuiltins/test-urlbuiltins-1076.yaml diff --git a/test/cases/testdata/uuid/test-uuid-input-formats.yaml b/test/cases/testdata/v0/uuid/test-uuid-input-formats.yaml similarity index 100% rename from test/cases/testdata/uuid/test-uuid-input-formats.yaml rename to test/cases/testdata/v0/uuid/test-uuid-input-formats.yaml diff --git a/test/cases/testdata/uuid/test-uuid-parse-rule.yaml b/test/cases/testdata/v0/uuid/test-uuid-parse-rule.yaml similarity index 100% rename from test/cases/testdata/uuid/test-uuid-parse-rule.yaml rename to test/cases/testdata/v0/uuid/test-uuid-parse-rule.yaml diff --git a/test/cases/testdata/uuid/test-uuid-parse.yaml b/test/cases/testdata/v0/uuid/test-uuid-parse.yaml similarity index 100% rename from test/cases/testdata/uuid/test-uuid-parse.yaml rename to test/cases/testdata/v0/uuid/test-uuid-parse.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0726.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0726.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0726.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0726.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0727.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0727.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0727.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0727.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0728.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0728.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0728.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0728.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0729.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0729.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0729.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0729.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0730.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0730.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0730.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0730.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0731.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0731.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0731.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0731.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0732.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0732.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0732.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0732.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0733.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0733.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0733.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0733.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0734.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0734.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0734.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0734.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0735.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0735.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0735.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0735.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0736.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0736.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0736.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0736.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0737.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0737.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0737.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0737.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0738.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0738.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0738.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0738.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0739.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0739.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0739.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0739.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0740.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0740.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0740.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0740.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0741.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0741.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0741.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0741.yaml diff --git a/test/cases/testdata/varreferences/test-varreferences-0742.yaml b/test/cases/testdata/v0/varreferences/test-varreferences-0742.yaml similarity index 100% rename from test/cases/testdata/varreferences/test-varreferences-0742.yaml rename to test/cases/testdata/v0/varreferences/test-varreferences-0742.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0620.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0620.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0620.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0620.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0621.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0621.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0621.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0621.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0622.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0622.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0622.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0622.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0623.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0623.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0623.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0623.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0624.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0624.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0624.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0624.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0625.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0625.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0625.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0625.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0626.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0626.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0626.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0626.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0627.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0627.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0627.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0627.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0628.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0628.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0628.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0628.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0629.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0629.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0629.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0629.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0630.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0630.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0630.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0630.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0631.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0631.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0631.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0631.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0632.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0632.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0632.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0632.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0633.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0633.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0633.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0633.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0634.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0634.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0634.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0634.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0635.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0635.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0635.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0635.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0636.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0636.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0636.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0636.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0637.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0637.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0637.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0637.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0638.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0638.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0638.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0638.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0639.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0639.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0639.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0639.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0640.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0640.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0640.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0640.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0641.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0641.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0641.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0641.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0642.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0642.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0642.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0642.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0643.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0643.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0643.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0643.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0644.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0644.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0644.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0644.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0645.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0645.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0645.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0645.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0646.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0646.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0646.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0646.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0647.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0647.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0647.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0647.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0648.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0648.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0648.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0648.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0649.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0649.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0649.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0649.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0650.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0650.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0650.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0650.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0651.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0651.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0651.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0651.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0652.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0652.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0652.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0652.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0653.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0653.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0653.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0653.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0654.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0654.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0654.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0654.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0655.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0655.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0655.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0655.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0656.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0656.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0656.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0656.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0657.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0657.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0657.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0657.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0658.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0658.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0658.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0658.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0659.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0659.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0659.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0659.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0660.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0660.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0660.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0660.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0661.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0661.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0661.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0661.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0662.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0662.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0662.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0662.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0663.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0663.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0663.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0663.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0664.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0664.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0664.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0664.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0665.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0665.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0665.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0665.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0666.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0666.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0666.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0666.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0667.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0667.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0667.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0667.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0668.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0668.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0668.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0668.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0669.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0669.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0669.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0669.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0670.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0670.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0670.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0670.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0671.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0671.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0671.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0671.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0672.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0672.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0672.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0672.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0673.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0673.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0673.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0673.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0674.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0674.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0674.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0674.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0675.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0675.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0675.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0675.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0676.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0676.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0676.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0676.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0677.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0677.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0677.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0677.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0678.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0678.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0678.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0678.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0679.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0679.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0679.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0679.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0680.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0680.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0680.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0680.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0681.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0681.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0681.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0681.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0682.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0682.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0682.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0682.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0683.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0683.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0683.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0683.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0684.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0684.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0684.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0684.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0685.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0685.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0685.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0685.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0686.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0686.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0686.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0686.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0687.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0687.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0687.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0687.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0688.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0688.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0688.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0688.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0689.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0689.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0689.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0689.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0690.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0690.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0690.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0690.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0691.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0691.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0691.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0691.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0692.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0692.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0692.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0692.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0693.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0693.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0693.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0693.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-0694.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-0694.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-0694.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-0694.yaml diff --git a/test/cases/testdata/virtualdocs/test-virtualdocs-undefined.yaml b/test/cases/testdata/v0/virtualdocs/test-virtualdocs-undefined.yaml similarity index 100% rename from test/cases/testdata/virtualdocs/test-virtualdocs-undefined.yaml rename to test/cases/testdata/v0/virtualdocs/test-virtualdocs-undefined.yaml diff --git a/test/cases/testdata/walkbuiltin/test-walkbuiltin-0970.yaml b/test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0970.yaml similarity index 100% rename from test/cases/testdata/walkbuiltin/test-walkbuiltin-0970.yaml rename to test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0970.yaml diff --git a/test/cases/testdata/walkbuiltin/test-walkbuiltin-0971.yaml b/test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0971.yaml similarity index 100% rename from test/cases/testdata/walkbuiltin/test-walkbuiltin-0971.yaml rename to test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0971.yaml diff --git a/test/cases/testdata/walkbuiltin/test-walkbuiltin-0972.yaml b/test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0972.yaml similarity index 100% rename from test/cases/testdata/walkbuiltin/test-walkbuiltin-0972.yaml rename to test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0972.yaml diff --git a/test/cases/testdata/walkbuiltin/test-walkbuiltin-0973.yaml b/test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0973.yaml similarity index 100% rename from test/cases/testdata/walkbuiltin/test-walkbuiltin-0973.yaml rename to test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0973.yaml diff --git a/test/cases/testdata/walkbuiltin/test-walkbuiltin-0974.yaml b/test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0974.yaml similarity index 100% rename from test/cases/testdata/walkbuiltin/test-walkbuiltin-0974.yaml rename to test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0974.yaml diff --git a/test/cases/testdata/walkbuiltin/test-walkbuiltin-0975.yaml b/test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0975.yaml similarity index 100% rename from test/cases/testdata/walkbuiltin/test-walkbuiltin-0975.yaml rename to test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-0975.yaml diff --git a/test/cases/testdata/walkbuiltin/test-walkbuiltin-wildcard-path.yaml b/test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-wildcard-path.yaml similarity index 100% rename from test/cases/testdata/walkbuiltin/test-walkbuiltin-wildcard-path.yaml rename to test/cases/testdata/v0/walkbuiltin/test-walkbuiltin-wildcard-path.yaml diff --git a/test/cases/testdata/withkeyword/test-with-and-ndbcache-issue.yaml b/test/cases/testdata/v0/withkeyword/test-with-and-ndbcache-issue.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-with-and-ndbcache-issue.yaml rename to test/cases/testdata/v0/withkeyword/test-with-and-ndbcache-issue.yaml diff --git a/test/cases/testdata/withkeyword/test-with-builtin-mock.yaml b/test/cases/testdata/v0/withkeyword/test-with-builtin-mock.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-with-builtin-mock.yaml rename to test/cases/testdata/v0/withkeyword/test-with-builtin-mock.yaml diff --git a/test/cases/testdata/withkeyword/test-with-function-mock.yaml b/test/cases/testdata/v0/withkeyword/test-with-function-mock.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-with-function-mock.yaml rename to test/cases/testdata/v0/withkeyword/test-with-function-mock.yaml diff --git a/test/cases/testdata/withkeyword/test-with-function-mocks-issue-5299.yaml b/test/cases/testdata/v0/withkeyword/test-with-function-mocks-issue-5299.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-with-function-mocks-issue-5299.yaml rename to test/cases/testdata/v0/withkeyword/test-with-function-mocks-issue-5299.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1015.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1015.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1015.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1015.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1016.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1016.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1016.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1016.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1017.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1017.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1017.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1017.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1018.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1018.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1018.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1018.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1019.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1019.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1019.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1019.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1020.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1020.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1020.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1020.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1021.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1021.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1021.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1021.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1022.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1022.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1022.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1022.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1023.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1023.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1023.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1023.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1024.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1024.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1024.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1024.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1025.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1025.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1025.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1025.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1026.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1026.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1026.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1026.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1027.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1027.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1027.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1027.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1028.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1028.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1028.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1028.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1029.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1029.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1029.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1029.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1030.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1030.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1030.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1030.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1031.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1031.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1031.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1031.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1032.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1032.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1032.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1032.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1033.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1033.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1033.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1033.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1034.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1034.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1034.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1034.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1035.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1035.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1035.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1035.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1036.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1036.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1036.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1036.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1037.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1037.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1037.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1037.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1038.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1038.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1038.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1038.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1039.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1039.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1039.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1039.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1040.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1040.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1040.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1040.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1041.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1041.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1041.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1041.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1042.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1042.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1042.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1042.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1043.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1043.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1043.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1043.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1044.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1044.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1044.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1044.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1045.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1045.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1045.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1045.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1046.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1046.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1046.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1046.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1047.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1047.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1047.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1047.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1048.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1048.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1048.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1048.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1049.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1049.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1049.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1049.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1050.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1050.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1050.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1050.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1051.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1051.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1051.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1051.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1052.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1052.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1052.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1052.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1053.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1053.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1053.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1053.yaml diff --git a/test/cases/testdata/withkeyword/test-withkeyword-1054.yaml b/test/cases/testdata/v0/withkeyword/test-withkeyword-1054.yaml similarity index 100% rename from test/cases/testdata/withkeyword/test-withkeyword-1054.yaml rename to test/cases/testdata/v0/withkeyword/test-withkeyword-1054.yaml diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0001.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0001.yaml new file mode 100644 index 0000000000..d09e25510f --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0001.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: aggregates/count + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.a + count(__local0__, x) + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0002.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0002.yaml new file mode 100644 index 0000000000..b9607e5719 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0002.yaml @@ -0,0 +1,27 @@ +--- + +cases: + - note: aggregates/count virtual + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = [y | data.generated.q[y]] + count(__local0__, x) + } + + q contains x if { + x = data.a[_] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0003.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0003.yaml new file mode 100644 index 0000000000..32f1f426b2 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0003.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: aggregates/count keys + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.b + count(__local0__, x) + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0004.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0004.yaml new file mode 100644 index 0000000000..408434f033 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0004.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: aggregates/count keys virtual + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = [k | data.generated.q[k] = _] + count(__local0__, x) + } + + q[k] := v if { + data.b[k] = v + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0005.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0005.yaml new file mode 100644 index 0000000000..2d04de4798 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0005.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: aggregates/count set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = data.generated.q + count(__local0__, x) + } + + q contains x if { + x = data.a[_] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: 4 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0006.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0006.yaml new file mode 100644 index 0000000000..0dfe6291ae --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0006.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: aggregates/sum + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + sum([1, 2, 3, 4], x) + } + data: { } + want_result: + - x: + - 10 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0007.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0007.yaml new file mode 100644 index 0000000000..682abf2b2b --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0007.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: aggregates/sum set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sum({1, 2, 3, 4}, x) + } + data: { } + want_result: + - x: 10 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0008.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0008.yaml new file mode 100644 index 0000000000..0bc234aa74 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0008.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: aggregates/sum virtual + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = [y | data.generated.q[y]] + sum(__local0__, x) + } + + q contains x if { + data.a[_] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 10 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0009.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0009.yaml new file mode 100644 index 0000000000..1649244873 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0009.yaml @@ -0,0 +1,25 @@ +--- + +cases: + - note: aggregates/sum virtual set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = data.generated.q + sum(__local0__, x) + } + + q contains x if { + data.a[_] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: 10 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0010.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0010.yaml new file mode 100644 index 0000000000..a87fbeb03c --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0010.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: aggregates/bug 2469 - precision + query: data.generated.p = x + modules: + - | + package generated + + p if { + sum([49649733057, 1], __local0__) + __local0__ = 49649733058 + } + data: { } + want_result: + - x: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0011.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0011.yaml new file mode 100644 index 0000000000..b07ec41545 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0011.yaml @@ -0,0 +1,16 @@ +--- + + +cases: + - note: aggregates/product + query: data.generated.p = x + modules: + - | + package generated + + p if { + product([1, 2, 3, 4], 24) + } + data: { } + want_result: + - x: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0012.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0012.yaml new file mode 100644 index 0000000000..7fd3a743f6 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0012.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: aggregates/product set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + product({1, 2, 3, 4}, x) + } + data: { } + want_result: + - x: 24 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0013.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0013.yaml new file mode 100644 index 0000000000..16bc667c2c --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0013.yaml @@ -0,0 +1,17 @@ +--- + +cases: + - note: aggregates/max + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + max([1, 2, 3, 4], x) + } + data: { } + want_result: + - x: + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0014.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0014.yaml new file mode 100644 index 0000000000..ccd5674582 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0014.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: aggregates/max set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + max({1, 2, 3, 4}, x) + } + data: { } + want_result: + - x: 4 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0015.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0015.yaml new file mode 100644 index 0000000000..2a2cdde7ff --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0015.yaml @@ -0,0 +1,27 @@ +--- + +cases: + - note: aggregates/max virtual + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = [y | data.generated.q[y]] + max(__local0__, x) + } + + q contains x if { + data.a[_] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0016.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0016.yaml new file mode 100644 index 0000000000..a24ed31eeb --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0016.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: aggregates/max virtual set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = data.generated.q + max(__local0__, x) + } + + q contains x if { + data.a[_] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: 4 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0017.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0017.yaml new file mode 100644 index 0000000000..516cb7b563 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0017.yaml @@ -0,0 +1,17 @@ +--- + +cases: + - note: aggregates/min + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + min([1, 2, 3, 4], x) + } + data: { } + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0018.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0018.yaml new file mode 100644 index 0000000000..92347fb729 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0018.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: aggregates/min dups + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + min([1, 2, 1, 3, 4], x) + } + data: { } + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0019.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0019.yaml new file mode 100644 index 0000000000..520dc14a7f --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0019.yaml @@ -0,0 +1,17 @@ +--- + +cases: + - note: aggregates/min out-of-order + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + min([3, 2, 1, 4, 6, -7, 10], x) + } + data: { } + want_result: + - x: + - -7 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0020.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0020.yaml new file mode 100644 index 0000000000..437d0fe2c6 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0020.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: aggregates/min set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + min({1, 2, 3, 4}, x) + } + data: { } + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0021.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0021.yaml new file mode 100644 index 0000000000..0d7f61b876 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0021.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: aggregates/min virtual + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = [y | data.generated.q[y]] + min(__local0__, x) + } + + q contains x if { + data.a[_] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0022.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0022.yaml new file mode 100644 index 0000000000..4eb211f4b9 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0022.yaml @@ -0,0 +1,25 @@ +--- + +cases: + - note: aggregates/min virtual set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = data.generated.q + min(__local0__, x) + } + + q contains x if { + data.a[_] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0023.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0023.yaml new file mode 100644 index 0000000000..3a4b3b4ab6 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0023.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: aggregates/reduce ref dest + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.a[3] + max([1, 2, 3, 4], __local0__) + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0024.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0024.yaml new file mode 100644 index 0000000000..d3a3947605 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0024.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: aggregates/reduce ref dest (2) + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.a[3] + not max([1, 2, 3, 4, 5], __local0__) + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0025.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0025.yaml new file mode 100644 index 0000000000..014d37c29c --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0025.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: aggregates/sort + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sort([4, 3, 2, 1], x) + } + data: { } + want_result: + - x: + - 1 + - 2 + - 3 + - 4 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0026.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0026.yaml new file mode 100644 index 0000000000..6f1e0c0acd --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0026.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: aggregates/sort set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sort({1, 2, 3, 4}, x) + } + data: { } + want_result: + - x: + - 1 + - 2 + - 3 + - 4 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0027.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0027.yaml new file mode 100644 index 0000000000..dec6bda21b --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0027.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: aggregates/count string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + count("abcde", x) + } + want_result: + - x: 5 + - note: aggregates/count string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + count("åäö", x) + } + want_result: + - x: 3 diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-0028.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-0028.yaml new file mode 100644 index 0000000000..9767d6e814 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-0028.yaml @@ -0,0 +1,30 @@ +--- +cases: + - note: aggregates/count error null + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + count(input.foo, x) + } + input: + foo: null + want_error_code: eval_type_error + want_error: operand 1 must be one of {array, object, set, string} but got null + strict_error: true + - note: aggregates/count error number + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + count(input.foo, x) + } + input: + foo: 5 + want_error_code: eval_type_error + want_error: operand 1 must be one of {array, object, set, string} but got number + strict_error: true diff --git a/test/cases/testdata/v1/aggregates/test-aggregates-bad-utf8-runes.yaml b/test/cases/testdata/v1/aggregates/test-aggregates-bad-utf8-runes.yaml new file mode 100644 index 0000000000..6d712957c1 --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-aggregates-bad-utf8-runes.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: aggregates/count with invalid utf-8 chars (0xFFFD) + query: data.test.p = x + modules: + - | + package test + + p contains x if { + x := count(base64.decode("2E84ZuPUd7zfvCZSNEchVpDEIj6PL7JfLpIqyxVG16k=")) + } + want_result: + - x: + - 30 + sort_bindings: true diff --git a/test/cases/testdata/v1/aggregates/test-membership.yaml b/test/cases/testdata/v1/aggregates/test-membership.yaml new file mode 100644 index 0000000000..e689b57f2f --- /dev/null +++ b/test/cases/testdata/v1/aggregates/test-membership.yaml @@ -0,0 +1,529 @@ +--- +cases: + - note: aggregates/member simple, set + query: data.test.p = x + modules: + - | + package test + + p if { + 1 in {1} + } + data: { } + want_result: + - x: true + - note: aggregates/member simple, array + query: data.test.p = x + modules: + - | + package test + + p if { + 1 in [1] + } + data: { } + want_result: + - x: true + - note: aggregates/member simple, object + query: data.test.p = x + modules: + - | + package test + + p if { + 1 in {"foo": 1} + } + data: { } + want_result: + - x: true + - note: aggregates/member object with key + query: data.test.p = x + modules: + - | + package test + + p if { + "foo", 1 in {"foo": 1} + } + data: { } + want_result: + - x: true + - note: aggregates/member array with index + query: data.test.p = x + modules: + - | + package test + + p if { + 1, "two" in ["one", "two", "three"] + } + data: { } + want_result: + - x: true + - note: aggregates/member array with index, nested + query: data.test.p = x + modules: + - | + package test + + p if { + 1, 2 in [2] in [false, true] + } + data: { } + want_result: + - x: true + - note: aggregates/member array with index, nested, associativity without parens + query: data.test.p = x + modules: + - | + package test + + p if { + (0, 2 in [2]) in [true] + } + data: { } + want_result: + - x: true + - note: aggregates/member object with key, nested, associativity without parens + query: data.test.p = x + modules: + - | + package test + + p if { + ("foo", 2 in {"foo": 2}) in [true] + } + data: { } + want_result: + - x: true + - note: aggregates/member object with key, nested + query: data.test.p = x + modules: + - | + package test + + p if { + "foo", (2 in {"bar": 2}) in {"foo": true} + } + data: { } + want_result: + - x: true + - note: aggregates/member simple false, set + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := 1 in {2} + } + data: { } + want_result: + - x: false + - note: aggregates/member simple false, array + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := 1 in [2] + } + data: { } + want_result: + - x: false + - note: aggregates/member simple false, object + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := 1 in {"foo": 2} + } + data: { } + want_result: + - x: false + - note: aggregates/member chained + query: data.test.p = x + modules: + - | + package test + + p if { + {1, 2} in [{1, 2}] in [true] + } + data: { } + want_result: + - x: true + - note: aggregates/member with vars + query: data.test.p = x + modules: + - | + package test + + p if { + x := "foo" + xs := ["foo", "bar"] + x in xs + } + data: { } + want_result: + - x: true + - note: aggregates/member with not + query: data.test.p = x + modules: + - | + package test + + p if { + not "foo" in ["fox"] + } + data: { } + want_result: + - x: true + - note: aggregates/member operator precedence with other infix operator (+) + query: data.test.p = x + modules: + - | + package test + + p if { + (1 + 1) in [2] + } + data: { } + want_result: + - x: true + - note: aggregates/member operator precedence in list (set) + query: data.test.p = x + modules: + - | + package test + + p if { + x := {1, 1 in [2]} + x == {1, false} + } + data: { } + want_result: + - x: true + - note: aggregates/member operator precedence in list with parens (set) + query: data.test.p = x + modules: + - | + package test + + p if { + x := {(1, 1 in [2])} + x == {false} + } + data: { } + want_result: + - x: true + - note: aggregates/member operator precedence in list (array) + query: data.test.p = x + modules: + - | + package test + + p if { + x := [1, 1 in [2]] + x == [1, false] + } + data: { } + want_result: + - x: true + - note: aggregates/member operator precedence in list with parens (array) + query: data.test.p = x + modules: + - | + package test + + p if { + x := [(1, 1 in [2])] + x == [false] + } + data: { } + want_result: + - x: true + - note: aggregates/member operator precedence in list (fun args) + query: data.test.p = x + modules: + - | + package test + + p if { + f(1, 1 in [2]) + } + + f(_, _) := true + data: { } + want_result: + - x: true + - note: aggregates/member operator precedence in list with parens (fun args) + query: data.test.p = x + modules: + - | + package test + + p if { + f((1, 1 in [2])) + } + + f(_) := true + data: { } + want_result: + - x: true + - note: aggregates/member composite containee + query: data.test.p = x + modules: + - | + package test + + p if { + {"foo": {"baz": 2000}} in [{"foo": {"baz": 2000}}] + } + data: { } + want_result: + - x: true + - note: aggregates/member non-collection string + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := 1 in "foo" + } + data: { } + want_result: + - x: false + - note: aggregates/member non-collection number + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := "foo" in 1 + } + data: { } + want_result: + - x: false + - note: aggregates/member with key in non-collection (number) + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := (1, "foo" in 1) + } + data: { } + want_result: + - x: false + - note: aggregates/member+some simple, array + query: data.test.p = x + modules: + - | + package test + + p contains x if { + some x in [1, 2, 3] + } + data: { } + want_result: + - x: + - 1 + - 2 + - 3 + - note: aggregates/member+some ground value + query: data.test.p = x + modules: + - | + package test + + p if { + some "foo" in ["foo"] + } + data: { } + want_result: + - x: true + - note: aggregates/member+some containee is call + query: data.test.p = x + modules: + - | + package test + + p if { + some numbers.range(1, 1) in [[1]] + } + data: { } + want_result: + - x: true + - note: aggregates/member+some non-ground composite containee + query: data.test.p = x + modules: + - | + package test + + p := x if { + some {"foo": x} in [{"foo": 100}, {"what": "ever"}] + } + data: { } + want_result: + - x: 100 + - note: aggregates/member+some non-ground composite containee, multiple bindings + query: data.test.p = x + modules: + - | + package test + + p := x if { + some {"foo": x, "what": y} in [{"foo": 100, "what": "ever"}] + } + data: { } + want_result: + - x: 100 + - note: aggregates/member+some ground composite containee + query: data.test.p = x + modules: + - | + package test + + p if { + some {"foo": 100} in [{"foo": 100}] + } + data: { } + want_result: + - x: true + - note: aggregates/member+some ground composite containee (false) + query: data.test.p = x + modules: + - | + package test + + p if { + some {"foo": 0} in [{"foo": 100}] + } + data: { } + want_result: [] + - note: aggregates/member+some+key non-ground value + query: data.test.p = x + modules: + - | + package test + + p := x if { + some "foo", x in {"foo": 100, "what": "ever"} + } + data: { } + want_result: + - x: 100 + - note: aggregates/member+some+key non-ground key + query: data.test.p = x + modules: + - | + package test + + p := x if { + some x, "ever" in {"foo": 100, "what": "ever"} + } + data: { } + want_result: + - x: what + - note: aggregates/member+some+key non-ground key+value + query: data.test.p = x + modules: + - | + package test + + p[k] := v if { + some k, v in {"foo": 100, "what": "ever"} + } + data: { } + want_result: + - x: + foo: 100 + what: ever + - note: aggregates/member+some+key non-ground, composite key + query: data.test.p = x + modules: + - | + package test + + p := x if { + some {"foo": x}, "ever" in {{"foo": 100}: "ever"} + } + data: { } + want_result: + - x: 100 + - note: aggregates/member+some+ref + query: data.test.p = x + modules: + - | + package test + + p := x if { + some {"a": x} in data.array + } + data: + array: + - a: 1 + - b: 2 + - c: 3 + want_result: + - x: 1 + - note: aggregates/member+some+key+ref + query: data.test.p = x + modules: + - | + package test + + p := [x, y] if { + some y, {"c": x} in data.array + } + data: + array: + - a: 1 + - b: 2 + - c: 3 + want_result: + - x: + - 3 + - 2 + - note: aggregates/member+some+key+ref with other variable + query: data.test.p = x + modules: + - | + package test + + p := [x, y, i] if { + some i + some y, {"c": x} in data.object[i] + } + data: + object: + array: + - a: 1 + - b: 2 + - c: 3 + want_result: + - x: + - 3 + - 2 + - array + - note: aggregates/member+some+with + query: data.test.p = x + modules: + - | + package test + + p contains [k, v] if { + some k, v in input with input.foo as "bar" + } + data: { } + want_result: + - x: + - - foo + - bar diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0810.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0810.yaml new file mode 100644 index 0000000000..94392246b6 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0810.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: arithmetic/plus + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + data.a[i] = x + __local0__ = i + x + y = __local0__ + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 3 + - 5 + - 7 + sort_bindings: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0811.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0811.yaml new file mode 100644 index 0000000000..ab16f61fc3 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0811.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: arithmetic/minus + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + data.a[i] = x + __local0__ = i - x + y = __local0__ + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - -1 + sort_bindings: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0812.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0812.yaml new file mode 100644 index 0000000000..ea574b53d2 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0812.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: arithmetic/multiply + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + data.a[i] = x + __local0__ = i * x + y = __local0__ + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 0 + - 2 + - 6 + - 12 + sort_bindings: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0813.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0813.yaml new file mode 100644 index 0000000000..154e80a334 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0813.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: arithmetic/divide+round + query: data.test.p = x + modules: + - | + package test + + p contains z if { + data.a[i] = x + y = i / x + round(y, z) + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 0 + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0814.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0814.yaml new file mode 100644 index 0000000000..35b5ec77c0 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0814.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: arithmetic/divide+error + query: data.generated.p = x + modules: + - | + package generated + + p := y if { + data.a[i] = x + __local0__ = x / i + y = __local0__ + } + data: + a: + - 1 + want_error_code: eval_builtin_error + want_error: divide by zero + strict_error: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0815.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0815.yaml new file mode 100644 index 0000000000..3dd71c70c9 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0815.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: arithmetic/abs + query: data.generated.p = x + modules: + - | + package generated + + p if { + abs(-10, x) + x = 10 + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0816.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0816.yaml new file mode 100644 index 0000000000..c75a745bab --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0816.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: arithmetic/remainder + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = 7 % 4 + x = __local0__ + } + data: {} + want_result: + - x: 3 diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0817.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0817.yaml new file mode 100644 index 0000000000..85db453379 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0817.yaml @@ -0,0 +1,16 @@ +--- + +cases: + - note: arithmetic/remainder+error + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = 7 % 0 + x = __local0__ + } + want_error_code: eval_builtin_error + want_error: modulo by zero + strict_error: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0818.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0818.yaml new file mode 100644 index 0000000000..ecbea390c4 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0818.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: arithmetic/remainder+error+floating + query: data.test.p = x + modules: + - | + package test + + p := x if { + x = 1.1 % 1 + } + want_error_code: eval_builtin_error + want_error: modulo on floating-point number + strict_error: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0819.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0819.yaml new file mode 100644 index 0000000000..415de68e21 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0819.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: arithmetic/arity 1 ref dest + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.a[3] + abs(-4, __local0__) + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0820.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0820.yaml new file mode 100644 index 0000000000..71c51e6f07 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0820.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: arithmetic/arity 1 ref dest (2) + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.a[3] + not abs(-5, __local0__) + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0821.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0821.yaml new file mode 100644 index 0000000000..d5ec3de50b --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0821.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: arithmetic/arity 2 ref dest + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = 1 + 2 + data.a[2] = __local0__ + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0822.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0822.yaml new file mode 100644 index 0000000000..17dc995506 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0822.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: arithmetic/arity 2 ref dest (2) + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = 2 + 3 + not data.a[2] = __local0__ + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0823.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0823.yaml new file mode 100644 index 0000000000..18980bd399 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0823.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: arithmetic/bug 2469 - precision + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = 49649733057 + 1 + __local0__ = 49649733058 + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0824.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0824.yaml new file mode 100644 index 0000000000..94de2845c9 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0824.yaml @@ -0,0 +1,62 @@ +--- +cases: + - note: ceil rounds up + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + ceil(1.01, x) + } + data: {} + want_result: + - x: 2 + - note: ceil rounds up (2) + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + ceil(1.5, x) + } + data: {} + want_result: + - x: 2 + - note: ceil rounds up (3) + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + ceil(2222.2222222222, x) + } + data: {} + want_result: + - x: 2223 + - note: ceil integer + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + ceil(1, x) + } + data: {} + want_result: + - x: 1 + - note: ceil negative + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + ceil(-1.99999, x) + } + data: {} + want_result: + - x: -1 diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-0825.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-0825.yaml new file mode 100644 index 0000000000..a84bd3d010 --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-0825.yaml @@ -0,0 +1,62 @@ +--- +cases: + - note: floor rounds down + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + floor(1.01, x) + } + data: {} + want_result: + - x: 1 + - note: floor rounds down (2) + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + floor(1.5, x) + } + data: {} + want_result: + - x: 1 + - note: floor rounds down (3) + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + floor(99.99999, x) + } + data: {} + want_result: + - x: 99 + - note: floor integer + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + floor(1, x) + } + data: {} + want_result: + - x: 1 + - note: floor negative + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + floor(-1.001, x) + } + data: {} + want_result: + - x: -2 diff --git a/test/cases/testdata/v1/arithmetic/test-arithmetic-minus-type-error.yaml b/test/cases/testdata/v1/arithmetic/test-arithmetic-minus-type-error.yaml new file mode 100644 index 0000000000..63c8bb450d --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-arithmetic-minus-type-error.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: arithmetic/minus/type error + query: data.test.p = x + modules: + - | + package test + + p if { + {1} - 1 + } + want_error_code: eval_type_error + want_error: operand 2 must be set but got number + strict_error: true + - note: arithmetic/minus/type error + query: data.test.p = x + modules: + - | + package test + + p if { + 1 - {1} + } + want_error_code: eval_type_error + want_error: operand 2 must be number but got set + strict_error: true diff --git a/test/cases/testdata/v1/arithmetic/test-big-int-0001.yaml b/test/cases/testdata/v1/arithmetic/test-big-int-0001.yaml new file mode 100644 index 0000000000..abc9bd7dda --- /dev/null +++ b/test/cases/testdata/v1/arithmetic/test-big-int-0001.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: arithmetic/big_int + query: data.test.p = x + modules: + - | + package test + + p if { + 28857836529306024611913 != 28857836529306024611912 + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/array/test-array-0041.yaml b/test/cases/testdata/v1/array/test-array-0041.yaml new file mode 100644 index 0000000000..5423f5e0db --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0041.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: array/concat + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + array.concat([1, 2], [3, 4], __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - 1 + - 2 + - 3 + - 4 diff --git a/test/cases/testdata/v1/array/test-array-0042.yaml b/test/cases/testdata/v1/array/test-array-0042.yaml new file mode 100644 index 0000000000..4da80c8aa9 --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0042.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "array/concat: err" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local1__ = data.b + array.concat(__local1__, [3, 4], __local0__) + x = __local0__ + } + data: + b: + v1: hello + v2: goodbye + want_error_code: eval_type_error + want_error: "array.concat: operand 1 must be array but got object" + strict_error: true diff --git a/test/cases/testdata/v1/array/test-array-0043.yaml b/test/cases/testdata/v1/array/test-array-0043.yaml new file mode 100644 index 0000000000..a66a4b132c --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0043.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "array/concat: err rhs" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local1__ = data.b + array.concat([1, 2], __local1__, __local0__) + x = __local0__ + } + data: + b: + v1: hello + v2: goodbye + want_error_code: eval_type_error + want_error: "array.concat: operand 2 must be array but got object" + strict_error: true diff --git a/test/cases/testdata/v1/array/test-array-0044.yaml b/test/cases/testdata/v1/array/test-array-0044.yaml new file mode 100644 index 0000000000..7e581e84ab --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0044.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: array/slice + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + array.slice([1, 2, 3, 4, 5], 1, 3, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - 2 + - 3 diff --git a/test/cases/testdata/v1/array/test-array-0045.yaml b/test/cases/testdata/v1/array/test-array-0045.yaml new file mode 100644 index 0000000000..c581ec392f --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0045.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: "array/slice: empty slice" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + array.slice([1, 2, 3], 0, 0, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: [] diff --git a/test/cases/testdata/v1/array/test-array-0046.yaml b/test/cases/testdata/v1/array/test-array-0046.yaml new file mode 100644 index 0000000000..db119420bd --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0046.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: "array/slice: negative indices" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + array.slice([1, 2, 3, 4, 5], -4, -1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: [] diff --git a/test/cases/testdata/v1/array/test-array-0047.yaml b/test/cases/testdata/v1/array/test-array-0047.yaml new file mode 100644 index 0000000000..b94bb71ff2 --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0047.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: "array/slice: stopIndex < startIndex" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + array.slice([1, 2, 3, 4, 5], 4, 1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: [] diff --git a/test/cases/testdata/v1/array/test-array-0048.yaml b/test/cases/testdata/v1/array/test-array-0048.yaml new file mode 100644 index 0000000000..c296a232a1 --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0048.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: "array/slice: clamp startIndex" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + array.slice([1, 2, 3, 4, 5], -1, 2, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - 1 + - 2 diff --git a/test/cases/testdata/v1/array/test-array-0049.yaml b/test/cases/testdata/v1/array/test-array-0049.yaml new file mode 100644 index 0000000000..c2e1a8a989 --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0049.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: "array/slice: clamp stopIndex" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + array.slice([1, 2, 3, 4, 5], 3, 6, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - 4 + - 5 diff --git a/test/cases/testdata/v1/array/test-array-0050.yaml b/test/cases/testdata/v1/array/test-array-0050.yaml new file mode 100644 index 0000000000..0831f4a128 --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0050.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: "array/slice: clamp both out of range" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + array.slice([], 1000, 2000, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: [] diff --git a/test/cases/testdata/v1/array/test-array-0051.yaml b/test/cases/testdata/v1/array/test-array-0051.yaml new file mode 100644 index 0000000000..273432003b --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0051.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: "array/slice: clamp both out of range non-empty" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + array.slice([1, 2, 3], 1000, 2000, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: [] diff --git a/test/cases/testdata/v1/array/test-array-0052.yaml b/test/cases/testdata/v1/array/test-array-0052.yaml new file mode 100644 index 0000000000..1c7f483864 --- /dev/null +++ b/test/cases/testdata/v1/array/test-array-0052.yaml @@ -0,0 +1,44 @@ +--- +cases: + - note: array/reverse_123 + query: data.test.p = x + modules: + - | + package test + + p := array.reverse(data.foo) + data: + foo: + - 1 + - 2 + - 3 + want_result: + - x: + - 3 + - 2 + - 1 + - note: array/reverse_empty + query: data.test.p = x + modules: + - | + package test + + p := array.reverse(data.foo) + data: + foo: [] + want_result: + - x: [] + - note: array/reverse_object_error + query: data.test.p = x + modules: + - | + package test + + p := array.reverse(data.foo) + data: + foo: + bar: baz + baz: bar + want_error_code: eval_type_error + want_error: 'array.reverse: operand 1 must be array but got object' + strict_error: true diff --git a/test/cases/testdata/v1/assignments/test-file-level-assignments.yaml b/test/cases/testdata/v1/assignments/test-file-level-assignments.yaml new file mode 100644 index 0000000000..6d53bb1945 --- /dev/null +++ b/test/cases/testdata/v1/assignments/test-file-level-assignments.yaml @@ -0,0 +1,61 @@ +--- +cases: + - note: assignments/file-level/default_value + query: data.test = x + modules: + - | + package test + + default a := 1 + want_result: + - x: + a: 1 + - note: assignments/file-level/rule + query: data.test = x + modules: + - | + package test + + b := 2 + want_result: + - x: + b: 2 + - note: assignments/file-level/else_keyword + query: data.test = x + modules: + - | + package test + + c := 3 if { + false + } else := 4 + want_result: + - x: + c: 4 + - note: assignments/file-level/partial_rule + query: data.test = x + modules: + - | + package test + + d[msg] := 5 if { + msg = [1, 2, 3][_] + } + want_result: + - x: + d: + "1": 5 + "2": 5 + "3": 5 + - note: assignments/file-level/function_return_value + query: data.test = x + modules: + - | + package test + + e := f(6) + + f(x) := x + want_result: + - x: + e: 6 diff --git a/test/cases/testdata/v1/base64builtins/test-base64builtins-0929.yaml b/test/cases/testdata/v1/base64builtins/test-base64builtins-0929.yaml new file mode 100644 index 0000000000..5e91437e55 --- /dev/null +++ b/test/cases/testdata/v1/base64builtins/test-base64builtins-0929.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: base64builtins/encode-1 + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64.encode("hello", x) + } + data: {} + want_result: + - x: aGVsbG8= diff --git a/test/cases/testdata/v1/base64builtins/test-base64builtins-0930.yaml b/test/cases/testdata/v1/base64builtins/test-base64builtins-0930.yaml new file mode 100644 index 0000000000..005563867b --- /dev/null +++ b/test/cases/testdata/v1/base64builtins/test-base64builtins-0930.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: base64builtins/encode-2 + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64.encode("there", x) + } + data: {} + want_result: + - x: dGhlcmU= diff --git a/test/cases/testdata/v1/base64builtins/test-base64builtins-0931.yaml b/test/cases/testdata/v1/base64builtins/test-base64builtins-0931.yaml new file mode 100644 index 0000000000..f2bb7338b1 --- /dev/null +++ b/test/cases/testdata/v1/base64builtins/test-base64builtins-0931.yaml @@ -0,0 +1,15 @@ +--- + +cases: + - note: base64builtins/decode-1 + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64.decode("aGVsbG8=", x) + } + data: {} + want_result: + - x: hello diff --git a/test/cases/testdata/v1/base64builtins/test-base64builtins-0932.yaml b/test/cases/testdata/v1/base64builtins/test-base64builtins-0932.yaml new file mode 100644 index 0000000000..4745a3fd5b --- /dev/null +++ b/test/cases/testdata/v1/base64builtins/test-base64builtins-0932.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: base64builtins/decode-2 + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64.decode("dGhlcmU=", x) + } + data: {} + want_result: + - x: there diff --git a/test/cases/testdata/v1/base64builtins/test-base64builtins-0933.yaml b/test/cases/testdata/v1/base64builtins/test-base64builtins-0933.yaml new file mode 100644 index 0000000000..219ed80be4 --- /dev/null +++ b/test/cases/testdata/v1/base64builtins/test-base64builtins-0933.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: base64builtins/encode-slash + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64.encode("subjects?_d", x) + } + data: {} + want_result: + - x: c3ViamVjdHM/X2Q= diff --git a/test/cases/testdata/v1/base64builtins/test-base64builtins-0934.yaml b/test/cases/testdata/v1/base64builtins/test-base64builtins-0934.yaml new file mode 100644 index 0000000000..86ff675c93 --- /dev/null +++ b/test/cases/testdata/v1/base64builtins/test-base64builtins-0934.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: base64builtins/decode-slash + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64.decode("c3ViamVjdHM/X2Q=", x) + } + data: {} + want_result: + - x: subjects?_d diff --git a/test/cases/testdata/v1/base64builtins/test-base64builtins-0935.yaml b/test/cases/testdata/v1/base64builtins/test-base64builtins-0935.yaml new file mode 100644 index 0000000000..c407078c50 --- /dev/null +++ b/test/cases/testdata/v1/base64builtins/test-base64builtins-0935.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: base64builtins/is_valid-true + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64.is_valid("aGVsbG8=", x) + } + data: {} + want_result: + - x: true + - note: base64builtins/is_valid-false + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64.is_valid("{'not':'base64'}", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/base64urlbuiltins/test-base64urlbuiltins-0935.yaml b/test/cases/testdata/v1/base64urlbuiltins/test-base64urlbuiltins-0935.yaml new file mode 100644 index 0000000000..8d28b677fd --- /dev/null +++ b/test/cases/testdata/v1/base64urlbuiltins/test-base64urlbuiltins-0935.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: base64urlbuiltins/encode-1 + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64url.encode("hello", x) + } + want_result: + - x: aGVsbG8= + - note: base64urlbuiltins/encode-2 + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64url.encode("there", x) + } + want_result: + - x: dGhlcmU= diff --git a/test/cases/testdata/v1/base64urlbuiltins/test-base64urlbuiltins-0937.yaml b/test/cases/testdata/v1/base64urlbuiltins/test-base64urlbuiltins-0937.yaml new file mode 100644 index 0000000000..aedd20be3d --- /dev/null +++ b/test/cases/testdata/v1/base64urlbuiltins/test-base64urlbuiltins-0937.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: base64urlbuiltins/decode-1 padded string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64url.decode("aGVsbG8=", x) + } + want_result: + - x: hello + - note: base64urlbuiltins/decode-2 non-padded string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64url.decode("aGVsbG8", x) + } + want_result: + - x: hello diff --git a/test/cases/testdata/v1/base64urlbuiltins/test-base64urlbuiltins-0939.yaml b/test/cases/testdata/v1/base64urlbuiltins/test-base64urlbuiltins-0939.yaml new file mode 100644 index 0000000000..d1700f82c3 --- /dev/null +++ b/test/cases/testdata/v1/base64urlbuiltins/test-base64urlbuiltins-0939.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: base64urlbuiltins/encode-1 without padding + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64url.encode_no_pad("hello", x) + } + want_result: + - x: aGVsbG8 + - note: base64urlbuiltins/encode-2 without padding + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + base64url.encode_no_pad("there", x) + } + want_result: + - x: dGhlcmU diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0695.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0695.yaml new file mode 100644 index 0000000000..600c8ab8e4 --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0695.yaml @@ -0,0 +1,189 @@ +--- +cases: + - note: baseandvirtualdocs/base/virtual + query: data.topdown.p = x + modules: + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package topdown.no.base.doc + + p := true + - | + package topdown.a.b.c.empty + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + - | + package topdown.conflicts + + k := "bar" + - | + package topdown.g.h + + p if { + false + } + data: + topdown: + a: + b: + c: + "true": false + x: + - 100 + - 200 + z: + a: b + input_term: "{}" + want_result: + - x: + - - c + - p + - 0 + - 1 + - - c + - p + - 1 + - 2 + - - c + - q + - 0 + - 3 + - - c + - q + - 1 + - 4 + - - c + - r + - a + - 1 + - - c + - r + - b + - 2 + - - c + - s + - w + - f: 10 + g: 9.9 + - - c + - x + - 0 + - 100 + - - c + - x + - 1 + - 200 + - - c + - z + - a + - b + sort_bindings: true diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0696.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0696.yaml new file mode 100644 index 0000000000..e14e45bf93 --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0696.yaml @@ -0,0 +1,273 @@ +--- +cases: + - note: "baseandvirtualdocs/base/virtual: ground key" + query: data.topdown.q = x + modules: + - | + package partial.topdown + + p contains ["c", "x", 0, x41] if { + data.topdown.a.b.c.x[0] = x41 + } + + p contains ["c", "x", 1, x41] if { + data.topdown.a.b.c.x[1] = x41 + } + + p contains ["c", "z", "a", x41] if { + data.topdown.a.b.c.z.a = x41 + } + + p contains [ + "c", "p", 0, + 1, + ] + + p contains [ + "c", "p", 1, + 2, + ] + + p contains [ + "c", "q", 0, + 3, + ] + + p contains [ + "c", "q", 1, + 4, + ] + + p contains [ + "c", "r", + "a", 1, + ] + + p contains [ + "c", "r", + "b", 2, + ] + + p contains [ + "c", "s", "w", + {"f": 10, "g": 9.9}, + ] + + p contains [ + "c", "undefined2", "p", + true, + ] if { + input.foo + } + + p contains ["c", "x", 0, x41] if { + data.topdown.a.b.c.x[0] = x41 + } + + p contains ["c", "x", 1, x41] if { + data.topdown.a.b.c.x[1] = x41 + } + + p contains ["c", "z", "a", x41] if { + data.topdown.a.b.c.z.a = x41 + } + + p contains [ + "c", "p", 0, + 1, + ] + + p contains [ + "c", "p", 1, + 2, + ] + + p contains [ + "c", "q", 0, + 3, + ] + + p contains [ + "c", "q", 1, + 4, + ] + + p contains [ + "c", "r", + "a", 1, + ] + + p contains [ + "c", "r", + "b", 2, + ] + + p contains [ + "c", "s", "w", + {"f": 10, "g": 9.9}, + ] + + p contains [ + "c", "undefined2", "p", + true, + ] if { + input.foo + } + - | + package topdown.a.b.c.empty + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + - | + package topdown.no.base.doc + + p := true + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package topdown.conflicts + + k := "bar" + - | + package topdown.g.h + + p if { + false + } + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package topdown_test_partial + + __result__ := _result if { + data.partial.topdown.p = _result + } + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + data: + topdown: + a: + b: + c: + "true": false + x: + - 100 + - 200 + z: + a: b + input_term: "{}" + want_result: + - x: + - - c + - p + - 1 + - - c + - q + - 3 + - - c + - x + - 100 + sort_bindings: true diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0697.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0697.yaml new file mode 100644 index 0000000000..e02b6b657b --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0697.yaml @@ -0,0 +1,297 @@ +--- +cases: + - note: "baseandvirtualdocs/base/virtual: prefix" + query: data.topdown.r = x + modules: + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + - | + package partial.topdown + + p contains ["c", "x", 0, x41] if { + data.topdown.a.b.c.x[0] = x41 + } + + p contains ["c", "x", 1, x41] if { + data.topdown.a.b.c.x[1] = x41 + } + + p contains ["c", "z", "a", x41] if { + data.topdown.a.b.c.z.a = x41 + } + + p contains [ + "c", "p", 0, + 1, + ] + + p contains [ + "c", "p", 1, + 2, + ] + + p contains [ + "c", "q", 0, + 3, + ] + + p contains [ + "c", "q", 1, + 4, + ] + + p contains [ + "c", "r", + "a", 1, + ] + + p contains [ + "c", "r", + "b", 2, + ] + + p contains [ + "c", "s", "w", + {"f": 10, "g": 9.9}, + ] + + p contains [ + "c", "undefined2", "p", + true, + ] if { + input.foo + } + + p contains ["c", "x", 0, x41] if { + data.topdown.a.b.c.x[0] = x41 + } + + p contains ["c", "x", 1, x41] if { + data.topdown.a.b.c.x[1] = x41 + } + + p contains ["c", "z", "a", x41] if { + data.topdown.a.b.c.z.a = x41 + } + + p contains [ + "c", "p", 0, + 1, + ] + + p contains [ + "c", "p", 1, + 2, + ] + + p contains [ + "c", "q", 0, + 3, + ] + + p contains [ + "c", "q", 1, + 4, + ] + + p contains [ + "c", "r", + "a", 1, + ] + + p contains [ + "c", "r", + "b", 2, + ] + + p contains [ + "c", "s", "w", + {"f": 10, "g": 9.9}, + ] + + p contains [ + "c", "undefined2", "p", + true, + ] if { + input.foo + } + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package topdown.conflicts + + k := "bar" + - | + package topdown.g.h + + p if { + false + } + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = { + [ + "c", "p", + 1, + ], + [ + "c", "q", + 3, + ], + ["c", "x", 100], + } + } + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package topdown.no.base.doc + + p := true + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + - | + package topdown.a.b.c.empty + data: + topdown: + a: + b: + c: + "true": false + x: + - 100 + - 200 + z: + a: b + input_term: "{}" + want_result: + - x: + - - c + - empty: {} + p: + - 1 + - 2 + q: + - 3 + - 4 + r: + a: 1 + b: 2 + s: + w: + f: 10 + g: 9.9 + "true": false + undefined1: {} + undefined2: {} + x: + - 100 + - 200 + z: + a: b + sort_bindings: true diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0698.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0698.yaml new file mode 100644 index 0000000000..26ea87229a --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0698.yaml @@ -0,0 +1,170 @@ +--- +cases: + - note: "baseandvirtualdocs/base/virtual: set" + query: data.topdown.w = x + modules: + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package topdown.conflicts + + k := "bar" + - | + package topdown.g.h + + p if { + false + } + - | + package topdown_test_partial + + __result__ := _result if { + data.partial.topdown.r = _result + } + - | + package topdown.a.b.c.empty + - | + package partial.topdown + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + - | + package topdown.no.base.doc + + p := true + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + data: + topdown: + set: + u: + - "1" + - "2" + - "3" + - "4" + input_term: "{}" + want_result: + - x: + u: + - "1" + - "2" + - "3" + - "4" + v: + - "1" + - "2" + - "3" + - "4" diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0699.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0699.yaml new file mode 100644 index 0000000000..e74f493cd3 --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0699.yaml @@ -0,0 +1,156 @@ +--- +cases: + - note: "baseandvirtualdocs/base/virtual: no base" + query: data.topdown.s = x + modules: + - | + package topdown.conflicts + + k := "bar" + - | + package topdown.no.base.doc + + p := true + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package topdown.a.b.c.empty + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = {"u": [1, 2, 3, 4], "v": {1, 2, 3, 4}} + } + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package topdown.g.h + + p if { + false + } + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package partial.topdown + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + data: {} + input_term: "{}" + want_result: + - x: + base: + doc: + p: true diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0700.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0700.yaml new file mode 100644 index 0000000000..f19a8b1049 --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0700.yaml @@ -0,0 +1,153 @@ +--- +cases: + - note: "baseandvirtualdocs/base/virtual: undefined" + query: data.topdown.t = x + modules: + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package topdown.a.b.c.empty + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + - | + package topdown.no.base.doc + + p := true + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + - | + package topdown_test_partial + + __result__ := _result if { + _result = {"base": {"doc": {"p": true}}} + } + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package partial.topdown + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.g.h + + p if { + false + } + - | + package topdown.conflicts + + k := "bar" + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + data: {} + input_term: "{}" + want_result: + - x: {} diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0701.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0701.yaml new file mode 100644 index 0000000000..06dd0f7761 --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0701.yaml @@ -0,0 +1,165 @@ +--- +cases: + - note: "baseandvirtualdocs/base/virtual: undefined-2" + query: data.topdown.v = x + modules: + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + - | + package topdown_test_partial + + __result__ := _result if { + _result = {} + } + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.g.h + + p if { + false + } + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + - | + package topdown.no.base.doc + + p := true + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + - | + package topdown.a.b.c.empty + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package topdown.conflicts + + k := "bar" + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package partial.topdown + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + data: + topdown: + g: + h: + k: + - "1" + - "2" + - "3" + input_term: "{}" + want_result: + - x: + h: + k: + - "1" + - "2" + - "3" diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0702.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0702.yaml new file mode 100644 index 0000000000..7b38fdcca9 --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0702.yaml @@ -0,0 +1,153 @@ +--- +cases: + - note: "baseandvirtualdocs/base/virtual: missing input value" + query: data.topdown.u = x + modules: + - | + package topdown.no.base.doc + + p := true + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + - | + package topdown.a.b.c.empty + - | + package topdown.conflicts + + k := "bar" + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package topdown.g.h + + p if { + false + } + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package partial.topdown + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = {"h": {"k": [1, 2, 3]}} + } + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + data: {} + input_term: "{}" + want_result: + - x: {} diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0703.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0703.yaml new file mode 100644 index 0000000000..75cbe2fab2 --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0703.yaml @@ -0,0 +1,156 @@ +--- +cases: + - note: baseandvirtualdocs/iterate ground + query: data.topdown.iterate_ground = x + modules: + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + - | + package topdown.no.base.doc + + p := true + - | + package partial.topdown + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package topdown.conflicts + + k := "bar" + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + - | + package topdown.a.b.c.empty + - | + package topdown_test_partial + + __result__ := _result if { + data.topdown.missing.input.value = _result + } + - | + package topdown.g.h + + p if { + false + } + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + data: {} + input_term: "{}" + want_result: + - x: + - p + - r + sort_bindings: true diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0704.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0704.yaml new file mode 100644 index 0000000000..e6f52a0671 --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0704.yaml @@ -0,0 +1,157 @@ +--- +cases: + - note: "baseandvirtualdocs/base/virtual: conflicts" + query: data.topdown.conflicts = x + modules: + - | + package topdown_test_partial + + __result__ := _result if { + _result = {"p", "r"} + } + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + - | + package topdown.conflicts + + k := "bar" + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package topdown.no.base.doc + + p := true + - | + package partial.topdown + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + - | + package topdown.a.b.c.empty + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + - | + package topdown.g.h + + p if { + false + } + data: + topdown: + conflicts: + k: foo + input_term: "{}" + want_result: + - x: + k: foo diff --git a/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0705.yaml b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0705.yaml new file mode 100644 index 0000000000..6174f57401 --- /dev/null +++ b/test/cases/testdata/v1/baseandvirtualdocs/test-baseandvirtualdocs-0705.yaml @@ -0,0 +1,158 @@ +--- +cases: + - note: baseandvirtualdocs/enumerate virtual errors + query: data.enum_errors.caller.p = x + modules: + - | + package topdown.a.b.c.s + + w := {"f": 10, "g": 9.9} + - | + package topdown.a.b.c.undefined1 + + p if { + false + } + + p if { + false + } + + q if { + false + } + - | + package topdown.set + + v contains __local6__ if { + true + __local6__ = data.topdown.set.u[_] + } + - | + package enum_errors.a.b.c + + p := x if { + __local0__ = 1 / 0 + x = __local0__ + } + - | + package topdown.a.b.c.empty + - | + package topdown.virtual.constants + + p := 1 + + q := 2 + + r := 1 + - | + package topdown.g.h + + p if { + false + } + - | + package enum_errors.caller + + p[x] := y if { + data.enum_errors.a[x] = y + } + - | + package partial.topdown + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + + r contains ["c", x21] if { + data.topdown.a.b.c = x21 + } + - | + package topdown.missing.input.value + + p := __local7__ if { + true + __local7__ = input.deadbeef + } + - | + package topdown.conflicts + + k := "bar" + - | + package topdown.no.base.doc + + p := true + - | + package topdown.a.b.c.undefined2 + + p if { + input.foo + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = {"k": "foo"} + } + - | + package topdown + + p contains [x1, x2, x3, x4] if { + data.topdown.a.b[x1][x2][x3] = x4 + } + + q contains [x1, x2, x3] if { + data.topdown.a.b[x1][x2][0] = x3 + } + + r contains [x1, x2] if { + data.topdown.a.b[x1] = x2 + } + + s := __local1__ if { + true + __local1__ = data.topdown.no + } + + t := __local2__ if { + true + __local2__ = data.topdown.a.b.c.undefined1 + } + + u := __local3__ if { + true + __local3__ = data.topdown.missing.input.value + } + + v := __local4__ if { + true + __local4__ = data.topdown.g + } + + w := __local5__ if { + true + __local5__ = data.topdown.set + } + + iterate_ground contains x if { + data.topdown.virtual.constants[x] = 1 + } + - | + package topdown.a.b.c + + p := [1, 2] + + q := [3, 4] + + r["a"] := 1 + + r["b"] := 2 + data: {} + input_term: "{}" + want_result: + - x: + b: + c: {} + want_error_code: eval_builtin_error + want_error: divide by zero + strict_error: true diff --git a/test/cases/testdata/v1/bitsand/test-bitsand-0055.yaml b/test/cases/testdata/v1/bitsand/test-bitsand-0055.yaml new file mode 100644 index 0000000000..44401593d2 --- /dev/null +++ b/test/cases/testdata/v1/bitsand/test-bitsand-0055.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: bitsand/basic bitwise-and + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + bits.and(7, 9, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/bitsand/test-bitsand-0056.yaml b/test/cases/testdata/v1/bitsand/test-bitsand-0056.yaml new file mode 100644 index 0000000000..042f4a3fe0 --- /dev/null +++ b/test/cases/testdata/v1/bitsand/test-bitsand-0056.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: bitsand/and with zero is and + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + bits.and(50, 0, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 0 + sort_bindings: true diff --git a/test/cases/testdata/v1/bitsand/test-bitsand-0057.yaml b/test/cases/testdata/v1/bitsand/test-bitsand-0057.yaml new file mode 100644 index 0000000000..11adb54f40 --- /dev/null +++ b/test/cases/testdata/v1/bitsand/test-bitsand-0057.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: bitsand/lhs (float) error + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + bits.and(7.2, 42, __local1__) + __local0__ = __local1__ + } + data: {} + want_error_code: eval_type_error + want_error: "bits.and: operand 1 must be integer number but got floating-point number" + strict_error: true diff --git a/test/cases/testdata/v1/bitsnegate/test-bitsnegate-0058.yaml b/test/cases/testdata/v1/bitsnegate/test-bitsnegate-0058.yaml new file mode 100644 index 0000000000..2a32b537b6 --- /dev/null +++ b/test/cases/testdata/v1/bitsnegate/test-bitsnegate-0058.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: bitsnegate/basic bitwise-negate + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + bits.negate(42, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - -43 + sort_bindings: true diff --git a/test/cases/testdata/v1/bitsnegate/test-bitsnegate-0059.yaml b/test/cases/testdata/v1/bitsnegate/test-bitsnegate-0059.yaml new file mode 100644 index 0000000000..3e64f43b96 --- /dev/null +++ b/test/cases/testdata/v1/bitsnegate/test-bitsnegate-0059.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: bitsnegate/float error + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + bits.negate(7.2, __local1__) + __local0__ = __local1__ + } + data: {} + want_error_code: eval_type_error + want_error: "bits.negate: operand 1 must be integer number but got floating-point number" + strict_error: true diff --git a/test/cases/testdata/v1/bitsor/test-bitsor-0052.yaml b/test/cases/testdata/v1/bitsor/test-bitsor-0052.yaml new file mode 100644 index 0000000000..eba90637a0 --- /dev/null +++ b/test/cases/testdata/v1/bitsor/test-bitsor-0052.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: bitsor/basic bitwise-or + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + bits.or(7, 9, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 15 + sort_bindings: true diff --git a/test/cases/testdata/v1/bitsor/test-bitsor-0053.yaml b/test/cases/testdata/v1/bitsor/test-bitsor-0053.yaml new file mode 100644 index 0000000000..3b964408a5 --- /dev/null +++ b/test/cases/testdata/v1/bitsor/test-bitsor-0053.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: bitsor/or with zero is value + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + bits.or(50, 0, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 50 + sort_bindings: true diff --git a/test/cases/testdata/v1/bitsor/test-bitsor-0054.yaml b/test/cases/testdata/v1/bitsor/test-bitsor-0054.yaml new file mode 100644 index 0000000000..9bc9594fd8 --- /dev/null +++ b/test/cases/testdata/v1/bitsor/test-bitsor-0054.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: bitsor/lhs (float) error + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + bits.or(7.2, 42, __local1__) + __local0__ = __local1__ + } + data: {} + want_error_code: eval_type_error + want_error: "bits.or: operand 1 must be integer number but got floating-point number" + strict_error: true diff --git a/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0063.yaml b/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0063.yaml new file mode 100644 index 0000000000..b9665f9cdf --- /dev/null +++ b/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0063.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: bitsshiftleft/basic shift-left + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + bits.lsh(1, 3, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 8 + sort_bindings: true diff --git a/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0064.yaml b/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0064.yaml new file mode 100644 index 0000000000..afee762923 --- /dev/null +++ b/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0064.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: bitsshiftleft/lhs (float) error + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + bits.lsh(7.2, 42, __local1__) + __local0__ = __local1__ + } + data: {} + want_error_code: eval_type_error + want_error: "bits.lsh: operand 1 must be integer number but got floating-point number" + strict_error: true diff --git a/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0065.yaml b/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0065.yaml new file mode 100644 index 0000000000..dd14c3100d --- /dev/null +++ b/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0065.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: bitsshiftleft/rhs must be unsigned + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + bits.lsh(7, -1, __local1__) + __local0__ = __local1__ + } + data: {} + want_error_code: eval_type_error + want_error: "bits.lsh: operand 2 must be an unsigned integer number but got a negative integer" + strict_error: true diff --git a/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0066.yaml b/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0066.yaml new file mode 100644 index 0000000000..0127fe2865 --- /dev/null +++ b/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0066.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: bitsshiftleft/shift of max int32 doesn't overflow + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + bits.lsh(2147483647, 1, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: 4294967294 diff --git a/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0067.yaml b/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0067.yaml new file mode 100644 index 0000000000..d5ff6cf154 --- /dev/null +++ b/test/cases/testdata/v1/bitsshiftleft/test-bitsshiftleft-0067.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: bitsshiftleft/shift of max int64 doesn't overflow and is not lossy + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + bits.lsh(9223372036854775807, 1, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: 18446744073709551614 diff --git a/test/cases/testdata/v1/bitsshiftright/test-bitsshiftright-0068.yaml b/test/cases/testdata/v1/bitsshiftright/test-bitsshiftright-0068.yaml new file mode 100644 index 0000000000..f2978752d3 --- /dev/null +++ b/test/cases/testdata/v1/bitsshiftright/test-bitsshiftright-0068.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: bitsshiftright/basic shift-right + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + bits.rsh(8, 3, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/bitsshiftright/test-bitsshiftright-0069.yaml b/test/cases/testdata/v1/bitsshiftright/test-bitsshiftright-0069.yaml new file mode 100644 index 0000000000..b090df0369 --- /dev/null +++ b/test/cases/testdata/v1/bitsshiftright/test-bitsshiftright-0069.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: bitsshiftright/lhs (float) error + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + bits.rsh(7.2, 42, __local1__) + __local0__ = __local1__ + } + data: {} + want_error_code: eval_type_error + want_error: "bits.rsh: operand 1 must be integer number but got floating-point number" + strict_error: true diff --git a/test/cases/testdata/v1/bitsshiftright/test-bitsshiftright-0070.yaml b/test/cases/testdata/v1/bitsshiftright/test-bitsshiftright-0070.yaml new file mode 100644 index 0000000000..6d423aa3bc --- /dev/null +++ b/test/cases/testdata/v1/bitsshiftright/test-bitsshiftright-0070.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: bitsshiftright/rhs must be unsigned + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + bits.rsh(7, -1, __local1__) + __local0__ = __local1__ + } + data: {} + want_error_code: eval_type_error + want_error: "bits.rsh: operand 2 must be an unsigned integer number but got a negative integer" + strict_error: true diff --git a/test/cases/testdata/v1/bitsxor/test-bitsxor-0060.yaml b/test/cases/testdata/v1/bitsxor/test-bitsxor-0060.yaml new file mode 100644 index 0000000000..d4a0538cc6 --- /dev/null +++ b/test/cases/testdata/v1/bitsxor/test-bitsxor-0060.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: bitsxor/basic bitwise-xor + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + bits.xor(42, 3, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 41 + sort_bindings: true diff --git a/test/cases/testdata/v1/bitsxor/test-bitsxor-0061.yaml b/test/cases/testdata/v1/bitsxor/test-bitsxor-0061.yaml new file mode 100644 index 0000000000..59bf382eac --- /dev/null +++ b/test/cases/testdata/v1/bitsxor/test-bitsxor-0061.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: bitsxor/xor same is 0 + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + bits.xor(42, 42, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 0 + sort_bindings: true diff --git a/test/cases/testdata/v1/bitsxor/test-bitsxor-0062.yaml b/test/cases/testdata/v1/bitsxor/test-bitsxor-0062.yaml new file mode 100644 index 0000000000..678f4d2847 --- /dev/null +++ b/test/cases/testdata/v1/bitsxor/test-bitsxor-0062.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: bitsxor/lhs (float) error + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + bits.xor(7.2, 42, __local1__) + __local0__ = __local1__ + } + data: {} + want_error_code: eval_type_error + want_error: "bits.xor: operand 1 must be integer number but got floating-point number" + strict_error: true diff --git a/test/cases/testdata/v1/casts/test-casts-0824.yaml b/test/cases/testdata/v1/casts/test-casts-0824.yaml new file mode 100644 index 0000000000..1827cc9c8a --- /dev/null +++ b/test/cases/testdata/v1/casts/test-casts-0824.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: casts/to_number + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z, i, j] if { + to_number("-42.0", x) + to_number(false, y) + to_number(100.1, z) + to_number(null, i) + to_number(true, j) + } + data: {} + want_result: + - x: + - -42 + - 0 + - 100.1 + - 0 + - 1 diff --git a/test/cases/testdata/v1/casts/test-casts-0825.yaml b/test/cases/testdata/v1/casts/test-casts-0825.yaml new file mode 100644 index 0000000000..1cea208ec2 --- /dev/null +++ b/test/cases/testdata/v1/casts/test-casts-0825.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: casts/to_number ref dest + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.a[2] + to_number("3", __local0__) + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/casts/test-casts-0826.yaml b/test/cases/testdata/v1/casts/test-casts-0826.yaml new file mode 100644 index 0000000000..d98b9ecdec --- /dev/null +++ b/test/cases/testdata/v1/casts/test-casts-0826.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: casts/to_number ref dest + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.a[2] + not to_number("-1", __local0__) + } + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: true diff --git a/test/cases/testdata/v1/casts/test-casts-0827.yaml b/test/cases/testdata/v1/casts/test-casts-0827.yaml new file mode 100644 index 0000000000..14dfe55cf4 --- /dev/null +++ b/test/cases/testdata/v1/casts/test-casts-0827.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "casts/to_number: bad input" + query: data.generated.p = x + modules: + - | + package generated + + p if { + to_number("broken", x) + } + want_error_code: eval_builtin_error + want_error: invalid syntax + strict_error: true diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0608.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0608.yaml new file mode 100644 index 0000000000..b1c92d05ef --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0608.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: comparisonexpr/equals + query: data.generated.p = x + modules: + - | + package generated + + p if { + 1 = 1 + data.a[i] = x + x = 2 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0609.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0609.yaml new file mode 100644 index 0000000000..ba181c2388 --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0609.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: comparisonexpr/noteq + query: data.generated.p = x + modules: + - | + package generated + + p if { + 0 != 1 + data.a[i] = x + x != 2 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0610.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0610.yaml new file mode 100644 index 0000000000..e0ae018fb5 --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0610.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: comparisonexpr/gt + query: data.generated.p = x + modules: + - | + package generated + + p if { + 1 > 0 + data.a[i] = x + x > 2 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0611.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0611.yaml new file mode 100644 index 0000000000..29b6ccd4d2 --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0611.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: comparisonexpr/gteq + query: data.generated.p = x + modules: + - | + package generated + + p if { + 1 >= 1 + data.a[i] = x + x >= 4 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0612.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0612.yaml new file mode 100644 index 0000000000..fe98c88895 --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0612.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: comparisonexpr/lt + query: data.generated.p = x + modules: + - | + package generated + + p if { + -1 < 0 + data.a[i] = x + x < 5 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0613.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0613.yaml new file mode 100644 index 0000000000..e65c0c4b65 --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0613.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: comparisonexpr/lteq + query: data.generated.p = x + modules: + - | + package generated + + p if { + -1 <= 0 + data.a[i] = x + x <= 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0614.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0614.yaml new file mode 100644 index 0000000000..b17fa7e98a --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0614.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "comparisonexpr/undefined: equals" + query: data.generated.p = x + modules: + - | + package generated + + p if { + 0 = 1 + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0615.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0615.yaml new file mode 100644 index 0000000000..e90d8c0d39 --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0615.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "comparisonexpr/undefined: noteq" + query: data.generated.p = x + modules: + - | + package generated + + p if { + 0 != 0 + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0616.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0616.yaml new file mode 100644 index 0000000000..0d3b7f804c --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0616.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "comparisonexpr/undefined: gt" + query: data.generated.p = x + modules: + - | + package generated + + p if { + 1 > 2 + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0617.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0617.yaml new file mode 100644 index 0000000000..ef688daf15 --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0617.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "comparisonexpr/undefined: gteq" + query: data.generated.p = x + modules: + - | + package generated + + p if { + 1 >= 2 + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0618.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0618.yaml new file mode 100644 index 0000000000..69710d1816 --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0618.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "comparisonexpr/undefined: lt" + query: data.generated.p = x + modules: + - | + package generated + + p if { + 1 < -1 + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0619.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0619.yaml new file mode 100644 index 0000000000..2af9070553 --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0619.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: "comparisonexpr/undefined: lteq" + query: data.generated.p = x + modules: + - | + package generated + + p if { + 1 <= -1 + } + want_result: [] diff --git a/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0620.yaml b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0620.yaml new file mode 100644 index 0000000000..8f9bcb5615 --- /dev/null +++ b/test/cases/testdata/v1/comparisonexpr/test-comparisonexpr-0620.yaml @@ -0,0 +1,46 @@ +--- +cases: + - note: "comparisonexpr/numbers: int and float comparison" + query: data.comparison.p = x + modules: + - | + package comparison + + p if { + 1 == 1.0 + } + want_result: + - x: true + - note: "comparisonexpr/numbers: int and float array comparison" + query: data.comparison.p = x + modules: + - | + package comparison + + p if { + [1] == [1.0] + } + want_result: + - x: true + - note: "comparisonexpr/numbers: int and float object comparison" + query: data.comparison.p = x + modules: + - | + package comparison + + p if { + {1: 1} == {1: 1.0} + } + want_result: + - x: true + - note: "comparisonexpr/numbers: int and float nested object comparison" + query: data.comparison.p = x + modules: + - | + package comparison + + p if { + {"x": [1, 2, {"b": 3.0}]} == {"x": [1, 2, {"b": 3}]} + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0495.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0495.yaml new file mode 100644 index 0000000000..563a23adb2 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0495.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: completedoc/undefined + query: data.generated.p = x + modules: + - | + package generated + + p := null if { + false + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0496.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0496.yaml new file mode 100644 index 0000000000..40bead12f7 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0496.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: completedoc/null + query: data.generated.p = x + modules: + - | + package generated + + p := null + data: {} + want_result: + - x: null diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0497.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0497.yaml new file mode 100644 index 0000000000..9d080c8907 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0497.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: "completedoc/bool: true" + query: data.generated.p = x + modules: + - | + package generated + + p := true + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0498.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0498.yaml new file mode 100644 index 0000000000..6069184343 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0498.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: "completedoc/bool: false" + query: data.generated.p = x + modules: + - | + package generated + + p := false + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0499.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0499.yaml new file mode 100644 index 0000000000..01b46339c7 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0499.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: "completedoc/number: 3" + query: data.generated.p = x + modules: + - | + package generated + + p := 3 + data: {} + want_result: + - x: 3 diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0500.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0500.yaml new file mode 100644 index 0000000000..507e1b84d6 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0500.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: "completedoc/number: 3.0" + query: data.generated.p = x + modules: + - | + package generated + + p := 3.0 + data: {} + want_result: + - x: 3.0 diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0501.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0501.yaml new file mode 100644 index 0000000000..b29df723e6 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0501.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: "completedoc/number: 66.66667" + query: data.generated.p = x + modules: + - | + package generated + + p := 66.66667 + data: {} + want_result: + - x: 66.66667 diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0502.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0502.yaml new file mode 100644 index 0000000000..de7fe7245d --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0502.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: 'completedoc/string: "hello"' + query: data.generated.p = x + modules: + - | + package generated + + p := "hello" + data: {} + want_result: + - x: hello diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0503.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0503.yaml new file mode 100644 index 0000000000..14a33d0974 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0503.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: 'completedoc/string: ""' + query: data.generated.p = x + modules: + - | + package generated + + p := "" + data: {} + want_result: + - x: "" diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0504.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0504.yaml new file mode 100644 index 0000000000..f2d4ae099b --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0504.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "completedoc/array: [1,2,3,4]" + query: data.generated.p = x + modules: + - | + package generated + + p := [1, 2, 3, 4] + data: {} + want_result: + - x: + - 1 + - 2 + - 3 + - 4 diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0505.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0505.yaml new file mode 100644 index 0000000000..721ed2407d --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0505.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: "completedoc/array: []" + query: data.generated.p = x + modules: + - | + package generated + + p := [] + data: {} + want_result: + - x: [] diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0506.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0506.yaml new file mode 100644 index 0000000000..9db7533aa4 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0506.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: 'completedoc/object/nested composites: {"a": [1], "b": [2], "c": [3]}' + query: data.generated.p = x + modules: + - | + package generated + + p := {"a": [1], "b": [2], "c": [3]} + data: {} + want_result: + - x: + a: + - 1 + b: + - 2 + c: + - 3 diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0507.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0507.yaml new file mode 100644 index 0000000000..b8eb8d4c05 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0507.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "completedoc/object/non-string key:" + query: data.generated.p = x + modules: + - | + package generated + + p := {1: 2, {3: 4}: 5} + data: {} + want_result: + - x: + '{"3":4}': 5 + "1": 2 diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0508.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0508.yaml new file mode 100644 index 0000000000..cb3577f0f1 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0508.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: "completedoc/set/nested: {{1,2},{2,3}}" + query: data.generated.p = x + modules: + - | + package generated + + p := {{1, 2}, {2, 3}} + data: {} + want_result: + - x: + - - 1 + - 2 + - - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0509.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0509.yaml new file mode 100644 index 0000000000..8d87b235e8 --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0509.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: completedoc/vars + query: data.generated.p = x + modules: + - | + package generated + + p := {"a": [x, y]} if { + x = 1 + y = 2 + } + data: {} + want_result: + - x: + a: + - 1 + - 2 diff --git a/test/cases/testdata/v1/completedoc/test-completedoc-0510.yaml b/test/cases/testdata/v1/completedoc/test-completedoc-0510.yaml new file mode 100644 index 0000000000..6c6c55cade --- /dev/null +++ b/test/cases/testdata/v1/completedoc/test-completedoc-0510.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: completedoc/vars conflict + query: data.generated.p = x + modules: + - | + package generated + + p := {"a": [x, y]} if { + xs = [1, 2] + ys = [1, 2] + x = xs[_] + y = ys[_] + } + data: {} + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs diff --git a/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1073.yaml b/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1073.yaml new file mode 100644 index 0000000000..a9373cf2a8 --- /dev/null +++ b/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1073.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: compositebasedereference/array + query: data.generated.p = x + modules: + - | + package generated + + p if { + not data.a[[0]] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1074.yaml b/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1074.yaml new file mode 100644 index 0000000000..cb0f03e9a0 --- /dev/null +++ b/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1074.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: compositebasedereference/object + query: data.generated.p = x + modules: + - | + package generated + + p if { + not data.a[{"b": "c"}] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1075.yaml b/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1075.yaml new file mode 100644 index 0000000000..f079be0ce8 --- /dev/null +++ b/test/cases/testdata/v1/compositebasedereference/test-compositebasedereference-1075.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: compositebasedereference/set + query: data.generated.p = x + modules: + - | + package generated + + p if { + not data.a[["b"]] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0743.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0743.yaml new file mode 100644 index 0000000000..834e7e14fa --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0743.yaml @@ -0,0 +1,39 @@ +--- +cases: + - note: compositereferences/array + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p := __local0__ if { + true + __local0__ = data.fixture.r[[1, 2]] + } + data: {} + want_result: + - x: + - 1 + - 2 diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0744.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0744.yaml new file mode 100644 index 0000000000..9183d25284 --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0744.yaml @@ -0,0 +1,38 @@ +--- +cases: + - note: compositereferences/object + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p := __local0__ if { + true + __local0__ = data.fixture.r[{"foo": "bar"}] + } + data: {} + want_result: + - x: + foo: bar diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0745.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0745.yaml new file mode 100644 index 0000000000..cb1947d612 --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0745.yaml @@ -0,0 +1,39 @@ +--- +cases: + - note: compositereferences/set + query: data.test.p = x + modules: + - | + package test + + p := __local0__ if { + true + __local0__ = data.fixture.r[{1, 2}] + } + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + data: {} + want_result: + - x: + - 1 + - 2 diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0746.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0746.yaml new file mode 100644 index 0000000000..47dda90a97 --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0746.yaml @@ -0,0 +1,40 @@ +--- +cases: + - note: compositereferences/unify array + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p := __local0__ if { + true + __local0__ = [x | data.fixture.r[[1, x]]] + } + data: {} + want_result: + - x: + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0747.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0747.yaml new file mode 100644 index 0000000000..32ad78739b --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0747.yaml @@ -0,0 +1,38 @@ +--- +cases: + - note: compositereferences/unify object + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p := __local0__ if { + true + __local0__ = [x | data.fixture.r[{"foo": x}]] + } + data: {} + want_result: + - x: + - bar diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0748.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0748.yaml new file mode 100644 index 0000000000..567285d38d --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0748.yaml @@ -0,0 +1,40 @@ +--- +cases: + - note: compositereferences/unify partial ground array + query: data.test.p = x + modules: + - | + package test + + p := __local0__ if { + true + __local0__ = [x | data.fixture.p1[[x, 2]]] + } + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + data: {} + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0749.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0749.yaml new file mode 100644 index 0000000000..a04e75e3d1 --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0749.yaml @@ -0,0 +1,47 @@ +--- +cases: + - note: compositereferences/complete doc unify + query: data.test.p = x + modules: + - | + package test + + p := __local0__ if { + true + __local0__ = [[x, y] | data.fixture.s[[x, y]]] + } + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + data: {} + want_result: + - x: + - - 1 + - 2 + - - 1 + - 3 + - - 2 + - 7 + - - - 1 + - 1 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0750.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0750.yaml new file mode 100644 index 0000000000..8d7ecc4f47 --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0750.yaml @@ -0,0 +1,47 @@ +--- +cases: + - note: compositereferences/partial doc unify + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p := __local0__ if { + true + __local0__ = [[x, y] | data.fixture.r[[x, y]]] + } + data: {} + want_result: + - x: + - - 1 + - 2 + - - 1 + - 3 + - - 2 + - 7 + - - - 1 + - 1 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0751.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0751.yaml new file mode 100644 index 0000000000..abf5080c97 --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0751.yaml @@ -0,0 +1,36 @@ +--- +cases: + - note: compositereferences/empty set + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p if { + data.fixture.empty[set()] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0752.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0752.yaml new file mode 100644 index 0000000000..d5861830de --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0752.yaml @@ -0,0 +1,40 @@ +--- +cases: + - note: compositereferences/ref + query: data.test.p = x + modules: + - | + package test + + p := __local0__ if { + true + __local1__ = data.fixture.foo.bar + __local0__ = data.fixture.r[[__local1__, 3]] + } + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + data: {} + want_result: + - x: + - 1 + - 3 diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0753.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0753.yaml new file mode 100644 index 0000000000..aa13a69529 --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0753.yaml @@ -0,0 +1,41 @@ +--- +cases: + - note: compositereferences/nested ref + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p := __local0__ if { + true + __local1__ = data.fixture.o.foo + __local2__ = data.fixture.foo[__local1__] + __local0__ = data.fixture.r[[__local2__, 3]] + } + data: {} + want_result: + - x: + - 1 + - 3 diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0754.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0754.yaml new file mode 100644 index 0000000000..7ca5cc96ee --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0754.yaml @@ -0,0 +1,41 @@ +--- +cases: + - note: compositereferences/comprehension + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p := __local0__ if { + true + __local1__ = [x | y = [1, 1]; x = y[_]] + __local0__ = data.fixture.s[[__local1__, 4]] + } + data: {} + want_result: + - x: + - - 1 + - 1 + - 4 diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0755.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0755.yaml new file mode 100644 index 0000000000..919e749538 --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0755.yaml @@ -0,0 +1,36 @@ +--- +cases: + - note: compositereferences/missing array + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p := __local0__ if { + true + __local0__ = data.fixture.r[[1, 4]] + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0756.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0756.yaml new file mode 100644 index 0000000000..54a6d1d983 --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0756.yaml @@ -0,0 +1,36 @@ +--- +cases: + - note: compositereferences/missing object value + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p := __local0__ if { + true + __local0__ = data.fixture.r[{"foo": "baz"}] + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/compositereferences/test-compositereferences-0757.yaml b/test/cases/testdata/v1/compositereferences/test-compositereferences-0757.yaml new file mode 100644 index 0000000000..c3a704e76e --- /dev/null +++ b/test/cases/testdata/v1/compositereferences/test-compositereferences-0757.yaml @@ -0,0 +1,36 @@ +--- +cases: + - note: compositereferences/missing set + query: data.test.p = x + modules: + - | + package fixture + + empty := {set()} + + s := {[1, 2], [1, 3], {"foo": "bar"}, {1, 2}, [2, 7], [[1, 1], 4]} + + r contains x if { + data.fixture.s[x] + } + + a := [1, 2] + + o := {"foo": "bar"} + + foo := {"bar": 1} + + p1 contains [1, 2] + + p1 contains [1, 3] + + p1 contains [2, 2] + - | + package test + + p := __local0__ if { + true + __local0__ = data.fixture.r[{1, 3}] + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0781.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0781.yaml new file mode 100644 index 0000000000..8967bc4c71 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0781.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: comprehensions/array simple + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + xs = [x | x = data.a[_]] + __local0__ = xs[i] + __local0__ > 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0782.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0782.yaml new file mode 100644 index 0000000000..01e7899bec --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0782.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: comprehensions/array nested + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + ys = [y | x = [z | z = data.a[_]]; y = x[_]] + __local0__ = ys[i] + __local0__ > 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0783.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0783.yaml new file mode 100644 index 0000000000..5ebce67414 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0783.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: comprehensions/array embedded array + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + __local0__ = [x | x = data.a[_]] + xs = [__local0__] + __local1__ = xs[0][i] + __local1__ > 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0784.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0784.yaml new file mode 100644 index 0000000000..0290005771 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0784.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: comprehensions/array embedded object + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + __local0__ = [x | x = data.a[_]] + xs = {"a": __local0__} + __local1__ = xs.a[i] + __local1__ > 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0785.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0785.yaml new file mode 100644 index 0000000000..67eff32968 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0785.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: comprehensions/array embedded set + query: data.generated.p = x + modules: + - | + package generated + + p := xs if { + __local0__ = [x | x = data.a[_]] + xs = {__local0__} + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - - 1 + - 2 + - 3 + - 4 diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0786.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0786.yaml new file mode 100644 index 0000000000..108e51560f --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0786.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: comprehensions/array closure + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + y = 1 + x = [y | y = 1] + } + data: {} + want_result: + - x: + - - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0787.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0787.yaml new file mode 100644 index 0000000000..197df2edc0 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0787.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: comprehensions/array dereference embedded + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q.a[2][i] = x + } + + q[k] := v if { + k = "a" + v = [y | i = [z | z = data.a[_]]; i[_] = _; i = y] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0788.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0788.yaml new file mode 100644 index 0000000000..fbfabcdf93 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0788.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: comprehensions/object simple + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + xs = {s: x | x = data.a[_]; format_int(x, 10, s)} + y = xs[i] + y > 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - "2" + - "3" + - "4" + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0789.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0789.yaml new file mode 100644 index 0000000000..335133850a --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0789.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: comprehensions/object non-string key + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + xs = {k: 1 | data.a[_] = k} + xs[x] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0790.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0790.yaml new file mode 100644 index 0000000000..8e60bd03f2 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0790.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: comprehensions/object nested + query: data.generated.p = x + modules: + - | + package generated + + p := r if { + r = {x: y | z = {i: q | i = data.b[q]}; x = z[y]} + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: + v1: hello + v2: goodbye diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0791.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0791.yaml new file mode 100644 index 0000000000..e0cab8efac --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0791.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: comprehensions/object embedded array + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + __local0__ = {s: x | x = data.a[_]; format_int(x, 10, s)} + xs = [__local0__] + __local1__ = xs[0][i] + __local1__ > 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - "2" + - "3" + - "4" + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0792.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0792.yaml new file mode 100644 index 0000000000..003b5a1d76 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0792.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: comprehensions/object embedded object + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + __local0__ = {s: x | x = data.a[_]; format_int(x, 10, s)} + xs = {"a": __local0__} + __local1__ = xs.a[i] + __local1__ > 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - "2" + - "3" + - "4" + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0793.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0793.yaml new file mode 100644 index 0000000000..7a4729cc7a --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0793.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: comprehensions/object embedded set + query: data.generated.p = x + modules: + - | + package generated + + p := xs if { + __local0__ = {s: x | x = data.a[_]; format_int(x, 10, s)} + xs = {__local0__} + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - "1": 1 + "2": 2 + "3": 3 + "4": 4 diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0794.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0794.yaml new file mode 100644 index 0000000000..5d4ba82a71 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0794.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: comprehensions/object closure + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + y = 1 + x = {"foo": y | y = 1} + } + data: {} + want_result: + - x: + - foo: 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0795.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0795.yaml new file mode 100644 index 0000000000..8548cface4 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0795.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: comprehensions/object dereference embedded + query: data.generated.p = x + modules: + - | + package generated + + arr := [4] + + p contains x if { + data.generated.q.a = x + } + + q[k] := v if { + k = "a" + v = {"bar": y | i = {"foo": z | z = data.generated.arr[_]}; i[_] = _; i = y} + } + data: {} + want_result: + - x: + - bar: + foo: 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0796.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0796.yaml new file mode 100644 index 0000000000..28cbe4aac1 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0796.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: comprehensions/object conflict + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q.a = x + } + + q[k] := v if { + k = "a" + v = {"bar": y | i = {"foo": z | z = data.a[_]}; i[_] = _; i = y} + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_error_code: eval_conflict_error + want_error: object keys must be unique diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0797.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0797.yaml new file mode 100644 index 0000000000..3b190130d3 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0797.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: comprehensions/set simple + query: data.generated.p = x + modules: + - | + package generated + + p := y if { + y = {x | x = data.a[_]; x > 1} + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 2 + - 3 + - 4 diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0798.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0798.yaml new file mode 100644 index 0000000000..7a4a5a372c --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0798.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: comprehensions/set nested + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + ys = {y | x = {z | z = data.a[_]}; y = x[_]} + __local0__ = ys[i] + __local0__ > 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0799.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0799.yaml new file mode 100644 index 0000000000..7a1feda843 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0799.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: comprehensions/set embedded array + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + __local0__ = {x | x = data.a[_]} + xs = [__local0__] + __local1__ = xs[0][i] + __local1__ > 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0800.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0800.yaml new file mode 100644 index 0000000000..274b3c4760 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0800.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: comprehensions/set embedded object + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + __local0__ = {x | x = data.a[_]} + xs = {"a": __local0__} + __local1__ = xs.a[i] + __local1__ > 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0801.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0801.yaml new file mode 100644 index 0000000000..c38a06607d --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0801.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: comprehensions/set embedded set + query: data.generated.p = x + modules: + - | + package generated + + p := xs if { + __local0__ = {x | x = data.a[_]} + xs = {__local0__} + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - - 1 + - 2 + - 3 + - 4 diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0802.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0802.yaml new file mode 100644 index 0000000000..3d3dfa5c78 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0802.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: comprehensions/set closure + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + y = 1 + x = {y | y = 1} + } + data: {} + want_result: + - x: + - - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-0803.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-0803.yaml new file mode 100644 index 0000000000..a1a63b3321 --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-0803.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: comprehensions/set dereference embedded + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q.a = x + } + + q[k] := v if { + k = "a" + v = {y | i = {z | z = data.a[_]}; i[_] = _; i = y} + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - - - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/comprehensions/test-comprehensions-and-vars.yaml b/test/cases/testdata/v1/comprehensions/test-comprehensions-and-vars.yaml new file mode 100644 index 0000000000..3deaed1b0f --- /dev/null +++ b/test/cases/testdata/v1/comprehensions/test-comprehensions-and-vars.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: comprehensions/var bindings have no effect outside + query: data.test.p = x + modules: + - | + package test + + xs := {"a", "b", "c"} + + p := x if { + y := {x | xs[x]} + z := {x | xs[x]} + count(y) == count(z) + x := count(y) + } + want_result: + - x: 3 diff --git a/test/cases/testdata/v1/containskeyword/test-contains-future-keyword.yaml b/test/cases/testdata/v1/containskeyword/test-contains-future-keyword.yaml new file mode 100644 index 0000000000..f990959d34 --- /dev/null +++ b/test/cases/testdata/v1/containskeyword/test-contains-future-keyword.yaml @@ -0,0 +1,63 @@ +--- +cases: + - note: containskeyword/base case + query: data.test.p = x + modules: + - | + package test + + p if { + contains("fireplace", "repl") + } + want_result: + - x: true + - note: containskeyword/with unused kw import + query: data.test.p = x + modules: + - | + package test + + p if { + contains("fireplace", "repl") + } + want_result: + - x: true + - note: containskeyword/with kw and builtin used + query: data.test.p = x + modules: + - | + package test + + p contains "x" if { + contains("fireplace", "repl") + } + want_result: + - x: + - x + - note: containskeyword/empty body + query: data.test.p = x + modules: + - | + package test + + p contains "x" + want_result: + - x: + - x + - note: containskeyword/ordinary deny rule + query: data.test.p = x + modules: + - | + package test + + p contains msg if { + msg := "nono" + } + + p contains msg if { + msg := "nonono" + } + want_result: + - x: + - nono + - nonono diff --git a/test/cases/testdata/v1/cryptohmacequal/test-cryptohmacequal.yaml b/test/cases/testdata/v1/cryptohmacequal/test-cryptohmacequal.yaml new file mode 100644 index 0000000000..cdc939de18 --- /dev/null +++ b/test/cases/testdata/v1/cryptohmacequal/test-cryptohmacequal.yaml @@ -0,0 +1,77 @@ +--- +cases: + - note: cryptohmacequal/crypto.hmac.equal_md5 + query: data.test.p = x + modules: + - | + package test + + p contains res if { + res := crypto.hmac.equal(input.mac1, input.mac2) + } + input: + mac1: 31b6db9e5eb4addb42f1a6ca07367adc + mac2: 31b6db9e5eb4addb42f1a6ca07367adc + want_result: + - x: + - true + - note: cryptohmacequal/crypto.hmac.equal_sha1 + query: data.test.p = x + modules: + - | + package test + + p contains res if { + res := crypto.hmac.equal(input.mac1, input.mac2) + } + input: + mac1: 85d155c55ed286a300bd1cf124de08d87e914f3a + mac2: 85d155c55ed286a300bd1cf124de08d87e914f3a + want_result: + - x: + - true + - note: cryptohmacequal/crypto.hmac.equal_sha256 + query: data.test.p = x + modules: + - | + package test + + p contains res if { + res := crypto.hmac.equal(input.mac1, input.mac2) + } + input: + mac1: 147933218aaabc0b8b10a2b3a5c34684c8d94341bcf10a4736dc7270f7741851 + mac2: 147933218aaabc0b8b10a2b3a5c34684c8d94341bcf10a4736dc7270f7741851 + want_result: + - x: + - true + - note: cryptohmacequal/crypto.hmac.equal_sha512 + query: data.test.p = x + modules: + - | + package test + + p contains res if { + res := crypto.hmac.equal(input.mac1, input.mac2) + } + input: + mac1: 24257d7210582a65c731ec55159c8184cc24c02489453e58587f71f44c23a2d61b4b72154a89d17b2d49448a8452ea066f4fc56a2bcead45c088572ffccdb3d8 + mac2: 24257d7210582a65c731ec55159c8184cc24c02489453e58587f71f44c23a2d61b4b72154a89d17b2d49448a8452ea066f4fc56a2bcead45c088572ffccdb3d8 + want_result: + - x: + - true + - note: cryptohmacequal/crypto.hmac.equal_false + query: data.test.p = x + modules: + - | + package test + + p contains res if { + res := crypto.hmac.equal(input.mac1, input.mac2) + } + input: + mac1: 31b6db9e5eb4addb42f1a6ca07367adc + mac2: 31b6db9e5eb4addb + want_result: + - x: + - false diff --git a/test/cases/testdata/v1/cryptohmacmd5/test-cryptohmacmd5.yaml b/test/cases/testdata/v1/cryptohmacmd5/test-cryptohmacmd5.yaml new file mode 100644 index 0000000000..d8bab904bc --- /dev/null +++ b/test/cases/testdata/v1/cryptohmacmd5/test-cryptohmacmd5.yaml @@ -0,0 +1,33 @@ +--- +cases: + - note: cryptohmacmd5/crypto.hmac.md5 + query: data.test.p = x + modules: + - | + package test + + p contains mac if { + mac := crypto.hmac.md5(input.message, input.key) + } + input: + key: bar + message: foo + want_result: + - x: + - 31b6db9e5eb4addb42f1a6ca07367adc + - note: cryptohmacmd5/crypto.hmac.md5_unicode + query: data.test.p = x + modules: + - | + package test + + p contains mac if { + mac := crypto.hmac.md5(input.message, input.key) + } + input: + key: 秘密の + message: "åäöçß\U0001F972♙Ω" + want_result: + - x: + - 20a8743c2157ac60b7e8b79c83651b8d + strict_error: true diff --git a/test/cases/testdata/v1/cryptohmacsha1/test-cryptohmacsha1.yaml b/test/cases/testdata/v1/cryptohmacsha1/test-cryptohmacsha1.yaml new file mode 100644 index 0000000000..173540e8af --- /dev/null +++ b/test/cases/testdata/v1/cryptohmacsha1/test-cryptohmacsha1.yaml @@ -0,0 +1,33 @@ +--- +cases: + - note: cryptohmacsha1/crypto.hmac.sha1 + query: data.test.p = x + modules: + - | + package test + + p contains mac if { + mac := crypto.hmac.sha1(input.message, input.key) + } + input: + key: bar + message: foo + want_result: + - x: + - 85d155c55ed286a300bd1cf124de08d87e914f3a + - note: cryptohmacsha1/crypto.hmac.sha1_unicode + query: data.test.p = x + modules: + - | + package test + + p contains mac if { + mac := crypto.hmac.sha1(input.message, input.key) + } + input: + key: 秘密の + message: "åäöçß\U0001F972♙Ω" + want_result: + - x: + - 81759c39013935fcf0de833d44c8018d7c1455dd + strict_error: true diff --git a/test/cases/testdata/v1/cryptohmacsha256/test-cryptohmacsha256.yaml b/test/cases/testdata/v1/cryptohmacsha256/test-cryptohmacsha256.yaml new file mode 100644 index 0000000000..790827498c --- /dev/null +++ b/test/cases/testdata/v1/cryptohmacsha256/test-cryptohmacsha256.yaml @@ -0,0 +1,33 @@ +--- +cases: + - note: cryptohmacsha256/crypto.hmac.sha256 + query: data.test.p = x + modules: + - | + package test + + p contains mac if { + mac := crypto.hmac.sha256(input.message, input.key) + } + input: + key: bar + message: foo + want_result: + - x: + - 147933218aaabc0b8b10a2b3a5c34684c8d94341bcf10a4736dc7270f7741851 + - note: cryptohmacsha256/crypto.hmac.sha256_unicode + query: data.test.p = x + modules: + - | + package test + + p contains mac if { + mac := crypto.hmac.sha256(input.message, input.key) + } + input: + key: 秘密の + message: "åäöçß\U0001F972♙Ω" + want_result: + - x: + - eb90daeb76d4b2571fbdaf94bbb240809faa8fed93ec0c260dd38c3fdf8d963a + strict_error: true diff --git a/test/cases/testdata/v1/cryptohmacsha512/test-cryptohmacsha512.yaml b/test/cases/testdata/v1/cryptohmacsha512/test-cryptohmacsha512.yaml new file mode 100644 index 0000000000..3968e68bc8 --- /dev/null +++ b/test/cases/testdata/v1/cryptohmacsha512/test-cryptohmacsha512.yaml @@ -0,0 +1,33 @@ +--- +cases: + - note: cryptohmacsha512/crypto.hmac.sha512 + query: data.test.p = x + modules: + - | + package test + + p contains mac if { + mac := crypto.hmac.sha512(input.message, input.key) + } + input: + key: bar + message: foo + want_result: + - x: + - 24257d7210582a65c731ec55159c8184cc24c02489453e58587f71f44c23a2d61b4b72154a89d17b2d49448a8452ea066f4fc56a2bcead45c088572ffccdb3d8 + - note: cryptohmacsha512/crypto.hmac.sha512_unicode + query: data.test.p = x + modules: + - | + package test + + p contains mac if { + mac := crypto.hmac.sha512(input.message, input.key) + } + input: + key: 秘密の + message: "åäöçß\U0001F972♙Ω" + want_result: + - x: + - 192f5afded233d6e21427aa26ed267ac118cfa2971013d91cbed530c0b208d78138b83dfe1d6cc3553d7bd518f22a481402c723028e1279d1ffbe8f11ea6b125 + strict_error: true diff --git a/test/cases/testdata/v1/cryptomd5/test-cryptomd5-0130.yaml b/test/cases/testdata/v1/cryptomd5/test-cryptomd5-0130.yaml new file mode 100644 index 0000000000..74ba18c468 --- /dev/null +++ b/test/cases/testdata/v1/cryptomd5/test-cryptomd5-0130.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: cryptomd5/crypto.md5 with string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + crypto.md5("lorem ipsum", __local1__) + __local0__ = __local1__ + } + want_result: + - x: + - 80a751fde577028640c419000e33eba6 + sort_bindings: true diff --git a/test/cases/testdata/v1/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml b/test/cases/testdata/v1/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml new file mode 100644 index 0000000000..9b3a036e10 --- /dev/null +++ b/test/cases/testdata/v1/cryptoparsersaprivatekeys/test-cryptoparsersaprivatekey-1.yaml @@ -0,0 +1,37 @@ +--- +cases: + - note: cryptoparseprivatekey/valid + query: data.testing.p = x + modules: + - | + package testing + + pem := "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEA9D/bK4171aiTNUkrUCHKGMLSQooV+o3wdz2889h9iv0HhhBJ\nCAGU54K3duB8ofHpmYL50QodcR4RLw1vSkaI+FPdPDMyKxKj/YcmofJjz4kW+Iqw\nFbBcbMnKnEVzye+CyW9YYOTu0xWtcgen80zGp2opG0GZX86hBjjXJnjOdrJTk6x2\nNAiJIbjsQevysmj+2MyqVm8widxw0x+rGhTaCD+ZXWitN0a0WO1aaA8c/7i99I9z\nhe2peKvXzEtMaqYO9ptHcYmq2z0QWvZuJVMv5Yn0mScLWyh91R099IOtn6sNaMMs\nOyTpi7E/2IlVgI2uKGPEopKkMFV8Fl2YaAbo7wIDAQABAoIBAAyMZ08ygqU0dvOq\n4a3JPp/NCo5el8h6mFsX8eg5PCHy4/sQRSBDLIpEXfaei+iqDA1V/E2wDlksaUeY\nkhony4uui1Q3cSFjYMd6tRJm6JfV/DcisO88U1NHfsBOlSdPxdFhhhHcUSTJHVMZ\nb5iBXkdlnd0HnsCcVguCyhLw6/KPFyiA+NYRz68flxze7admyVp5C6i/HbMPq8Pr\nMilBUvOFtxuaGeJBAiavuzUe9I70dRwpe424tMvisSA8h7Xbm8BeN/PJHDV/2JrI\nURgQ563yQ5So/Qg8AgxXRkpgWM9zAh7r31PBO86vq/B4ZbON/TtWdcZVsAcVB4Pk\ntqc8JNkCgYEA+g8V+y92SETdcwUkbd5O9Fg5CkfdsALsBXVH6FunrCUV5HS9l5o6\nMMBbJ/08odW/bP5BmOa4A/Hbk9uG/UfQn2KQ3HCgPlxUEwQO07R1/FcQOe4xmyG6\nJpDgQ30viE1RtlCkceQWUeitCIqZsYu0i8sLZLWJH+V/07OB4G17ELMCgYEA+g1v\nhrlAFNhZvrIX/zcP3xF2pZ+AqkFXdL/tWQZkWAVToONn/LlXTH71C/TO2x+OaQRm\nqX1bA9Zhyjf1gYQN9RenjUswvggk0aY2Tk28wUqowMGSsjQHmZ20EphHNMWNJpdS\nfKFfrQIFKCnLlpQVNz+j3bLWZUnq+jPaYnJP7NUCgYEA48qcVo7c7Ga3aNEVZ3St\nbg90HrZq760pvqshDz13V+0MrWnfUFxxh/mi0KHy+uYRlMNllFkQ5p8LTP0dUlt6\nY8dReU6r20MWX6BBtX9eP7o8ENm4nL4zqnAtq609gKgWuMNrmkiSQJl6Dx7bdY5z\nsSkNPvfUa5cQRBTxSjXRdtsCgYBHrzpdwRXh4/Q2ew/uFnbyWCtPZ96W8IyF58+/\nSdnSchR7dzYEeY3RXEQb3V6/6tgEu0JDLLC+9OKr+kbjjlwB+3oJQ5kBoYwMnj3L\nTPXj4+dk+xl3BPt4yoEpI4amVkwU2CTJnemzy3R3AyReUq2SXSg5El/sQbifaeYd\neu/20QKBgH/5IZHGBKiRAe1ww2FzOpDtL8VXXTe3EAXKutfajrHTqPz9+lXknX/D\nUMosh264nYXYS29WqxhJVutbE9u8e0VpuY1qIN9/3R0WKfTLTMUFlZtbqTepvsy1\nW2UbK732I4Nfp0/mtUvOSdMZO8dxbSdEeMnw/Ec8QgxK9a1rRu9+\n-----END RSA PRIVATE KEY-----" + + p if { + count(crypto.parse_private_keys(pem)) == 1 + } + want_result: + - x: true + - note: cryptoparseprivatekey/invalid + query: data.testing.p = x + modules: + - | + package testing + + pem := "nope" + + p := crypto.parse_private_keys(pem) + want_result: + - x: [] + - note: cryptoparseprivatekey/invalid + query: data.testing.p = x + modules: + - | + package testing + + pem := "" + + p := crypto.parse_private_keys(pem) + want_result: + - x: null diff --git a/test/cases/testdata/v1/cryptosha1/test-cryptosha1-0131.yaml b/test/cases/testdata/v1/cryptosha1/test-cryptosha1-0131.yaml new file mode 100644 index 0000000000..6ab451d7b3 --- /dev/null +++ b/test/cases/testdata/v1/cryptosha1/test-cryptosha1-0131.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: cryptosha1/crypto.sha1 with string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + crypto.sha1("lorem ipsum", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - bfb7759a67daeb65410490b4d98bb9da7d1ea2ce + sort_bindings: true diff --git a/test/cases/testdata/v1/cryptosha256/test-cryptosha256-0132.yaml b/test/cases/testdata/v1/cryptosha256/test-cryptosha256-0132.yaml new file mode 100644 index 0000000000..2971308879 --- /dev/null +++ b/test/cases/testdata/v1/cryptosha256/test-cryptosha256-0132.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: cryptosha256/crypto.sha256 with string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + crypto.sha256("lorem ipsum", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 5e2bf57d3f40c4b6df69daf1936cb766f832374b4fc0259a7cbff06e2f70f269 + sort_bindings: true diff --git a/test/cases/testdata/v1/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml b/test/cases/testdata/v1/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml new file mode 100644 index 0000000000..19d0378ddd --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parseandverifycertificates/test-cryptox509parseandverifycertificates.yaml @@ -0,0 +1,130 @@ +--- +cases: + - note: cryptox509parseandverifycertificates/base_case + query: data.test.result = x + modules: + - | + package test + + certs := `-----BEGIN CERTIFICATE----- + MIIBoDCCAUagAwIBAgIRAJXcMYZALXooNq/VV/grXhMwCgYIKoZIzj0EAwIwLjER + MA8GA1UEChMIT1BBIFRlc3QxGTAXBgNVBAMTEE9QQSBUZXN0IFJvb3QgQ0EwHhcN + MjEwNzAxMTc0MTUzWhcNMzEwNjI5MTc0MTUzWjAuMREwDwYDVQQKEwhPUEEgVGVz + dDEZMBcGA1UEAxMQT1BBIFRlc3QgUm9vdCBDQTBZMBMGByqGSM49AgEGCCqGSM49 + AwEHA0IABFqhdZA5LjsJgzsBvhgzfayZFOk+C7PmGCi7xz6zOC3xWORJZSNOyZeJ + YzSKFmoMZkcFMfslTW1jp9fwe1xl3HWjRTBDMA4GA1UdDwEB/wQEAwIBBjASBgNV + HRMBAf8ECDAGAQH/AgEBMB0GA1UdDgQWBBTch60qxQvLl+AfDfcaXmjvT8GvpzAK + BggqhkjOPQQDAgNIADBFAiBqraIP0l2U0oNuH0+rf36hDks94wSB5EGlGH3lYNMR + ugIhANkbukX5hOP8pJDRWP/pYuv6MBnRY4BS8gpp9Vu31qOb + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIByDCCAW6gAwIBAgIQC0k4DPGrh9me73EJX5zntTAKBggqhkjOPQQDAjAuMREw + DwYDVQQKEwhPUEEgVGVzdDEZMBcGA1UEAxMQT1BBIFRlc3QgUm9vdCBDQTAeFw0y + MTA3MDExNzQxNTNaFw0zMTA2MjkxNzQxNTNaMDYxETAPBgNVBAoTCE9QQSBUZXN0 + MSEwHwYDVQQDExhPUEEgVGVzdCBJbnRlcm1lZGlhdGUgQ0EwWTATBgcqhkjOPQIB + BggqhkjOPQMBBwNCAARvXQa7fy476gDI81nqLYb2SnD459WxBmU0hk2bA3ZuNtI+ + H20KXz6ISmxH3MZ2WBm6rOy7y4Gn+WMCJuxzcl5jo2YwZDAOBgNVHQ8BAf8EBAMC + AQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUuslZNjJl0V8I1Gj17IID + ALy/9WEwHwYDVR0jBBgwFoAU3IetKsULy5fgHw33Gl5o70/Br6cwCgYIKoZIzj0E + AwIDSAAwRQIgUwsYApW9Tsm6AstWswaKGie0srB4FUkUbfKwWmUI2JgCIQCBTySN + MF+EiQAMKyz/N9KUuXEckC356WvKcyJaYYcV0w== + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB8zCCAZqgAwIBAgIRAID4gPKg7DDiuOfzUYFSXLAwCgYIKoZIzj0EAwIwNjER + MA8GA1UEChMIT1BBIFRlc3QxITAfBgNVBAMTGE9QQSBUZXN0IEludGVybWVkaWF0 + ZSBDQTAeFw0yMTA3MDUxNzQ5NTBaFw0zNjA3MDExNzQ5NDdaMCUxIzAhBgNVBAMT + Gm5vdGFyZWFsc2l0ZS5vcGEubG9jYWxob3N0MFkwEwYHKoZIzj0CAQYIKoZIzj0D + AQcDQgAE1YSXZXeaGGL+XeYyoPi/QdA39Ds4fgxSHJTMh+js393kByPm2PNtFkem + tUii3KCRJw3SEh3z0JWr/9y4+ua2L6OBmTCBljAOBgNVHQ8BAf8EBAMCB4AwHQYD + VR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBRL0P0g17viZHo9 + CnXe3ZQJm48LXTAfBgNVHSMEGDAWgBS6yVk2MmXRXwjUaPXsggMAvL/1YTAlBgNV + HREEHjAcghpub3RhcmVhbHNpdGUub3BhLmxvY2FsaG9zdDAKBggqhkjOPQQDAgNH + ADBEAiAtmZewL94ijN0YwUGaJM9BXCaoTQPwkzugqjCj+K912QIgKKFvbPu4asrE + nwy7dzejHmQUcZ/aUNbc4VTbiv15ESk= + -----END CERTIFICATE----- + ` + + value := crypto.x509.parse_and_verify_certificates(certs) + + result := { + "valid": value[0], + "certs": [c | + some cert in value[1] + c := { + "CN": cert.Subject.CommonName, + "DNS": cert.DNSNames, + "URI": cert.URIStrings, + } + ], + } + want_result: + - x: + certs: + - CN: notarealsite.opa.localhost + DNS: + - notarealsite.opa.localhost + URI: null + - CN: OPA Test Intermediate CA + DNS: null + URI: null + - CN: OPA Test Root CA + DNS: null + URI: null + valid: true + - note: cryptox509parseandverifycertificates/uri_strings + query: data.test.result = x + modules: + - | + package test + + certs := `-----BEGIN CERTIFICATE----- + MIIB1TCCAXugAwIBAgIIKIoxsnMwJJ4wCgYIKoZIzj0EAwIwPTELMAkGA1UEBhMC + R0IxEDAOBgNVBAoTB0V4YW1wbGUxHDAaBgNVBAUTEzI5MjEyMDE5NTA4MDk2NjI2 + MjIwIBcNMjMxMTI5MTc1NTQ2WhgPMjEyMzExMDUxNzU1NDZaMD0xCzAJBgNVBAYT + AkdCMRAwDgYDVQQKEwdFeGFtcGxlMRwwGgYDVQQFExMyOTIxMjAxOTUwODA5NjYy + NjIyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkvI9ddM0SuP9LvBWS1y64fuK + ELCjVF5W3FSKm3azKEkDi8Eq1I1UM80MgCjC5ChNNyM4+cmVUDrCkTl3SqRxa6Nj + MGEwDgYDVR0PAQH/BAQDAgIEMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFF7H + A8n3mXXnwUP0ypMJ9JwY5wasMB8GA1UdEQQYMBaGFHNwaWZmZTovL2V4YW1wbGUu + Y29tMAoGCCqGSM49BAMCA0gAMEUCIByB2l5RIWmaU8qcRv13qigbB9BV/F2raEk+ + pRQnsUcgAiEA9OvBpPKC/FBkI5vVvR7WgK5sGPna4+a0RkXxRQgN2jM= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB1jCCAXygAwIBAgIIV9914tIKKkMwCgYIKoZIzj0EAwIwPTELMAkGA1UEBhMC + R0IxEDAOBgNVBAoTB0V4YW1wbGUxHDAaBgNVBAUTEzI5MjEyMDE5NTA4MDk2NjI2 + MjIwIBcNMjMxMTI5MTc1NTQ2WhgPMjEyMjExMDUxNzU1NDZaMD0xCzAJBgNVBAYT + AkdCMRAwDgYDVQQKEwdFeGFtcGxlMRwwGgYDVQQFExM2MzMxOTA5MjE4MTUzMTQ2 + OTQ3MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEMoy2UqvC8zL3sPfLNvG1nX5p + 6hhEyDjFtokORB4VkKiPXFryIFn8XHG0ipz6aKSwVMoDT2T/YXP/wWpVwPJCi6Nk + MGIwDgYDVR0PAQH/BAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcD + ATAMBgNVHRMBAf8EAjAAMCMGA1UdEQQcMBqGGHNwaWZmZTovL2V4YW1wbGUuY29t + L29wYTAKBggqhkjOPQQDAgNIADBFAiBEmdSKGj2+9J5SQPIAmwdxpVTOxqmVQv2x + Vvita/AmowIhAOyX/alNJxL4iCfKUNwlC2lYxGhuWopWgB1Q32bQhTEh + -----END CERTIFICATE----- + ` + + value := crypto.x509.parse_and_verify_certificates(certs) + + result := { + "valid": value[0], + "certs": [c | + some cert in value[1] + c := { + "CN": cert.Subject.CommonName, + "DNS": cert.DNSNames, + "URI": cert.URIStrings, + } + ], + } + want_result: + - x: + certs: + - CN: "" + DNS: null + URI: + - spiffe://example.com/opa + - CN: "" + DNS: null + URI: + - spiffe://example.com + valid: true diff --git a/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml b/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml new file mode 100644 index 0000000000..922b866ad8 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0125.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: cryptox509parsecertificaterequest/PEM, b64 + query: data.generated.p = x + modules: + - | + package generated + + csr := "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ21EQ0NBWUFDQVFBd1V6RUxNQWtHQTFVRUJoTUNWVk14RkRBU0JnTlZCQU1NQzJWNFlXMXdiR1V1WTI5dApNUW93Q0FZRFZRUUhEQUVnTVFvd0NBWURWUVFLREFFZ01Rb3dDQVlEVlFRSURBRWdNUW93Q0FZRFZRUUxEQUVnCk1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBMlpkaG1zaERBVTBYYnhnTk1GQWsKeEdWQnNjaHdWb2s5dXBBU2ZVWDA4VFlqMFZrV0VxNitmemdOdmRQSnd6Nm1lUDlnL01hRmhPYW91Nmh1UEhmbwpTVTlKN1FiTW56Uktsc0VJTzNodEM1QUt3OXYyZldVZGpCQS92Q1dZdXU1aUc1ZTdtUHNXWjd1cGxuVGZSekM4ClJLK0srWXJtNEQ4NHE1bHR5NEMzS2tRc0FjU0xQZk9MMXMvYjJyV21KR0FoV3NSa2doTVk2V3dza3VYWXRINTkKRzl5VURHUUhoalprcHFlZFY0OUM4c0NwMU8vWVpvU0hncDdHK0JiaFRta05CRzY3OFZHREplTnB3SG96dnRjVQpyQVNGRFJ4WnhPdTFHRzE3L1FiVW9SNVVkOTNwaUtaU0U2UHVDU2VCcy9UQmFJc3ZwUGtudVhkOXI4WGovbVd5CmtRSURBUUFCb0FBd0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFBeDJkaCtkMU1CaEwwaDJYZklxaDVEYy9lYWoKU0xadGFNTWlJY1h1cC96UTl2eENXSkZlSGYzczBJdXliMEhkMlZNZ1BSYU8ydWRkY2JZdFFlKzJnWUtrTzFMWApCdHdQcXcwWHAweUF2dDUxRzJvZmVCbCtFa0ptNjk3RlNtemg4eDJJZFFBSkMzWi9ROFdMVmh3NFg2WlVicnhqCjJnTjJmaVhjS0RKbGVkcUgxY2V4WVVvbnlLSDZubG4wbzQzUUtEOFlSZG9hNVFqb3Ixb0JkY3dSTTA0VDM4ak0KV1B3d2JZTjNrVE9Ea0tiaVFVVWxVeFZuNnFnZTlNTWt0c0lOWkc0eDY1QmIwaWxTdHExRWQwN2Y5NmVnbHNKaApZVE9VRnZpZDZVSkVEcEJzcjhyZFROSW1JQkhCdkkra1BHS2FqcW83Z0VNc3hFYkNkemFHUTNZZnNYWT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUgUkVRVUVTVC0tLS0t" + + p := __local1__ if { + __local3__ = data.generated.csr + crypto.x509.parse_certificate_request(__local3__, __local2__) + __local0__ = __local2__ + __local1__ = __local0__.Subject.CommonName + } + data: {} + want_result: + - x: example.com diff --git a/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml b/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml new file mode 100644 index 0000000000..b71eeabb71 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0126.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: cryptox509parsecertificaterequest/PEM, string + query: data.generated.p = x + modules: + - | + package generated + + csr := "-----BEGIN CERTIFICATE REQUEST-----\nMIICmDCCAYACAQAwUzELMAkGA1UEBhMCVVMxFDASBgNVBAMMC2V4YW1wbGUuY29t\nMQowCAYDVQQHDAEgMQowCAYDVQQKDAEgMQowCAYDVQQIDAEgMQowCAYDVQQLDAEg\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2ZdhmshDAU0XbxgNMFAk\nxGVBschwVok9upASfUX08TYj0VkWEq6+fzgNvdPJwz6meP9g/MaFhOaou6huPHfo\nSU9J7QbMnzRKlsEIO3htC5AKw9v2fWUdjBA/vCWYuu5iG5e7mPsWZ7uplnTfRzC8\nRK+K+Yrm4D84q5lty4C3KkQsAcSLPfOL1s/b2rWmJGAhWsRkghMY6WwskuXYtH59\nG9yUDGQHhjZkpqedV49C8sCp1O/YZoSHgp7G+BbhTmkNBG678VGDJeNpwHozvtcU\nrASFDRxZxOu1GG17/QbUoR5Ud93piKZSE6PuCSeBs/TBaIsvpPknuXd9r8Xj/mWy\nkQIDAQABoAAwDQYJKoZIhvcNAQELBQADggEBAAx2dh+d1MBhL0h2XfIqh5Dc/eaj\nSLZtaMMiIcXup/zQ9vxCWJFeHf3s0Iuyb0Hd2VMgPRaO2uddcbYtQe+2gYKkO1LX\nBtwPqw0Xp0yAvt51G2ofeBl+EkJm697FSmzh8x2IdQAJC3Z/Q8WLVhw4X6ZUbrxj\n2gN2fiXcKDJledqH1cexYUonyKH6nln0o43QKD8YRdoa5Qjor1oBdcwRM04T38jM\nWPwwbYN3kTODkKbiQUUlUxVn6qge9MMktsINZG4x65Bb0ilStq1Ed07f96eglsJh\nYTOUFvid6UJEDpBsr8rdTNImIBHBvI+kPGKajqo7gEMsxEbCdzaGQ3YfsXY=\n-----END CERTIFICATE REQUEST-----" + + p := __local1__ if { + __local3__ = data.generated.csr + crypto.x509.parse_certificate_request(__local3__, __local2__) + __local0__ = __local2__ + __local1__ = __local0__.Subject.CommonName + } + data: {} + want_result: + - x: example.com diff --git a/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml b/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml new file mode 100644 index 0000000000..1aaa0ba5e8 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0127.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: cryptox509parsecertificaterequest/DER, b64 + query: data.generated.p = x + modules: + - | + package generated + + csr := "MIICmDCCAYACAQAwUzELMAkGA1UEBhMCVVMxFDASBgNVBAMMC2V4YW1wbGUuY29tMQowCAYDVQQHDAEgMQowCAYDVQQKDAEgMQowCAYDVQQIDAEgMQowCAYDVQQLDAEgMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2ZdhmshDAU0XbxgNMFAkxGVBschwVok9upASfUX08TYj0VkWEq6+fzgNvdPJwz6meP9g/MaFhOaou6huPHfoSU9J7QbMnzRKlsEIO3htC5AKw9v2fWUdjBA/vCWYuu5iG5e7mPsWZ7uplnTfRzC8RK+K+Yrm4D84q5lty4C3KkQsAcSLPfOL1s/b2rWmJGAhWsRkghMY6WwskuXYtH59G9yUDGQHhjZkpqedV49C8sCp1O/YZoSHgp7G+BbhTmkNBG678VGDJeNpwHozvtcUrASFDRxZxOu1GG17/QbUoR5Ud93piKZSE6PuCSeBs/TBaIsvpPknuXd9r8Xj/mWykQIDAQABoAAwDQYJKoZIhvcNAQELBQADggEBAAx2dh+d1MBhL0h2XfIqh5Dc/eajSLZtaMMiIcXup/zQ9vxCWJFeHf3s0Iuyb0Hd2VMgPRaO2uddcbYtQe+2gYKkO1LXBtwPqw0Xp0yAvt51G2ofeBl+EkJm697FSmzh8x2IdQAJC3Z/Q8WLVhw4X6ZUbrxj2gN2fiXcKDJledqH1cexYUonyKH6nln0o43QKD8YRdoa5Qjor1oBdcwRM04T38jMWPwwbYN3kTODkKbiQUUlUxVn6qge9MMktsINZG4x65Bb0ilStq1Ed07f96eglsJhYTOUFvid6UJEDpBsr8rdTNImIBHBvI+kPGKajqo7gEMsxEbCdzaGQ3YfsXY=" + + p := __local1__ if { + __local3__ = data.generated.csr + crypto.x509.parse_certificate_request(__local3__, __local2__) + __local0__ = __local2__ + __local1__ = __local0__.Subject.CommonName + } + data: {} + want_result: + - x: example.com diff --git a/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml b/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml new file mode 100644 index 0000000000..e1c203e9aa --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0128.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: cryptox509parsecertificaterequest/invalid DER or PEM data, b64 + query: data.generated.p = x + modules: + - | + package generated + + csr := "YmFkc3RyaW5n" + + p := __local1__ if { + __local3__ = data.generated.csr + crypto.x509.parse_certificate_request(__local3__, __local2__) + __local0__ = __local2__ + __local1__ = __local0__.Subject.CommonName + } + want_error_code: eval_builtin_error + want_error: "asn1: structure error" + strict_error: true diff --git a/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml b/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml new file mode 100644 index 0000000000..3515b00efc --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificaterequest/test-cryptox509parsecertificaterequest-0129.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: cryptox509parsecertificaterequest/invalid DER or PEM data, string + query: data.generated.p = x + modules: + - | + package generated + + csr := "foobar" + + p := __local1__ if { + __local3__ = data.generated.csr + crypto.x509.parse_certificate_request(__local3__, __local2__) + __local0__ = __local2__ + __local1__ = __local0__.Subject.CommonName + } + want_error_code: eval_builtin_error + want_error: illegal base64 + strict_error: true diff --git a/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml new file mode 100644 index 0000000000..bda5bf897a --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0117.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: cryptox509parsecertificates/DER, single cert, b64 + query: data.generated.p = x + modules: + - | + package generated + + certs := "MIIDujCCAqKgAwIBAgIIE31FZVaPXTUwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UEBhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRlcm5ldCBBdXRob3JpdHkgRzIwHhcNMTQwMTI5MTMyNzQzWhcNMTQwNTI5MDAwMDAwWjBpMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzETMBEGA1UECgwKR29vZ2xlIEluYzEYMBYGA1UEAwwPbWFpbC5nb29nbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEfRrObuSW5T7q5CnSEqefEmtH4CCv6+5EckuriNr1CjfVvqzwfAhopXkLrq45EQm8vkmf7W96XJhC7ZM0dYi1/qOCAU8wggFLMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAaBgNVHREEEzARgg9tYWlsLmdvb2dsZS5jb20wCwYDVR0PBAQDAgeAMGgGCCsGAQUFBwEBBFwwWjArBggrBgEFBQcwAoYfaHR0cDovL3BraS5nb29nbGUuY29tL0dJQUcyLmNydDArBggrBgEFBQcwAYYfaHR0cDovL2NsaWVudHMxLmdvb2dsZS5jb20vb2NzcDAdBgNVHQ4EFgQUiJxtimAuTfwb+aUtBn5UYKreKvMwDAYDVR0TAQH/BAIwADAfBgNVHSMEGDAWgBRK3QYWG7z2aLV29YG2u2IaulqBLzAXBgNVHSAEEDAOMAwGCisGAQQB1nkCBQEwMAYDVR0fBCkwJzAloCOgIYYfaHR0cDovL3BraS5nb29nbGUuY29tL0dJQUcyLmNybDANBgkqhkiG9w0BAQUFAAOCAQEAH6RYHxHdcGpMpFE3oxDoFnP+gtuBCHan2yE2GRbJ2Cw8Lw0MmuKqHlf9RSeYfd3BXeKkj1qO6TVKwCh+0HdZk283TZZyzmEOyclm3UGFYe82P/iDFt+CeQ3NpmBg+GoaVCuWAARJN/KfglbLyyYygcQq0SgeDh8dRKUiaW3HQSoYvTvdTuqzwK4CXsr3b5/dAOY8uMuG/IAR3FgwTbZ1dtoWRvOTa8hYiU6A475WuZKyEHcwnGYe57u2I2KbMgcKjPniocj4QzgYsVAVKW3IwaOhyE+vPxsiUkvQHdO2fojCkY8jg70jxM+gu59tPDNbw3Uh/2Ij310FgTHsnGQMyA==" + + p := __local2__ if { + __local4__ = data.generated.certs + crypto.x509.parse_certificates(__local4__, __local3__) + __local0__ = __local3__ + __local2__ = [__local1__ | __local1__ = __local0__[_].Subject.CommonName] + } + data: {} + want_result: + - x: + - mail.google.com diff --git a/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml new file mode 100644 index 0000000000..069d7db176 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0118.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: cryptox509parsecertificates/DER, chain, b64 + query: data.generated.p = x + modules: + - | + package generated + + certs := "MIIDIjCCAougAwIBAgIQbt8NlJn9RTPdEpf8Qqk74TANBgkqhkiG9w0BAQUFADBMMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEWMBQGA1UEAxMNVGhhd3RlIFNHQyBDQTAeFw0wOTAzMjUxNjQ5MjlaFw0xMDAzMjUxNjQ5MjlaMGkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMXW+JL8yvVhSwZBSegKLJWBohjvQew1vXpYElrnb56lTdyJOrvrAp9rc2Fr8P/YaHkfunr5xK6/Nwa6Puru0nQ1tN3PsVfAXzUdZqqH/uDeBy1m13Ov+9Nqt4vvCQ4MyGGpA6yQ3Zi1HJxBVmwBfwvuw7/zkQUf+6D1zGhQrSpZAgMBAAGjgecwgeQwKAYDVR0lBCEwHwYIKwYBBQUHAwEGCCsGAQUFBwMCBglghkgBhvhCBAEwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC50aGF3dGUuY29tL1RoYXd0ZVNHQ0NBLmNybDByBggrBgEFBQcBAQRmMGQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnRoYXd0ZS5jb20wPgYIKwYBBQUHMAKGMmh0dHA6Ly93d3cudGhhd3RlLmNvbS9yZXBvc2l0b3J5L1RoYXd0ZV9TR0NfQ0EuY3J0MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEFBQADgYEAYvHzBQ68EF5JfHrt+H4k0vSphrs7g3vRm5HrytmLBlmS9r0rSbfW08suQnqZ1gbHsdRjUlJ/rDnmqLZybeW/cCEqUsugdjSl4zIBG9GGjnjrXjyTzwMHInZ4byB0lP6qDtnVOyEQp2Vx+QIJza6IQ4XIglhwMO4V8z12Hi5FprwwggMjMIICjKADAgECAgQwAAACMA0GCSqGSIb3DQEBBQUAMF8xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDA1MTMwMDAwMDBaFw0xNDA1MTIyMzU5NTlaMEwxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMRYwFAYDVQQDEw1UaGF3dGUgU0dDIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDU02fQjRV/rs0x/n0dkaE/C3E8rMzIZPtj/DJLB5S9b4C6L+EEk8Az/AkzI+kLdCtxxAPG0s3iL/UJY83/SKUAv+Dn84i3LTLemDbmCq0Ae8RkSjuEdQPycJJ9DmL1IatpNoQxdZD4v8dsiBsGlXzJ5ajedaEsemjf1coch1hgGQIDAQABo4H+MIH7MBIGA1UdEwEB/wQIMAYBAf8CAQAwCwYDVR0PBAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIBBjAoBgNVHREEITAfpB0wGzEZMBcGA1UEAxMQUHJpdmF0ZUxhYmVsMy0xNTAxBgNVHR8EKjAoMCagJKAihiBodHRwOi8vY3JsLnZlcmlzaWduLmNvbS9wY2EzLmNybDAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnRoYXd0ZS5jb20wNAYDVR0lBC0wKwYIKwYBBQUHAwEGCCsGAQUFBwMCBglghkgBhvhCBAEGCmCGSAGG+EUBCAEwDQYJKoZIhvcNAQEFBQADgYEAVaxj6t6h3dKQX58Lzna+E1GPk9kFK8gbd0utaVCh7t7c/dsH6eg5lNyrcnkvBr+rgXDEqO3qUzTt7x5T2QbHVivRXPTRio60K7E3kEgIQiXFPorLf+tvBNFtxXSi96J8e2A8d80OzkgCfwEvtps34CoqNtzVhdas5T9Ub5YeBa8=" + + p := __local2__ if { + __local4__ = data.generated.certs + crypto.x509.parse_certificates(__local4__, __local3__) + __local0__ = __local3__ + __local2__ = [__local1__ | __local1__ = __local0__[_].Subject.CommonName] + } + data: {} + want_result: + - x: + - mail.google.com + - Thawte SGC CA diff --git a/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml new file mode 100644 index 0000000000..8d37932f11 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0119.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: cryptox509parsecertificates/PEM, single cert, b64 + query: data.generated.p = x + modules: + - | + package generated + + certs := "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpNSUlGZHpDQ0JGK2dBd0lCQWdJU0EzTnJpQUV1cy8rY3ZmbHZoVlFPVzV6VE1BMEdDU3FHU0liM0RRRUJDd1VBDQpNRW94Q3pBSkJnTlZCQVlUQWxWVE1SWXdGQVlEVlFRS0V3MU1aWFFuY3lCRmJtTnllWEIwTVNNd0lRWURWUVFEDQpFeHBNWlhRbmN5QkZibU55ZVhCMElFRjFkR2h2Y21sMGVTQllNekFlRncweU1EQTNNVEF4TmpBd016QmFGdzB5DQpNREV3TURneE5qQXdNekJhTUI0eEhEQWFCZ05WQkFNVEUyOXdaVzV3YjJ4cFkzbGhaMlZ1ZEM1dmNtY3dnZ0VpDQpNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUUN5eThIWlhWVEoyVFNIWFlub0wrQ0tZcG80DQp3ejF3b3dVY2R0L1hCZ04wOGYzN054YU5rK1ZBajhHRDJzNnpob0hMU2h5WVMyUFZvc2Y3eHVtdnlHOTE0UExwDQpJSE85V21DYVpNcXdFeXZNTS9WRTlkQmtLZmFUbzc4QlQ2YVh5Sm1ua2pwZUZtQk9HczN1UDViVUFSajNPbm5yDQo3QW9zOWo0NXJncnl0cGVsWVRNbExpNmpWdEJ2NVJJWnVNb0oxNVcyNTJ0OGVJZ3NPcTU3YWQwQm9iZXl5NFR1DQpHaHZlUDBWM3ZVSnZJM2licUg1RTljV3pJMmY4VXRvaXJVTmYwSjN0Y25nOEpxU091dXpXRFlXclJEQXpRYkpZDQpxS3p2VkRjTitwdHFWN0daNkp1cUhoZHdnRGVxQk9zdmVEYnpBQXlZU1ZQSmpSV1llYThNeGxNN09YYnRBZ01CDQpBQUdqZ2dLQk1JSUNmVEFPQmdOVkhROEJBZjhFQkFNQ0JhQXdIUVlEVlIwbEJCWXdGQVlJS3dZQkJRVUhBd0VHDQpDQ3NHQVFVRkJ3TUNNQXdHQTFVZEV3RUIvd1FDTUFBd0hRWURWUjBPQkJZRUZIRHdlYjZLcHJTdldydy92UjZrDQp3VFZwdWRQdE1COEdBMVVkSXdRWU1CYUFGS2hLYW1NRWZkMjY1dEU1dDZaRlplL3pxT3loTUc4R0NDc0dBUVVGDQpCd0VCQkdNd1lUQXVCZ2dyQmdFRkJRY3dBWVlpYUhSMGNEb3ZMMjlqYzNBdWFXNTBMWGd6TG14bGRITmxibU55DQplWEIwTG05eVp6QXZCZ2dyQmdFRkJRY3dBb1lqYUhSMGNEb3ZMMk5sY25RdWFXNTBMWGd6TG14bGRITmxibU55DQplWEIwTG05eVp5OHdOd1lEVlIwUkJEQXdMb0lUYjNCbGJuQnZiR2xqZVdGblpXNTBMbTl5WjRJWGQzZDNMbTl3DQpaVzV3YjJ4cFkzbGhaMlZ1ZEM1dmNtY3dUQVlEVlIwZ0JFVXdRekFJQmdabmdRd0JBZ0V3TndZTEt3WUJCQUdDDQozeE1CQVFFd0tEQW1CZ2dyQmdFRkJRY0NBUllhYUhSMGNEb3ZMMk53Y3k1c1pYUnpaVzVqY25sd2RDNXZjbWN3DQpnZ0VFQmdvckJnRUVBZFo1QWdRQ0JJSDFCSUh5QVBBQWRnQmVwM1A1MzFiQTU3VTJTSDNRU2VBeWVwR2FESVNoDQpFaEtFR0hXV2dYRkZXQUFBQVhNNXE5dkRBQUFFQXdCSE1FVUNJUUNSSHFncnRsMDdZNlRyeWZNbVFONlROS1JWDQptMUxUeTl2STNNaC9rcmJTUVFJZ1lnVkFLd1hSb1BSK0JOMXBjSmJKdjNBaXZiaDZFN0w5ODdyTVNFUWs1Vm9BDQpkZ0N5SGdYTWk2TE5paUJPaDJiNUs3bUtKU0JuYTlyNmNPZXlTVk10NzR1UVhnQUFBWE01cTl1dUFBQUVBd0JIDQpNRVVDSVFEZHJ1VHV0US9VY2hja3FZUSsycDltdXRuclNublFYYTh4TEE0MVlHelpIZ0lnWFhFVEZiR2ZuczJDDQo3WUo4Y0RvWVlBam1kek1nOGs3aEtYUUd1L0tzQWI0d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFHazlwNXl0DQpPYURJUFJQazVJbXBIMWY2ZjAxMG1VTFdQVjVQam42a3pNSFA5ejVuZE16KysxTk92SFY0R1ZCQ29ldUtxMWJwDQpGQ0QrSWdBOXBjSkFFWFEvdTRHcG1iQUtVWnptZk1JYjg5YVJnbkpwMG14OVk0QkJkNDVFeFVXczh3NGNmZ0ZaDQp5WlVlSHZXczFhbnBBY1IyRklacEFWTVFDYUlnak90MmRkUjF4djRhY0N3K21EL0I5b0tmR1pFVWd5SUFOdnBCDQpJRGFiZ2dMU3dGYTlPS0tYUkJWUkFhZm83T2FjMjFIUVU3RTNzWHBoYUhaR2ZuMkYyN2REL3FvcVVjTHFyNGxDDQpjN2xORTBZR3A2cithUG85VkxjSDJWMGxONHQrMVZiVkFyd0t6bnNOZGNRbndLQmV0Z3F2WnJnTGc0K3FqbzR5DQp1aXhKWTM4WFUvYjdiYVU9DQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tDQo=" + + p := __local2__ if { + __local4__ = data.generated.certs + crypto.x509.parse_certificates(__local4__, __local3__) + __local0__ = __local3__ + __local2__ = [__local1__ | __local1__ = __local0__[_].Subject.CommonName] + } + data: {} + want_result: + - x: + - openpolicyagent.org diff --git a/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml new file mode 100644 index 0000000000..7b6a8d2086 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0120.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: cryptox509parsecertificates/PEM, single cert, string + query: data.generated.p = x + modules: + - | + package generated + + certs := "-----BEGIN CERTIFICATE-----\nMIIFdzCCBF+gAwIBAgISA3NriAEus/+cvflvhVQOW5zTMA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0yMDA3MTAxNjAwMzBaFw0y\nMDEwMDgxNjAwMzBaMB4xHDAaBgNVBAMTE29wZW5wb2xpY3lhZ2VudC5vcmcwggEi\nMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCyy8HZXVTJ2TSHXYnoL+CKYpo4\nwz1wowUcdt/XBgN08f37NxaNk+VAj8GD2s6zhoHLShyYS2PVosf7xumvyG914PLp\nIHO9WmCaZMqwEyvMM/VE9dBkKfaTo78BT6aXyJmnkjpeFmBOGs3uP5bUARj3Onnr\n7Aos9j45rgrytpelYTMlLi6jVtBv5RIZuMoJ15W252t8eIgsOq57ad0Bobeyy4Tu\nGhveP0V3vUJvI3ibqH5E9cWzI2f8UtoirUNf0J3tcng8JqSOuuzWDYWrRDAzQbJY\nqKzvVDcN+ptqV7GZ6JuqHhdwgDeqBOsveDbzAAyYSVPJjRWYea8MxlM7OXbtAgMB\nAAGjggKBMIICfTAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEG\nCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFHDweb6KprSvWrw/vR6k\nwTVpudPtMB8GA1UdIwQYMBaAFKhKamMEfd265tE5t6ZFZe/zqOyhMG8GCCsGAQUF\nBwEBBGMwYTAuBggrBgEFBQcwAYYiaHR0cDovL29jc3AuaW50LXgzLmxldHNlbmNy\neXB0Lm9yZzAvBggrBgEFBQcwAoYjaHR0cDovL2NlcnQuaW50LXgzLmxldHNlbmNy\neXB0Lm9yZy8wNwYDVR0RBDAwLoITb3BlbnBvbGljeWFnZW50Lm9yZ4IXd3d3Lm9w\nZW5wb2xpY3lhZ2VudC5vcmcwTAYDVR0gBEUwQzAIBgZngQwBAgEwNwYLKwYBBAGC\n3xMBAQEwKDAmBggrBgEFBQcCARYaaHR0cDovL2Nwcy5sZXRzZW5jcnlwdC5vcmcw\nggEEBgorBgEEAdZ5AgQCBIH1BIHyAPAAdgBep3P531bA57U2SH3QSeAyepGaDISh\nEhKEGHWWgXFFWAAAAXM5q9vDAAAEAwBHMEUCIQCRHqgrtl07Y6TryfMmQN6TNKRV\nm1LTy9vI3Mh/krbSQQIgYgVAKwXRoPR+BN1pcJbJv3Aivbh6E7L987rMSEQk5VoA\ndgCyHgXMi6LNiiBOh2b5K7mKJSBna9r6cOeySVMt74uQXgAAAXM5q9uuAAAEAwBH\nMEUCIQDdruTutQ/UchckqYQ+2p9mutnrSnnQXa8xLA41YGzZHgIgXXETFbGfns2C\n7YJ8cDoYYAjmdzMg8k7hKXQGu/KsAb4wDQYJKoZIhvcNAQELBQADggEBAGk9p5yt\nOaDIPRPk5ImpH1f6f010mULWPV5Pjn6kzMHP9z5ndMz++1NOvHV4GVBCoeuKq1bp\nFCD+IgA9pcJAEXQ/u4GpmbAKUZzmfMIb89aRgnJp0mx9Y4BBd45ExUWs8w4cfgFZ\nyZUeHvWs1anpAcR2FIZpAVMQCaIgjOt2ddR1xv4acCw+mD/B9oKfGZEUgyIANvpB\nIDabggLSwFa9OKKXRBVRAafo7Oac21HQU7E3sXphaHZGfn2F27dD/qoqUcLqr4lC\nc7lNE0YGp6r+aPo9VLcH2V0lN4t+1VbVArwKznsNdcQnwKBetgqvZrgLg4+qjo4y\nuixJY38XU/b7baU=\n-----END CERTIFICATE-----" + + p := __local2__ if { + __local4__ = data.generated.certs + crypto.x509.parse_certificates(__local4__, __local3__) + __local0__ = __local3__ + __local2__ = [__local1__ | __local1__ = __local0__[_].Subject.CommonName] + } + data: {} + want_result: + - x: + - openpolicyagent.org diff --git a/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml new file mode 100644 index 0000000000..86feb423fd --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0121.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: cryptox509parsecertificates/PEM, chain, b64 + query: data.generated.p = x + modules: + - | + package generated + + certs := "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tDQpNSUlGZHpDQ0JGK2dBd0lCQWdJU0EzTnJpQUV1cy8rY3ZmbHZoVlFPVzV6VE1BMEdDU3FHU0liM0RRRUJDd1VBTUVveEN6QUpCZ05WQkFZVEFsVlRNUll3RkFZRFZRUUtFdzFNWlhRbmN5QkZibU55ZVhCME1TTXdJUVlEVlFRREV4cE1aWFFuY3lCRmJtTnllWEIwSUVGMWRHaHZjbWwwZVNCWU16QWVGdzB5TURBM01UQXhOakF3TXpCYUZ3MHlNREV3TURneE5qQXdNekJhTUI0eEhEQWFCZ05WQkFNVEUyOXdaVzV3YjJ4cFkzbGhaMlZ1ZEM1dmNtY3dnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBd2dnRUtBb0lCQVFDeXk4SFpYVlRKMlRTSFhZbm9MK0NLWXBvNHd6MXdvd1VjZHQvWEJnTjA4ZjM3TnhhTmsrVkFqOEdEMnM2emhvSExTaHlZUzJQVm9zZjd4dW12eUc5MTRQTHBJSE85V21DYVpNcXdFeXZNTS9WRTlkQmtLZmFUbzc4QlQ2YVh5Sm1ua2pwZUZtQk9HczN1UDViVUFSajNPbm5yN0FvczlqNDVyZ3J5dHBlbFlUTWxMaTZqVnRCdjVSSVp1TW9KMTVXMjUydDhlSWdzT3E1N2FkMEJvYmV5eTRUdUdodmVQMFYzdlVKdkkzaWJxSDVFOWNXekkyZjhVdG9pclVOZjBKM3Rjbmc4SnFTT3V1eldEWVdyUkRBelFiSllxS3p2VkRjTitwdHFWN0daNkp1cUhoZHdnRGVxQk9zdmVEYnpBQXlZU1ZQSmpSV1llYThNeGxNN09YYnRBZ01CQUFHamdnS0JNSUlDZlRBT0JnTlZIUThCQWY4RUJBTUNCYUF3SFFZRFZSMGxCQll3RkFZSUt3WUJCUVVIQXdFR0NDc0dBUVVGQndNQ01Bd0dBMVVkRXdFQi93UUNNQUF3SFFZRFZSME9CQllFRkhEd2ViNktwclN2V3J3L3ZSNmt3VFZwdWRQdE1COEdBMVVkSXdRWU1CYUFGS2hLYW1NRWZkMjY1dEU1dDZaRlplL3pxT3loTUc4R0NDc0dBUVVGQndFQkJHTXdZVEF1QmdnckJnRUZCUWN3QVlZaWFIUjBjRG92TDI5amMzQXVhVzUwTFhnekxteGxkSE5sYm1OeWVYQjBMbTl5WnpBdkJnZ3JCZ0VGQlFjd0FvWWphSFIwY0RvdkwyTmxjblF1YVc1MExYZ3pMbXhsZEhObGJtTnllWEIwTG05eVp5OHdOd1lEVlIwUkJEQXdMb0lUYjNCbGJuQnZiR2xqZVdGblpXNTBMbTl5WjRJWGQzZDNMbTl3Wlc1d2IyeHBZM2xoWjJWdWRDNXZjbWN3VEFZRFZSMGdCRVV3UXpBSUJnWm5nUXdCQWdFd053WUxLd1lCQkFHQzN4TUJBUUV3S0RBbUJnZ3JCZ0VGQlFjQ0FSWWFhSFIwY0RvdkwyTndjeTVzWlhSelpXNWpjbmx3ZEM1dmNtY3dnZ0VFQmdvckJnRUVBZFo1QWdRQ0JJSDFCSUh5QVBBQWRnQmVwM1A1MzFiQTU3VTJTSDNRU2VBeWVwR2FESVNoRWhLRUdIV1dnWEZGV0FBQUFYTTVxOXZEQUFBRUF3QkhNRVVDSVFDUkhxZ3J0bDA3WTZUcnlmTW1RTjZUTktSVm0xTFR5OXZJM01oL2tyYlNRUUlnWWdWQUt3WFJvUFIrQk4xcGNKYkp2M0FpdmJoNkU3TDk4N3JNU0VRazVWb0FkZ0N5SGdYTWk2TE5paUJPaDJiNUs3bUtKU0JuYTlyNmNPZXlTVk10NzR1UVhnQUFBWE01cTl1dUFBQUVBd0JITUVVQ0lRRGRydVR1dFEvVWNoY2txWVErMnA5bXV0bnJTbm5RWGE4eExBNDFZR3paSGdJZ1hYRVRGYkdmbnMyQzdZSjhjRG9ZWUFqbWR6TWc4azdoS1hRR3UvS3NBYjR3RFFZSktvWklodmNOQVFFTEJRQURnZ0VCQUdrOXA1eXRPYURJUFJQazVJbXBIMWY2ZjAxMG1VTFdQVjVQam42a3pNSFA5ejVuZE16KysxTk92SFY0R1ZCQ29ldUtxMWJwRkNEK0lnQTlwY0pBRVhRL3U0R3BtYkFLVVp6bWZNSWI4OWFSZ25KcDBteDlZNEJCZDQ1RXhVV3M4dzRjZmdGWnlaVWVIdldzMWFucEFjUjJGSVpwQVZNUUNhSWdqT3QyZGRSMXh2NGFjQ3crbUQvQjlvS2ZHWkVVZ3lJQU52cEJJRGFiZ2dMU3dGYTlPS0tYUkJWUkFhZm83T2FjMjFIUVU3RTNzWHBoYUhaR2ZuMkYyN2REL3FvcVVjTHFyNGxDYzdsTkUwWUdwNnIrYVBvOVZMY0gyVjBsTjR0KzFWYlZBcndLem5zTmRjUW53S0JldGdxdlpyZ0xnNCtxam80eXVpeEpZMzhYVS9iN2JhVT0NCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0NCi0tLS0tQkVHSU4gQ0VSVElGSUNBVEUtLS0tLQ0KTUlJRWtqQ0NBM3FnQXdJQkFnSVFDZ0ZCUWdBQUFWT0ZjMm9MaGV5bkNEQU5CZ2txaGtpRzl3MEJBUXNGQURBL01TUXdJZ1lEVlFRS0V4dEVhV2RwZEdGc0lGTnBaMjVoZEhWeVpTQlVjblZ6ZENCRGJ5NHhGekFWQmdOVkJBTVREa1JUVkNCU2IyOTBJRU5CSUZnek1CNFhEVEUyTURNeE56RTJOREEwTmxvWERUSXhNRE14TnpFMk5EQTBObG93U2pFTE1Ba0dBMVVFQmhNQ1ZWTXhGakFVQmdOVkJBb1REVXhsZENkeklFVnVZM0o1Y0hReEl6QWhCZ05WQkFNVEdreGxkQ2R6SUVWdVkzSjVjSFFnUVhWMGFHOXlhWFI1SUZnek1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBbk5NTThGcmxMa2UzY2wwM2c3Tm9ZekRxMXpVbUdTWGh2YjQxOFhDU0w3ZTRTMEVGcTZtZU5RaFk3TEVxeEdpSEM2UGpkZVRtODZkaWNicDVnV0FmMTVHYW4vUFFlR2R4eUdrT2xaSFAvdWFaNldBOFNNeCt5azEzRWlTZFJ4dGE2N25zSGpjQUhKeXNlNmNGNnM1SzY3MUI1VGFZdWN2OWJUeVdhTjhqS2tLUURJWjBaOGgvcFpxNFVtRVVFejlsNllLSHk5djZEbGIyaG9uemhUK1hocSt3M0JydmF3MlZGbjNFSzZCbHNwa0VObldBYTZ4Szh4dVFTWGd2b3BaUEtpQWxLUVRHZE1EUU1jMlBNVGlWRnJxb003aEQ4YkVmd3pCL29ua3hFejB0TnZqai9QSXphcms1TWNXdnhJME5IV1FXTTZyNmhDbTIxQXZBMkgzRGt3SURBUUFCbzRJQmZUQ0NBWGt3RWdZRFZSMFRBUUgvQkFnd0JnRUIvd0lCQURBT0JnTlZIUThCQWY4RUJBTUNBWVl3ZndZSUt3WUJCUVVIQVFFRWN6QnhNRElHQ0NzR0FRVUZCekFCaGlab2RIUndPaTh2YVhOeVp5NTBjblZ6ZEdsa0xtOWpjM0F1YVdSbGJuUnlkWE4wTG1OdmJUQTdCZ2dyQmdFRkJRY3dBb1l2YUhSMGNEb3ZMMkZ3Y0hNdWFXUmxiblJ5ZFhOMExtTnZiUzl5YjI5MGN5OWtjM1J5YjI5MFkyRjRNeTV3TjJNd0h3WURWUjBqQkJnd0ZvQVV4S2V4cEhzc2NmcmI0VXVRZGYvRUZXQ0ZpUkF3VkFZRFZSMGdCRTB3U3pBSUJnWm5nUXdCQWdFd1B3WUxLd1lCQkFHQzN4TUJBUUV3TURBdUJnZ3JCZ0VGQlFjQ0FSWWlhSFIwY0RvdkwyTndjeTV5YjI5MExYZ3hMbXhsZEhObGJtTnllWEIwTG05eVp6QThCZ05WSFI4RU5UQXpNREdnTDZBdGhpdG9kSFJ3T2k4dlkzSnNMbWxrWlc1MGNuVnpkQzVqYjIwdlJGTlVVazlQVkVOQldETkRVa3d1WTNKc01CMEdBMVVkRGdRV0JCU29TbXBqQkgzZHV1YlJPYmVtUldYdjg2anNvVEFOQmdrcWhraUc5dzBCQVFzRkFBT0NBUUVBM1RQWEVmTmpXRGpkR0JYN0NWVytkbGE1Y0VpbGFVY25lOElrQ0pMeFdoOUtFaWszSkhSUkhHSm91TTJWY0dmbDk2UzhUaWhSelp2b3JvZWQ2dGk2V3FFQm10enczV29kYXRnK1Z5T2VwaDRFWXByLzF3WEt0eDgvd0FwSXZKU3d0bVZpNE1GVTVhTXFyU0RFNmVhNzNNajJ0Y015bzVqTWQ2am1lV1VISzhzby9qb1dVb0hPVWd3dVg0UG8xUVl6KzNkc3prRHFNcDRma2x4QndYUnNXMTBLWHpQTVRaK3NPUEF2ZXl4aW5kbWprVzhsR3krUXNSbEdQZlorRzZaNmg3bWplbTBZK2lXbGtZY1Y0UElXTDFpd0JpOHNhQ2JHUzVqTjJwOE0rWCtRN1VOS0VrUk9iM042S09xa3FtNTdUSDJIM2VESkFrU25oNi9ETkZ1MFFnPT0NCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0NCi0tLS0tQkVHSU4gQ0VSVElGSUNBVEUtLS0tLQ0KTUlJRFNqQ0NBaktnQXdJQkFnSVFSSyt3Z05hako3cUpNRG1HTHZoQWF6QU5CZ2txaGtpRzl3MEJBUVVGQURBL01TUXdJZ1lEVlFRS0V4dEVhV2RwZEdGc0lGTnBaMjVoZEhWeVpTQlVjblZ6ZENCRGJ5NHhGekFWQmdOVkJBTVREa1JUVkNCU2IyOTBJRU5CSUZnek1CNFhEVEF3TURrek1ESXhNVEl4T1ZvWERUSXhNRGt6TURFME1ERXhOVm93UHpFa01DSUdBMVVFQ2hNYlJHbG5hWFJoYkNCVGFXZHVZWFIxY21VZ1ZISjFjM1FnUTI4dU1SY3dGUVlEVlFRREV3NUVVMVFnVW05dmRDQkRRU0JZTXpDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTit2NlpkUUNJTlh0TXhpWmZhUWd1ekgweXhyTU1wYjdObkRmY2RBd1JnVWkrRG9NM1pKS3VNL0lVbVRyRTRPcno1SXkyWHUvTk1oRDJYU0t0a3lqNHpsOTNld0VudTFsY0NKbzZtNjdYTXVlZ3dHTW9PaWZvb1VNTTBSb09FcU9MbDVDakg5VUwyQVpkKzNVV09EeU9LSVllcExZWUhzVW11NW91SkxHaWlmU0tPZUROb0pqajRYTGg3ZElOOWJ4aXFLcXk2OWNLM0ZDeG9sa0hSeXhYdHFxelRXTUluLzVXZ1RlMVFMeU5hdTdGcWNraDQ5WkxPTXh0Ky95VUZ3N0JaeTFTYnNPRlU1UTlEOC9SaGNRUEdYNjlXYW00MGR1dG9sdWNiWTM4RVZBanFyMm03eFBpNzFYQWljUE5hRGFlUVFteGtxdGlsWDQrVTltNS93QWwwQ0F3RUFBYU5DTUVBd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBT0JnTlZIUThCQWY4RUJBTUNBUVl3SFFZRFZSME9CQllFRk1TbnNhUjdMSEg2MitGTGtIWC94QlZnaFlrUU1BMEdDU3FHU0liM0RRRUJCUVVBQTRJQkFRQ2pHaXliRndCY3FSN3VLR1kzT3IrRHh6OUx3d21nbFNCZDQ5bFpSTkkrRFQ2OWlrdWdkQi9PRUlLY2RCb2RmcGdhM2NzVFM3TWdST1NSNmN6OGZhWGJhdVgrNXYzZ1R0MjNBRHExY0Vtdjh1WHJBdkhSQW9zWnk1UTZYa2pFR0I1WUdWOGVBbHJ3RFBHeHJhbmNXWWFMYnVtUjlZYksrcmxtTTZwWlc4N2lweFp6UjhzcnpKbXdOMGpQNDFaTDljOFBESEl5aDhid1JMdFRjbTFEOVNaSW1sSm50MWlyL21kMmNYamJEYUpXRkJNNUpER0ZvcWdDV2pCSDRkMVFCN3dDQ1pBQTYyUmpZSnNXdklqSkV1YlNmWkdMK1QweWpXVzA2WHl4VjNicXhiWW9PYjhWWlJ6STluZVdhZ3FOZHd2WWtRc0VqZ2ZiS2JZSzdwMkNOVFVRDQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tDQo=" + + p := __local2__ if { + __local4__ = data.generated.certs + crypto.x509.parse_certificates(__local4__, __local3__) + __local0__ = __local3__ + __local2__ = [__local1__ | __local1__ = __local0__[_].Subject.CommonName] + } + data: {} + want_result: + - x: + - openpolicyagent.org + - Let's Encrypt Authority X3 + - DST Root CA X3 diff --git a/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml new file mode 100644 index 0000000000..f6d03c690c --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0122.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: cryptox509parsecertificates/PEM, chain, string + query: data.generated.p = x + modules: + - | + package generated + + certs := "-----BEGIN CERTIFICATE-----\nMIIFdzCCBF+gAwIBAgISA3NriAEus/+cvflvhVQOW5zTMA0GCSqGSIb3DQEBCwUAMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQDExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0yMDA3MTAxNjAwMzBaFw0yMDEwMDgxNjAwMzBaMB4xHDAaBgNVBAMTE29wZW5wb2xpY3lhZ2VudC5vcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCyy8HZXVTJ2TSHXYnoL+CKYpo4wz1wowUcdt/XBgN08f37NxaNk+VAj8GD2s6zhoHLShyYS2PVosf7xumvyG914PLpIHO9WmCaZMqwEyvMM/VE9dBkKfaTo78BT6aXyJmnkjpeFmBOGs3uP5bUARj3Onnr7Aos9j45rgrytpelYTMlLi6jVtBv5RIZuMoJ15W252t8eIgsOq57ad0Bobeyy4TuGhveP0V3vUJvI3ibqH5E9cWzI2f8UtoirUNf0J3tcng8JqSOuuzWDYWrRDAzQbJYqKzvVDcN+ptqV7GZ6JuqHhdwgDeqBOsveDbzAAyYSVPJjRWYea8MxlM7OXbtAgMBAAGjggKBMIICfTAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFHDweb6KprSvWrw/vR6kwTVpudPtMB8GA1UdIwQYMBaAFKhKamMEfd265tE5t6ZFZe/zqOyhMG8GCCsGAQUFBwEBBGMwYTAuBggrBgEFBQcwAYYiaHR0cDovL29jc3AuaW50LXgzLmxldHNlbmNyeXB0Lm9yZzAvBggrBgEFBQcwAoYjaHR0cDovL2NlcnQuaW50LXgzLmxldHNlbmNyeXB0Lm9yZy8wNwYDVR0RBDAwLoITb3BlbnBvbGljeWFnZW50Lm9yZ4IXd3d3Lm9wZW5wb2xpY3lhZ2VudC5vcmcwTAYDVR0gBEUwQzAIBgZngQwBAgEwNwYLKwYBBAGC3xMBAQEwKDAmBggrBgEFBQcCARYaaHR0cDovL2Nwcy5sZXRzZW5jcnlwdC5vcmcwggEEBgorBgEEAdZ5AgQCBIH1BIHyAPAAdgBep3P531bA57U2SH3QSeAyepGaDIShEhKEGHWWgXFFWAAAAXM5q9vDAAAEAwBHMEUCIQCRHqgrtl07Y6TryfMmQN6TNKRVm1LTy9vI3Mh/krbSQQIgYgVAKwXRoPR+BN1pcJbJv3Aivbh6E7L987rMSEQk5VoAdgCyHgXMi6LNiiBOh2b5K7mKJSBna9r6cOeySVMt74uQXgAAAXM5q9uuAAAEAwBHMEUCIQDdruTutQ/UchckqYQ+2p9mutnrSnnQXa8xLA41YGzZHgIgXXETFbGfns2C7YJ8cDoYYAjmdzMg8k7hKXQGu/KsAb4wDQYJKoZIhvcNAQELBQADggEBAGk9p5ytOaDIPRPk5ImpH1f6f010mULWPV5Pjn6kzMHP9z5ndMz++1NOvHV4GVBCoeuKq1bpFCD+IgA9pcJAEXQ/u4GpmbAKUZzmfMIb89aRgnJp0mx9Y4BBd45ExUWs8w4cfgFZyZUeHvWs1anpAcR2FIZpAVMQCaIgjOt2ddR1xv4acCw+mD/B9oKfGZEUgyIANvpBIDabggLSwFa9OKKXRBVRAafo7Oac21HQU7E3sXphaHZGfn2F27dD/qoqUcLqr4lCc7lNE0YGp6r+aPo9VLcH2V0lN4t+1VbVArwKznsNdcQnwKBetgqvZrgLg4+qjo4yuixJY38XU/b7baU=\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4XDTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0NlowSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxldCdzIEVuY3J5cHQxIzAhBgNVBAMTGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4S0EFq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8SMx+yk13EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0Z8h/pZq4UmEUEz9l6YKHy9v6Dlb2honzhT+Xhq+w3Brvaw2VFn3EK6BlspkENnWAa6xK8xuQSXgvopZPKiAlKQTGdMDQMc2PMTiVFrqoM7hD8bEfwzB/onkxEz0tNvjj/PIzark5McWvxI0NHWQWM6r6hCm21AvA2H3DkwIDAQABo4IBfTCCAXkwEgYDVR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAYYwfwYIKwYBBQUHAQEEczBxMDIGCCsGAQUFBzABhiZodHRwOi8vaXNyZy50cnVzdGlkLm9jc3AuaWRlbnRydXN0LmNvbTA7BggrBgEFBQcwAoYvaHR0cDovL2FwcHMuaWRlbnRydXN0LmNvbS9yb290cy9kc3Ryb290Y2F4My5wN2MwHwYDVR0jBBgwFoAUxKexpHsscfrb4UuQdf/EFWCFiRAwVAYDVR0gBE0wSzAIBgZngQwBAgEwPwYLKwYBBAGC3xMBAQEwMDAuBggrBgEFBQcCARYiaHR0cDovL2Nwcy5yb290LXgxLmxldHNlbmNyeXB0Lm9yZzA8BgNVHR8ENTAzMDGgL6AthitodHRwOi8vY3JsLmlkZW50cnVzdC5jb20vRFNUUk9PVENBWDNDUkwuY3JsMB0GA1UdDgQWBBSoSmpjBH3duubRObemRWXv86jsoTANBgkqhkiG9w0BAQsFAAOCAQEA3TPXEfNjWDjdGBX7CVW+dla5cEilaUcne8IkCJLxWh9KEik3JHRRHGJouM2VcGfl96S8TihRzZvoroed6ti6WqEBmtzw3Wodatg+VyOeph4EYpr/1wXKtx8/wApIvJSwtmVi4MFU5aMqrSDE6ea73Mj2tcMyo5jMd6jmeWUHK8so/joWUoHOUgwuX4Po1QYz+3dszkDqMp4fklxBwXRsW10KXzPMTZ+sOPAveyxindmjkW8lGy+QsRlGPfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M+X+Q7UNKEkROb3N6KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ\n-----END CERTIFICATE-----" + + p := __local2__ if { + __local4__ = data.generated.certs + crypto.x509.parse_certificates(__local4__, __local3__) + __local0__ = __local3__ + __local2__ = [__local1__ | __local1__ = __local0__[_].Subject.CommonName] + } + data: {} + want_result: + - x: + - openpolicyagent.org + - Let's Encrypt Authority X3 + - DST Root CA X3 diff --git a/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml new file mode 100644 index 0000000000..87a7435231 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0123.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: cryptox509parsecertificates/invalid DER or PEM data, b64 + query: data.generated.p = x + modules: + - | + package generated + + certs := "YmFkc3RyaW5n" + + p := __local2__ if { + __local4__ = data.generated.certs + crypto.x509.parse_certificates(__local4__, __local3__) + __local0__ = __local3__ + __local2__ = [__local1__ | __local1__ = __local0__[_].Subject.CommonName] + } + want_error_code: eval_builtin_error + want_error: "x509: malformed certificate" + strict_error: true diff --git a/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml new file mode 100644 index 0000000000..74741d0f80 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-0124.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: cryptox509parsecertificates/invalid DER or PEM data, string + query: data.generated.p = x + modules: + - | + package generated + + certs := "foobar" + + p := __local2__ if { + __local4__ = data.generated.certs + crypto.x509.parse_certificates(__local4__, __local3__) + __local0__ = __local3__ + __local2__ = [__local1__ | __local1__ = __local0__[_].Subject.CommonName] + } + want_error_code: eval_builtin_error + want_error: illegal base64 + strict_error: true diff --git a/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml new file mode 100644 index 0000000000..33a1666690 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsecertificates/test-cryptox509parsecertificates-raw-uris.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: cryptox509parsecertificates/uri_strings + query: data.generated.uri_strings = x + modules: + - | + package generated + + certs := "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUIxekNDQVh5Z0F3SUJBZ0lJZGxpT1dVY1NXM3N3Q2dZSUtvWkl6ajBFQXdJd1BURUxNQWtHQTFVRUJoTUMKUjBJeEVEQU9CZ05WQkFvVEIwVjRZVzF3YkdVeEhEQWFCZ05WQkFVVEV6RTFPREV4TnpnNU56UTJPRFkxTmpneQpOalF3SUJjTk1qTXhNVEl3TVRZMU5USTRXaGdQTWpFeU1qRXdNamN4TmpVMU1qaGFNRDB4Q3pBSkJnTlZCQVlUCkFrZENNUkF3RGdZRFZRUUtFd2RGZUdGdGNHeGxNUnd3R2dZRFZRUUZFeE00TlRJM056SXlOREE0TlRJeE5qVXoKTVRFMU1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRXp0UDNrQnNpQXY4UUF5eWxUalJZSFlWegpjWTB5YmpBdC9VbWpZb3Fxb0o4SEtIdXF1ckRaUmVwa05qUXdwV3pmZndZZ0xaNk42SisyVUlPdlZ0TDZEcU5rCk1HSXdEZ1lEVlIwUEFRSC9CQVFEQWdlQU1CMEdBMVVkSlFRV01CUUdDQ3NHQVFVRkJ3TUNCZ2dyQmdFRkJRY0QKQVRBTUJnTlZIUk1CQWY4RUFqQUFNQ01HQTFVZEVRUWNNQnFHR0hOd2FXWm1aVG92TDJWNFlXMXdiR1V1WTI5dApMMjl3WVRBS0JnZ3Foa2pPUFFRREFnTkpBREJHQWlFQXlRNDhPd25lTHkzMjZqYitEUjd5RjJhcS94Wnl1cW9qCitUU3ZLVVB5NEU0Q0lRQ0VMUlp3K0dWTjhJR0drVGV4MGxxTDNxY21mWldJbm15VitrbnQ0d3p3L3c9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==" + + uri_strings := crypto.x509.parse_certificates(certs)[0].URIStrings + want_result: + - x: + - spiffe://example.com/opa + - note: cryptox509parsecertificates/uri_strings_no_uris + query: data.generated.uri_strings = x + modules: + - | + package generated + + certs := "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNTakNDQWJPZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRMEZBREJDTVFzd0NRWURWUVFHRXdKMWN6RUwKTUFrR0ExVUVDQXdDUTBFeEVEQU9CZ05WQkFvTUIwVjRZVzF3YkdVeEZEQVNCZ05WQkFNTUMyVjRZVzF3YkdVdQpZMjl0TUI0WERUSXpNVEV5T1RFMk5ESXdPRm9YRFRJME1URXlPREUyTkRJd09Gb3dRakVMTUFrR0ExVUVCaE1DCmRYTXhDekFKQmdOVkJBZ01Ba05CTVJBd0RnWURWUVFLREFkRmVHRnRjR3hsTVJRd0VnWURWUVFEREF0bGVHRnQKY0d4bExtTnZiVENCbnpBTkJna3Foa2lHOXcwQkFRRUZBQU9CalFBd2dZa0NnWUVBempOT1puY05DL25MdEZQYwpUNnNlSzZ0ditTbU9GaGk3NVBKRm9sQ0dFZUFiTHJHTzhaUmR2cXY2OStTTk41MUhrNFBJUDUrejk4aHZIdWJQClVtcGdOMVdVM3FKK2tOVTJXL3poR3pLMTdIL2c3YjVJTjRHZmx3bXJlRWZscnRicnZKSGRlRkVhVGtmYnVld0YKVmZvLzRiaG0yYUthczNHcUo3RnlBNDVxeVUwQ0F3RUFBYU5RTUU0d0hRWURWUjBPQkJZRUZOUStDMUVOK0dSYwpGS1dyTll6ZWdnbFc3TE9lTUI4R0ExVWRJd1FZTUJhQUZOUStDMUVOK0dSY0ZLV3JOWXplZ2dsVzdMT2VNQXdHCkExVWRFd1FGTUFNQkFmOHdEUVlKS29aSWh2Y05BUUVOQlFBRGdZRUF1cXdVVWVXbTFJaURRbmphK1hqd1VCaXUKQXBYWEx5NlFZRG9jUkhoRHlJS3BKSWRJOXltNi9RcVhkOFQ2WGlYUTJDbFNJbGxBSTByQWJYNUZvYzNxaWRkUAp0d2huT1pxd3NZdFhUNy9XOHFLSm5FVnhZckJuRmZSdk9SU3ZlOEtwSDErVHQ2elZEYlJ5bENacTR1TTNrZXN2CmJabXlVdlM1bldBVm44ZmhFdUU9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0=" + + uri_strings := crypto.x509.parse_certificates(certs)[0].URIStrings + want_result: + - x: null diff --git a/test/cases/testdata/v1/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml b/test/cases/testdata/v1/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml new file mode 100644 index 0000000000..6fca33c776 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsekeypair/test-cryptox509parsekeypairs-0118.yaml @@ -0,0 +1,94 @@ +--- +cases: + - note: cryptoX509ParseKeyPairs/PEM_encoded_string_cert_and_key + query: data.test.p = x + modules: + - | + package test + + p := crypto.x509.parse_keypair(input.cert, input.key).Certificate[0] + input: + cert: | + -----BEGIN CERTIFICATE----- + MIIEszCCApsCFDPRm4sTNZqiH601E6E6pEaJaCKqMA0GCSqGSIb3DQEBCwUAMBYx + FDASBgNVBAMMC2V4YW1wbGUuY29tMB4XDTIzMDUxMjEyMDIxNFoXDTIzMDYxMTEy + MDIxNFowFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggIiMA0GCSqGSIb3DQEBAQUA + A4ICDwAwggIKAoICAQDTcNASD17ohP3V14LMUIkFwAeeeniSXy4Pl3EqIgVpt9ul + 2IZiTm4JOYSgQ681bjt1OdwCkBf2Cg62DUyHMMwwnbaznN/Y5piYlaS33XCvcNpM + OWxwA4Z5Q0jNAshBExp8EzjEojbIUoeSncAP9jtOO/NArhLq+XodmONLqBG8KmZc + 2uiAeJ7ZjTpOckASYPYy7tUc4Ha3XUV0SoF/+0SJrXYOtpyMuMxwks6jMbpacmZn + jFIe8m2xH97s5inmHkzjBVKbpBQQHROP6A61VOrH9FrJRiACZ440zFJ1CGlXZau4 + oJgs9S1YRDI4W2Ha1WIYLpUBEMYXVYyn4swTBj42HqpSmfppOoR2g1d/AjxpFVAk + PLrict/nszhTIkEUE39vJh4HuytT49ss/cp4KokxBjLz7LmTUEzxJS8dB9714KzO + hFRHnpap0onU7Yb+Yz8/21bZL4AEL1d2Jg48jRET1Mrl9GOnWjzo7JxioUsbLcOo + y8Qcu2L87BQZqHCVpq6TcJKfPgh9t7y1AHvAfoXJdGSwimCZXuR4VEA3NJAHgPOw + LypB+dukzseWLdN+e7YOYqyWfjJg4aQmCx+nr866/QlQ4mrEBTkBsDOO5tEsKugI + redu+lL6z9QFdmeQpoC+s6JKnV29KHZXNDBZ1gnXOyA6lIBjjFjZqnkwT1ToHwID + AQABMA0GCSqGSIb3DQEBCwUAA4ICAQC8v5BIEooDSe5Kpzwsh9QLK7Ip33v4VHo+ + q82DRjAXiosFoaJ1dg+hwXOUo5VPSOqWCPNYRHDabuX4oiZAGPA9O5lTKQ/PQS4y + YIsD9XgeuDllBo3Y/uBwjoFFAD169fYMmZgGQ/PCdFS9nrYduPAIzNnsip+Z+XRK + qLwm83H/nKKgVvbGprNcivG3c8H42CKQ7aqDkEGuSG9EVRnQOMaI7ILMx/oj33Mk + uJ/21z4AHj7ads3dUF4syEBo5gWCAiBd+g1E/BkFnn+G+oOYo7c12dB+r6rbgrA0 + Bk+bW0NvU2ApP/LRRGaJD4wW2UoAklL618+CRWNtXdT+WeKIPlrEdC/0yzU5t6sA + II+PfvbeWQfL5CssbWhkTbJFt3JKTrIMc9cMjNcqeS+bAELuI16d4CZ5TlmZZeMd + 1WCv6R3YifkR9IogZhix20nPCF1mfo7Q0XAywkx8pPAC4n6uYStU9YobNAGlWXz+ + YbbJDf9r9au88Gu6xFf3eETKu2tJsQgVYBmXic85+FoV45qBI5YZvqiX9XZtWXw2 + 391fW+NdK01Jc0tqtADubaF6D4ncnriufqcz+70O0p7CzPbTMtUsPFxcfqZ6x1KX + gP1TgZM++PuYjHEyCFhHQBz9cQlxPdW4alaDYBnnKvLZXDOAXCWVWS6SXa5tkU3n + k9i0HC1bhg== + -----END CERTIFICATE----- + key: | + -----BEGIN PRIVATE KEY----- + MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDTcNASD17ohP3V + 14LMUIkFwAeeeniSXy4Pl3EqIgVpt9ul2IZiTm4JOYSgQ681bjt1OdwCkBf2Cg62 + DUyHMMwwnbaznN/Y5piYlaS33XCvcNpMOWxwA4Z5Q0jNAshBExp8EzjEojbIUoeS + ncAP9jtOO/NArhLq+XodmONLqBG8KmZc2uiAeJ7ZjTpOckASYPYy7tUc4Ha3XUV0 + SoF/+0SJrXYOtpyMuMxwks6jMbpacmZnjFIe8m2xH97s5inmHkzjBVKbpBQQHROP + 6A61VOrH9FrJRiACZ440zFJ1CGlXZau4oJgs9S1YRDI4W2Ha1WIYLpUBEMYXVYyn + 4swTBj42HqpSmfppOoR2g1d/AjxpFVAkPLrict/nszhTIkEUE39vJh4HuytT49ss + /cp4KokxBjLz7LmTUEzxJS8dB9714KzOhFRHnpap0onU7Yb+Yz8/21bZL4AEL1d2 + Jg48jRET1Mrl9GOnWjzo7JxioUsbLcOoy8Qcu2L87BQZqHCVpq6TcJKfPgh9t7y1 + AHvAfoXJdGSwimCZXuR4VEA3NJAHgPOwLypB+dukzseWLdN+e7YOYqyWfjJg4aQm + Cx+nr866/QlQ4mrEBTkBsDOO5tEsKugIredu+lL6z9QFdmeQpoC+s6JKnV29KHZX + NDBZ1gnXOyA6lIBjjFjZqnkwT1ToHwIDAQABAoICAAiuKHSdWe2czBjz1IRTyBRK + 2mU4rOuBadAtDPHIXMWGzUclOPsfMihByr6TmMVORbWdzvjx9nHc3ta9fAdOywsx + 5lbAWXY7nUciWZVMy3wAW43mi5uboXEoAHyeIR9+y8cNOPblm+8kaDluLXzaRHwF + PQrKOq+X11oQtUAdYcECUpp8SDBCA291+09OJHA8t87GfExHsMf9VcUc6+0XoSwv + yVl4SLwEOCxk8oPDnl1pNegJXDO2CyfK4amDF3RBiTGGveny1foFX5C4W6Y5Grxj + vThnHxhKLQ3g13/DfSOf4mldenHaDOcDQbaLldxYh0Lr4qUdDazWj8QyrOMZDgOy + nNnj9zuaI3Hw+zaGm6SQ4pG/s+IujUxyc0yNjGE5R/PswXBkpIR23w5hY7xyr0Eo + /Gb+jAumKxu/QA1GWY9DL/YKbG0sHJlG8BMzMls5YlWoOhcqw3DHJvLSpI4GlQba + hC741lNpCrf5FsyDu4ZOVfihDgGq3WteuEZ5vNBgLpateuAmCNjmNSDa/bK1cqBh + UlgPbFTEYBSklgt8oEEfhvn3ZNvxgRMCFu9USXRQeMIbB+BVQnarWOTYhKL5dqAh + uYCQprMRuu4FowAFYb37jEBktVAuJDJE4qwqYkLdu2g35SjbUgIJUn3oNDT7sgHs + SjlWT6005qL6dkjINWXZAoIBAQDXdtWq/jA3RswzQdLewjzaJR9wTbl8lV699ei6 + 8HUW9fr55mHyVewRihKNKFF0XnSAKBEqosyZ7joOdMwon0XmCZfJrjxTca4zhBtl + k1ku9mnRhck0ztc4OUKGyvb9oJ/PlN1CrU/hBwYVjnbWDVtufq/xGxeSzWx2zad/ + b824leawE4c9ozdp1cGtx0iwYAGjjA4BmCQIXiNcYa8qKU6SmHtD95pIbZUvqyOg + dT8TRcvt4jySibZtpWRF1NczNsnPa9TV6vtJqlZmF+vB1XZVLW0n/CyhAX8pb6qG + cImaViA4V6/I1VzCYR6FD+vPL8hv8G36rEpwAHLEHWUcvkmHAoIBAQD7ODKXb5XL + t3L9hxcOYrOshqKUCaT+52/Qmnntb0foxs5CcqBOPerOOTJgEPfn0NW3Ij8zaInk + NSSSZNJVG3jpWLzOTNUN/Cyep+Tkt50LyvMBa4AUUx3HtkDKqaL789A3WfQ8LJbO + 4WRPM9QNFLxh8uitHkVZY0FgI11eZunNv7kplYltrOGJIVGa3u7rLxLw/EeX7BLi + 1lnaQobVwrVWD1NU1J16PdGp3lKPk8J7y2fSj+UQW76ABopzFayO5nqi06ULMIDm + wVweYnYOBvNqqdG28u3ob15WCzH4WFd/RYDorXD3Xs9P0LEf9pf/PZ7elU/PEDse + jHXUNSPIVjKpAoIBABqjAEtBXWiYAgqcKpuLW8aELFzP3wx90tadHgZuT6tlAX// + cUBqSuLoNN7qixddzf1B9s1UjwLApsC+w7aJ6jREH1W5io+uUCDiRhjKnI3nvLFA + Xt1+bLDwsz7CvMIiJ1+cQbZKgsOJAMGNeTeBMzp3wvyFouZtKumNBxYEFmSpc3l1 + EJUYJnOZD3aSWnQjilBTsi+URXAbYze6g9MshCAvZZ3DcHlfwr+/4omltQSG7m0c + OOzMxZbMiZbwdyJHta9E320KvcIfosrATk8KOrTRBtuYm1PUQYo32dcA9qHz38vX + W03ywqLtKr68dySH/bmI+a+xuQobpBSGpcdl5uUCggEAIZBckgcCiHk2D9FgrzdY + shA64HR5auUY91HsQGDBxsPpAs+1wz5ahLr3lAYwWPR52UHmF8Q7yBWhkT2PLHfD + K8oDT7zMKlYqz/e2iShO/yhaVzI5pn2EWQ5skacgc3EbvIl0LCX48CME9+AA0M6Y + bK27kIWe1laAgYu4CcjOLAMVhgzIk7KpX1zoPjzSxvE/IptSJWYRD+V7k8GXqi+d + cqYRiB/v+kkQHhXqCey/6zI96M/41rqrNQeqr72RlHYOpHqKbnhIgIwM9rJI+47K + LtIJhtvmFUvr2qscPgXvir2Kf4vMsAAmyo8jWxXjMOLWuv5P72ZHv8kcZQHEihua + IQKCAQEArirbu/1dp/WTPdzhDjRRup8zLHXNzdm1WYCx6NSdouZyWpsqjcJEIKkj + WSv68hF4wp647eKU3/a27lungqCAKFpKzr1DptvXIJ9iQ53mZ+dL9JYl9hmowtWY + rrRVLmaroKOvSVgnFRmKm5IEOTmaZhE20F4l0tFa4gSdTgbMSkgO3jvlw5nxte0Q + E22gLpwhfX+YpbOgMETZ/0aH/MIdwJeyYm3GAhwVMyRnQztz/P8U0irS3GaNeEXc + LYpsx8F42L9P11OzEw+82DV2XzoHKZUYnGngXs6qByUeuGDTb0daDjOK5on6eNKL + Aj0c+XArCS87P4iflF9maJ3Tk/NfaA== + -----END PRIVATE KEY----- + want_result: + - x: MIIEszCCApsCFDPRm4sTNZqiH601E6E6pEaJaCKqMA0GCSqGSIb3DQEBCwUAMBYxFDASBgNVBAMMC2V4YW1wbGUuY29tMB4XDTIzMDUxMjEyMDIxNFoXDTIzMDYxMTEyMDIxNFowFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDTcNASD17ohP3V14LMUIkFwAeeeniSXy4Pl3EqIgVpt9ul2IZiTm4JOYSgQ681bjt1OdwCkBf2Cg62DUyHMMwwnbaznN/Y5piYlaS33XCvcNpMOWxwA4Z5Q0jNAshBExp8EzjEojbIUoeSncAP9jtOO/NArhLq+XodmONLqBG8KmZc2uiAeJ7ZjTpOckASYPYy7tUc4Ha3XUV0SoF/+0SJrXYOtpyMuMxwks6jMbpacmZnjFIe8m2xH97s5inmHkzjBVKbpBQQHROP6A61VOrH9FrJRiACZ440zFJ1CGlXZau4oJgs9S1YRDI4W2Ha1WIYLpUBEMYXVYyn4swTBj42HqpSmfppOoR2g1d/AjxpFVAkPLrict/nszhTIkEUE39vJh4HuytT49ss/cp4KokxBjLz7LmTUEzxJS8dB9714KzOhFRHnpap0onU7Yb+Yz8/21bZL4AEL1d2Jg48jRET1Mrl9GOnWjzo7JxioUsbLcOoy8Qcu2L87BQZqHCVpq6TcJKfPgh9t7y1AHvAfoXJdGSwimCZXuR4VEA3NJAHgPOwLypB+dukzseWLdN+e7YOYqyWfjJg4aQmCx+nr866/QlQ4mrEBTkBsDOO5tEsKugIredu+lL6z9QFdmeQpoC+s6JKnV29KHZXNDBZ1gnXOyA6lIBjjFjZqnkwT1ToHwIDAQABMA0GCSqGSIb3DQEBCwUAA4ICAQC8v5BIEooDSe5Kpzwsh9QLK7Ip33v4VHo+q82DRjAXiosFoaJ1dg+hwXOUo5VPSOqWCPNYRHDabuX4oiZAGPA9O5lTKQ/PQS4yYIsD9XgeuDllBo3Y/uBwjoFFAD169fYMmZgGQ/PCdFS9nrYduPAIzNnsip+Z+XRKqLwm83H/nKKgVvbGprNcivG3c8H42CKQ7aqDkEGuSG9EVRnQOMaI7ILMx/oj33MkuJ/21z4AHj7ads3dUF4syEBo5gWCAiBd+g1E/BkFnn+G+oOYo7c12dB+r6rbgrA0Bk+bW0NvU2ApP/LRRGaJD4wW2UoAklL618+CRWNtXdT+WeKIPlrEdC/0yzU5t6sAII+PfvbeWQfL5CssbWhkTbJFt3JKTrIMc9cMjNcqeS+bAELuI16d4CZ5TlmZZeMd1WCv6R3YifkR9IogZhix20nPCF1mfo7Q0XAywkx8pPAC4n6uYStU9YobNAGlWXz+YbbJDf9r9au88Gu6xFf3eETKu2tJsQgVYBmXic85+FoV45qBI5YZvqiX9XZtWXw2391fW+NdK01Jc0tqtADubaF6D4ncnriufqcz+70O0p7CzPbTMtUsPFxcfqZ6x1KXgP1TgZM++PuYjHEyCFhHQBz9cQlxPdW4alaDYBnnKvLZXDOAXCWVWS6SXa5tkU3nk9i0HC1bhg== diff --git a/test/cases/testdata/v1/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml b/test/cases/testdata/v1/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml new file mode 100644 index 0000000000..b8cda9631a --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsekeypair/test-cryptox509parsekeypairs-0119.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: cryptoX509ParseKeyPairs/base64_encoded_string_cert_and_key + query: data.test.p = x + modules: + - | + package test + + p := crypto.x509.parse_keypair(input.cert, input.key).Certificate[0] + input: + cert: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUY3ekNDQTllZ0F3SUJBZ0lVZFJIQStCMC9aZ2tuS1BsQjJmc3dFOThsekFjd0RRWUpLb1pJaHZjTkFRRUwKQlFBd2dZWXhDekFKQmdOVkJBWVRBbGhZTVJJd0VBWURWUVFJREFsVGRHRjBaVTVoYldVeEVUQVBCZ05WQkFjTQpDRU5wZEhsT1lXMWxNUlF3RWdZRFZRUUtEQXREYjIxd1lXNTVUbUZ0WlRFYk1Ca0dBMVVFQ3d3U1EyOXRjR0Z1CmVWTmxZM1JwYjI1T1lXMWxNUjB3R3dZRFZRUUREQlJEYjIxdGIyNU9ZVzFsVDNKSWIzTjBibUZ0WlRBZUZ3MHkKTXpBMU1UQXhNalV4TWpoYUZ3MHpNekExTURjeE1qVXhNamhhTUlHR01Rc3dDUVlEVlFRR0V3SllXREVTTUJBRwpBMVVFQ0F3SlUzUmhkR1ZPWVcxbE1SRXdEd1lEVlFRSERBaERhWFI1VG1GdFpURVVNQklHQTFVRUNnd0xRMjl0CmNHRnVlVTVoYldVeEd6QVpCZ05WQkFzTUVrTnZiWEJoYm5sVFpXTjBhVzl1VG1GdFpURWRNQnNHQTFVRUF3d1UKUTI5dGJXOXVUbUZ0WlU5eVNHOXpkRzVoYldVd2dnSWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUNEd0F3Z2dJSwpBb0lDQVFDM045anZpY21LcEdkMVAzcFhlQStNb2lkZE5qSjV2TTEzS3FhVGMxMjltY21ISHRJcmpHbmhvTHJOClNMV2NMR0tOQmJzQk5pNWxvcTQxc0pvZ3ltTnhVc3hRUUVyWG41RGlFbkVRZjFCcStuU0d6SWRHbWJtSlZXcUgKdDR0U0lIZENJRWF4SERIV2tJb2tsUjR0OENnTkl2aEtxbEdHSmx2TGZQVlpnV0hqczlIQSs2K0czNXRwL1pnQQp2U0EvTnV0azVQOUFMT2pseXNpeVNpWDZtYVJQayt5ck5mcHF6QTljbEllVlFRQ1RTR0hSUGVPeGcxU1NxcEhoCk11a3VZMDFKSHdvdEJVUWxOS3VEV0J3ejEzRk91YVBjNzRnMHBzTlFXZUNJaTdJWjZjUFpXSmZiQ2tSSEIwZUYKcGFPR2NueUZGYWZBZk5ZWjF3Wjg3SDZVM1U0endyMElMeFl6NkRuOEI0Zklra29ZMTlQSEVtbjR0ckhtNXdiUgpuSlZQaWVmZkFaenFLL3pjYWlCRlZEZEdRQy9UeTNLNXo5K1ZGYkl6UFdJUjVTNndlV3RiQThoM2FhL0UvdEhTCkNZV3ZpKzRSd3FQeGZXUTZKZXZ4ZFdDMDhSZ3kxSVB6N3Zxa3ZEMGJnN1JmMDF2SVVvaE8zdmJvSDdKejJLMG8KdkVHaVJkY1BRZkJ4eS9SNk80ZXN0UHBUTEU5Q1NTa2NUQVFjaWZDcG4zT1U4L3Z1UkxERXk5QXQrbWFkK0c1VgpLaVNubzhENXlnbGpPSEVRSUNaTzBjRU5GNXVWY3JOTmhRWVMwSmQ3RjllVkNTTzhIVUNzbE1xRjJlZG5GQ3BTCmZyWUlRa3NSVGdlajRiWFV4bFRGM3ZmakVabjVpZFZzSWdqMnRWUW9OMGRybjhNQVNRSURBUUFCbzFNd1VUQWQKQmdOVkhRNEVGZ1FVbERYeVAySHIrVlFNMWFIbHpjTjliRGxNYkpzd0h3WURWUjBqQkJnd0ZvQVVsRFh5UDJIcgorVlFNMWFIbHpjTjliRGxNYkpzd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBTkJna3Foa2lHOXcwQkFRc0ZBQU9DCkFnRUFDekdyZlhWWWhmQ210RlpOMFk2TktRN2cxSFZHSVg1VjNBbDRVK29vM3krOW40S1ZHa2dWOWpoL2RaOGsKbXpXbXBYT0dSZkQxdWZSY0Q5cW9YeStHSFJ3LzBibTJ3a1ZjTXZFc25NeCtEa3VoaVZPSWMwUFlETmo4N3VLMwp2TkZCTTM5dW8xZmlKOXlkOVNLUXNqQjk0bFZNYUYxMDg5d2V2UFlsNXFtYm9rdTJxdXJYM3V3NVZ2eXNIQUF3ClUyeTB4OHkvYzNqdzlNZksxWDBHWWhTY1owcFYzeTN4dGxxckhuTmpTUmFaM3BmUGw3NGFjMGJndEU5cThKdDUKbzNEMGdmWmkwOFJrdW5ua2dKMS9QZDVpYUgvWEdnVG56NXdTRUF6VFJCWEhLWVlvRnBGV0wwcnowa0pvamZDdwpSdXQ2T21uL0w2blFXL1I1endzcXZrQUR1by9LWFkyTjY5L1J4UHcwejhFcTZZTVR0OHBXOGU1ZHpSRlFUS2N2CktUdDJCNTB1VFVEUlBRbW92dkYzRmRqcllaYkhyRlhHUXIyaGV6bDU2QkRSSkJaTzhIQ0g0NEIxc3d6K3QySWYKb3V2MlBIZDA1V3ZDVHIvM0dFL2ZiVGpabFVWeDhaYTJUWXdWakhTUzl3OWtRQ1V2dzNXM25OdVF6TklHVGJzYQpEdlQzeVN0MjJkRDQwTVlrNHpOc3o4d1YwUVYwdmJ5enorMUZUSXJlVldJSXhpMHVveWdNaHVGTDdJem4xeHNBClQ4TWVsbHQzN20wM2V2QkxwUXdPWHF0N1JXWlNaMllydVQ2clpkZ2RBOXRlK2Y3VUxhYUNGRDJxYzloRFRLOGoKemh3Mk41cGNIMVpYZGZBRjNNUWo1VmErSElDRElaL3BtTmNkVlJnWWxWN0hkOWc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K + key: LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUpRZ0lCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQ1N3d2dna29BZ0VBQW9JQ0FRQzNOOWp2aWNtS3BHZDEKUDNwWGVBK01vaWRkTmpKNXZNMTNLcWFUYzEyOW1jbUhIdElyakduaG9Mck5TTFdjTEdLTkJic0JOaTVsb3E0MQpzSm9neW1OeFVzeFFRRXJYbjVEaUVuRVFmMUJxK25TR3pJZEdtYm1KVldxSHQ0dFNJSGRDSUVheEhESFdrSW9rCmxSNHQ4Q2dOSXZoS3FsR0dKbHZMZlBWWmdXSGpzOUhBKzYrRzM1dHAvWmdBdlNBL051dGs1UDlBTE9qbHlzaXkKU2lYNm1hUlBrK3lyTmZwcXpBOWNsSWVWUVFDVFNHSFJQZU94ZzFTU3FwSGhNdWt1WTAxSkh3b3RCVVFsTkt1RApXQnd6MTNGT3VhUGM3NGcwcHNOUVdlQ0lpN0laNmNQWldKZmJDa1JIQjBlRnBhT0djbnlGRmFmQWZOWVoxd1o4CjdINlUzVTR6d3IwSUx4WXo2RG44QjRmSWtrb1kxOVBIRW1uNHRySG01d2JSbkpWUGllZmZBWnpxSy96Y2FpQkYKVkRkR1FDL1R5M0s1ejkrVkZiSXpQV0lSNVM2d2VXdGJBOGgzYWEvRS90SFNDWVd2aSs0UndxUHhmV1E2SmV2eApkV0MwOFJneTFJUHo3dnFrdkQwYmc3UmYwMXZJVW9oTzN2Ym9IN0p6Mkswb3ZFR2lSZGNQUWZCeHkvUjZPNGVzCnRQcFRMRTlDU1NrY1RBUWNpZkNwbjNPVTgvdnVSTERFeTlBdCttYWQrRzVWS2lTbm84RDV5Z2xqT0hFUUlDWk8KMGNFTkY1dVZjck5OaFFZUzBKZDdGOWVWQ1NPOEhVQ3NsTXFGMmVkbkZDcFNmcllJUWtzUlRnZWo0YlhVeGxURgozdmZqRVpuNWlkVnNJZ2oydFZRb04wZHJuOE1BU1FJREFRQUJBb0lDQUJKaUttUm9neDRqM2xTYm5Lc3Jtd1hOCm5GMEVLOTdlcEpBTktiOFlQNExmYkNMZ1l3Nm5EVldzQXFwSDNoOFFMZ2cvMTdKb3JSR2FGOWcvd3N0QSsyYmEKdTdEZXJwUEJpVEJCMFBIcWtGZFhqM3NhQ1FXNnRXelQ4dmN3b2F4SklTWXpwbHd0ZTh1dlg0a0pwRWhRTlRpUwpObThKZFZvY1BiQW1kdGkyL0dzME52cmgxZ3dXb2htcHJnZCs4bjRkUk5Pd0RYTnpQaUFXYjNwQ0tkcmg4U1JoCjc0aURSei9SZjBZWENoNmQ4ZENWWGVrNGlFRGVzRXp5QythWWJPQ3dhb2dJY3dVdTV0WkQyV1M1b2NUSzNHM2QKZnhWVFBHdXFBdVZzU3pUd0xWdmZ3bnlyb0xzRDVmTnBoZEhoVzQzSkxYak9BakcwWk9nZFZPT1NlQ1g0S1prbwptcWc4b3Y1TksxclVRVGQwNng2bmg0elBXdEdaTDIwbE9EMTZvRWgzUlZoRFU5akQ1U25aZ2M1Mzg2bVkxeTVJClV0QTBUUnh3MzNIcjRWT1ExaXVCZzlrNTU2MzFIcGl0clBWZ1QvLzVzYzdjMjhpQ2lBRnVFZGg3SDF5cG5NNkgKc1pjL2prRTJBOFF1NnpKSTV2NzRoYkFaTmxONVMrcDU4ajhrV2pPYTd4bnZwYk5saXc1a2JDK2Ezb25ZSVNHZApTNVZITzVEVkVaOEY3aUtUTS8zTEFZdDZScG0vdEZJOUhFZVRGWHVCVEVsYTlsb0srUWdXbjF1QVVMeGtKUHFyCkFXZ0tzL0FYYWpxVyt0d3ZUM2M5cUFDaGFTakhjV3lxem05WGh6RDRwNTg2cnpDZ3M5VUNSSStudlEvOGFIMWoKNm9CdkRqbUxpem9WUEVkR2k1VkJBb0lCQVFEM2pRZThEdVIxVjYveS9HcXRNRVcyVXptdTl2d1R4VXRBSFZtawpob25PbFo0MDVEL1B3b0s1dXBORjV2QWtxNDN1b1M2OXVuQWxxbGpraVNmOTEzU3pYZEE4dXRRYlQzVFczUmxWCkZ2dXZlN3YvcWtRZFdScm5rdXJhcWtFbnhUMnlKOGdlaG1Qcmo1STMwVHVRVXpSdmFRc2hyYkIwV3NCcGcrRmIKdWJnV29wU21hVTY5aEJpSGxwWFYrcjJRUXIrVllHT3JLUkNSWDRhMGxtbEJxbDdnemVZSTA2d2RpamszelF5cgorcVltYjRkdEFqd3huQ09CRG9qbVJBM2hGTmpVbC8wNlVvMmZzUEM1cjduWlA2cURUMUU2MU5tVDhPZ3kyUWE1Cm90Uk4wS1E3bThGRXAwUDA4aHByOTRxVlZLaHB2NzMzcGMwQkhCQXZ6VG9RdTdKcEFvSUJBUUM5ZUxZZzVSS3cKMDZQSEVmRlhMTnZ1NU12Q2I0T2NHY1BHUElLaHEyWExTbFJSSElVSkdueFB2RVRrcm93YXhDVGVVc2g0WUFtUApZUjZxKzE2aHRwN1JBZ1RWNkxvZUpnQ2hDNVRvTWlkZkR2MmxEUnZneVpMWWtsU0VIcEpaSXRWWTI4NzFWTkRaClhFQWwwOGFGcHlENDNseXdNc3UxaHYzSnRMVGJVTDNZdGtBZnBQVFJBZ0ZaaFlxbVJUdTJKeXN5dXVoWWFVbS8KeEw3WDcvYmlJZ2FPemR1YkF0QXBFTUlEbnFOdVdKOUVBQit4a1c5VUIyTFpRZjBuOTh2bG40aUowaDhsb1V5RAphWElPbWpDZFJXeGFzeVRRQkNEZUR0eXgxbHNvb1R1U2JWU1FFSHVUeUgzVno2UHZBZC9xNGxwRW5hY0UvMjE5CjRXUEh6NnArcDJMaEFvSUJBQ28yQXhhZkYzZW16eHJJemN2Z1NsTFBtQ3RzZEFsUEFBamJ1RmhrbElVRVlDaTIKcnViWFRRRXNma1pTSGFxekVnMlpzR1dycjhuTVpVSDYzVFhja2txdmVYMlJnZTl5T2dNVlNtZUc5cjJ5aEprUQp5SEtVcWhESXJZRkJ2TUJ5VXBYWlVMZGJ4UmY2c0QwU1VXekhzMDQ0QkN6bStBcXZHdFlqSmI5RlNNMmJSV3VtCjAwVmZpK3M2MHl2Y2lJeGJ4VjFNUlZKL094TCt6ZkpuSDJXU0RvR1l1bHZROUMxSlQzNWpXWUROeVowT01YSjIKQ2h1UGUwSmJYeDZjaGgxV042N3doNzUxS3k4S3RkR0QxRlhtRkVZMXRTMHA5RHZVdlZOR1RHNUZCSnlNTWlUego1eDIwdzlLMW9hbTlXUVVqbldBQzBQcTBhK04vakljS0lKZVAyZGtDZ2dFQVhPZzhKcFV0UFJnS1R5czFOSklDCnBubjZrRFV1Uy9VMlVwYUpWODA3OVJ0VmpSQjNDNmU1SFVBc2FCWlBEVER4QXpPRXFjSXQ3ZWlwcVIzcG9WSnoKUGZuSGRUelJSc2RMdDZ4K0wvMm40S3p4STJYeUxaK3FLaGhXNlJJMG9SQzduUDdyMU5EcU9DdE1LVUJYTUdKcgpnSjFJeGYyaWRqamphV3o2NGpBTlo1NjJnczNZWGtTbGRNaE8zSWxHWm1OK2d6bXpoT2JjQ3ZUbXYrd2pHMitqCjE1S0tCTkMwVWU2dHRDaXQ2d1g1MHRaY3RDMmtjWWZOcU1yNjRBWmFMUmExVlI5N3RuQUpuTWF2N3drY25ZSFYKU0FSZ0lNQmxmWDI4S2xmNkMwcEVjK0M0Zm93V2pMamJPMlM5OWd6dFI3Z0dtMjdTMzFpQTBDRWRWSFU0SFRMbgpBUUtDQVFFQXNzajBmRThqa0ZpdnpRMmxTZTBEeGhwUXFHZVF1UGROYkJKVnNBcVdmRXRKQ0h2R0JYaTZBeEIrClFnN015RE14dnVPYXQ1TVNUQ01GYzNYdVFUdEtxdlF3SGxXMXZpTnJxckNzRHVRNTVDa1ZQTUxmazk4VlFoeHkKMnpUd20zOUd5a1ZpLy9CaU5LQzRCU2ZtZlN6cGdiYlJnSEI2Ny9zcGIwejBMbXUrWG5uL0ROemxxS1pvQUZFQgpwcDdzNkVmWGdJN1Npbm94dGxuRHM4eDdFM2dlcEtENVVWbnQzM3FZbUhCOVZ3WHpUZDBaSkhrY0x1b1VpanJjCko2cENYVTcrRlpPd3pJQi9IcFFPZ2pwdklqQ0pJaHRGeFZ5Z2JqdXVjRThRS2Naaml5VXNGTHZkQzVkZTFNZVQKMXJKalFFc2laeEgrUVBSODh0dUJ5VVZHMDAwbHBBPT0KLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQo= + want_result: + - x: MIIF7zCCA9egAwIBAgIUdRHA+B0/ZgknKPlB2fswE98lzAcwDQYJKoZIhvcNAQELBQAwgYYxCzAJBgNVBAYTAlhYMRIwEAYDVQQIDAlTdGF0ZU5hbWUxETAPBgNVBAcMCENpdHlOYW1lMRQwEgYDVQQKDAtDb21wYW55TmFtZTEbMBkGA1UECwwSQ29tcGFueVNlY3Rpb25OYW1lMR0wGwYDVQQDDBRDb21tb25OYW1lT3JIb3N0bmFtZTAeFw0yMzA1MTAxMjUxMjhaFw0zMzA1MDcxMjUxMjhaMIGGMQswCQYDVQQGEwJYWDESMBAGA1UECAwJU3RhdGVOYW1lMREwDwYDVQQHDAhDaXR5TmFtZTEUMBIGA1UECgwLQ29tcGFueU5hbWUxGzAZBgNVBAsMEkNvbXBhbnlTZWN0aW9uTmFtZTEdMBsGA1UEAwwUQ29tbW9uTmFtZU9ySG9zdG5hbWUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC3N9jvicmKpGd1P3pXeA+MoiddNjJ5vM13KqaTc129mcmHHtIrjGnhoLrNSLWcLGKNBbsBNi5loq41sJogymNxUsxQQErXn5DiEnEQf1Bq+nSGzIdGmbmJVWqHt4tSIHdCIEaxHDHWkIoklR4t8CgNIvhKqlGGJlvLfPVZgWHjs9HA+6+G35tp/ZgAvSA/Nutk5P9ALOjlysiySiX6maRPk+yrNfpqzA9clIeVQQCTSGHRPeOxg1SSqpHhMukuY01JHwotBUQlNKuDWBwz13FOuaPc74g0psNQWeCIi7IZ6cPZWJfbCkRHB0eFpaOGcnyFFafAfNYZ1wZ87H6U3U4zwr0ILxYz6Dn8B4fIkkoY19PHEmn4trHm5wbRnJVPieffAZzqK/zcaiBFVDdGQC/Ty3K5z9+VFbIzPWIR5S6weWtbA8h3aa/E/tHSCYWvi+4RwqPxfWQ6JevxdWC08Rgy1IPz7vqkvD0bg7Rf01vIUohO3vboH7Jz2K0ovEGiRdcPQfBxy/R6O4estPpTLE9CSSkcTAQcifCpn3OU8/vuRLDEy9At+mad+G5VKiSno8D5ygljOHEQICZO0cENF5uVcrNNhQYS0Jd7F9eVCSO8HUCslMqF2ednFCpSfrYIQksRTgej4bXUxlTF3vfjEZn5idVsIgj2tVQoN0drn8MASQIDAQABo1MwUTAdBgNVHQ4EFgQUlDXyP2Hr+VQM1aHlzcN9bDlMbJswHwYDVR0jBBgwFoAUlDXyP2Hr+VQM1aHlzcN9bDlMbJswDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEACzGrfXVYhfCmtFZN0Y6NKQ7g1HVGIX5V3Al4U+oo3y+9n4KVGkgV9jh/dZ8kmzWmpXOGRfD1ufRcD9qoXy+GHRw/0bm2wkVcMvEsnMx+DkuhiVOIc0PYDNj87uK3vNFBM39uo1fiJ9yd9SKQsjB94lVMaF1089wevPYl5qmboku2qurX3uw5VvysHAAwU2y0x8y/c3jw9MfK1X0GYhScZ0pV3y3xtlqrHnNjSRaZ3pfPl74ac0bgtE9q8Jt5o3D0gfZi08RkunnkgJ1/Pd5iaH/XGgTnz5wSEAzTRBXHKYYoFpFWL0rz0kJojfCwRut6Omn/L6nQW/R5zwsqvkADuo/KXY2N69/RxPw0z8Eq6YMTt8pW8e5dzRFQTKcvKTt2B50uTUDRPQmovvF3FdjrYZbHrFXGQr2hezl56BDRJBZO8HCH44B1swz+t2Ifouv2PHd05WvCTr/3GE/fbTjZlUVx8Za2TYwVjHSS9w9kQCUvw3W3nNuQzNIGTbsaDvT3ySt22dD40MYk4zNsz8wV0QV0vbyzz+1FTIreVWIIxi0uoygMhuFL7Izn1xsAT8Mellt37m03evBLpQwOXqt7RWZSZ2YruT6rZdgdA9te+f7ULaaCFD2qc9hDTK8jzhw2N5pcH1ZXdfAF3MQj5Va+HICDIZ/pmNcdVRgYlV7Hd9g= diff --git a/test/cases/testdata/v1/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml b/test/cases/testdata/v1/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml new file mode 100644 index 0000000000..4d6fda4502 --- /dev/null +++ b/test/cases/testdata/v1/cryptox509parsersaprivatekey/test-cryptox509parsersaprivatekey-1.yaml @@ -0,0 +1,32 @@ +--- +cases: + - note: cryptox509parsersaprivatekey/valid + query: data.testing.p = x + modules: + - | + package testing + + pem := "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEA9D/bK4171aiTNUkrUCHKGMLSQooV+o3wdz2889h9iv0HhhBJ\nCAGU54K3duB8ofHpmYL50QodcR4RLw1vSkaI+FPdPDMyKxKj/YcmofJjz4kW+Iqw\nFbBcbMnKnEVzye+CyW9YYOTu0xWtcgen80zGp2opG0GZX86hBjjXJnjOdrJTk6x2\nNAiJIbjsQevysmj+2MyqVm8widxw0x+rGhTaCD+ZXWitN0a0WO1aaA8c/7i99I9z\nhe2peKvXzEtMaqYO9ptHcYmq2z0QWvZuJVMv5Yn0mScLWyh91R099IOtn6sNaMMs\nOyTpi7E/2IlVgI2uKGPEopKkMFV8Fl2YaAbo7wIDAQABAoIBAAyMZ08ygqU0dvOq\n4a3JPp/NCo5el8h6mFsX8eg5PCHy4/sQRSBDLIpEXfaei+iqDA1V/E2wDlksaUeY\nkhony4uui1Q3cSFjYMd6tRJm6JfV/DcisO88U1NHfsBOlSdPxdFhhhHcUSTJHVMZ\nb5iBXkdlnd0HnsCcVguCyhLw6/KPFyiA+NYRz68flxze7admyVp5C6i/HbMPq8Pr\nMilBUvOFtxuaGeJBAiavuzUe9I70dRwpe424tMvisSA8h7Xbm8BeN/PJHDV/2JrI\nURgQ563yQ5So/Qg8AgxXRkpgWM9zAh7r31PBO86vq/B4ZbON/TtWdcZVsAcVB4Pk\ntqc8JNkCgYEA+g8V+y92SETdcwUkbd5O9Fg5CkfdsALsBXVH6FunrCUV5HS9l5o6\nMMBbJ/08odW/bP5BmOa4A/Hbk9uG/UfQn2KQ3HCgPlxUEwQO07R1/FcQOe4xmyG6\nJpDgQ30viE1RtlCkceQWUeitCIqZsYu0i8sLZLWJH+V/07OB4G17ELMCgYEA+g1v\nhrlAFNhZvrIX/zcP3xF2pZ+AqkFXdL/tWQZkWAVToONn/LlXTH71C/TO2x+OaQRm\nqX1bA9Zhyjf1gYQN9RenjUswvggk0aY2Tk28wUqowMGSsjQHmZ20EphHNMWNJpdS\nfKFfrQIFKCnLlpQVNz+j3bLWZUnq+jPaYnJP7NUCgYEA48qcVo7c7Ga3aNEVZ3St\nbg90HrZq760pvqshDz13V+0MrWnfUFxxh/mi0KHy+uYRlMNllFkQ5p8LTP0dUlt6\nY8dReU6r20MWX6BBtX9eP7o8ENm4nL4zqnAtq609gKgWuMNrmkiSQJl6Dx7bdY5z\nsSkNPvfUa5cQRBTxSjXRdtsCgYBHrzpdwRXh4/Q2ew/uFnbyWCtPZ96W8IyF58+/\nSdnSchR7dzYEeY3RXEQb3V6/6tgEu0JDLLC+9OKr+kbjjlwB+3oJQ5kBoYwMnj3L\nTPXj4+dk+xl3BPt4yoEpI4amVkwU2CTJnemzy3R3AyReUq2SXSg5El/sQbifaeYd\neu/20QKBgH/5IZHGBKiRAe1ww2FzOpDtL8VXXTe3EAXKutfajrHTqPz9+lXknX/D\nUMosh264nYXYS29WqxhJVutbE9u8e0VpuY1qIN9/3R0WKfTLTMUFlZtbqTepvsy1\nW2UbK732I4Nfp0/mtUvOSdMZO8dxbSdEeMnw/Ec8QgxK9a1rRu9+\n-----END RSA PRIVATE KEY-----" + + p := crypto.x509.parse_rsa_private_key(pem) + want_result: + - x: + d: DIxnTzKCpTR286rhrck-n80Kjl6XyHqYWxfx6Dk8IfLj-xBFIEMsikRd9p6L6KoMDVX8TbAOWSxpR5iSGifLi66LVDdxIWNgx3q1Embol9X8NyKw7zxTU0d-wE6VJ0_F0WGGEdxRJMkdUxlvmIFeR2Wd3QeewJxWC4LKEvDr8o8XKID41hHPrx-XHN7tp2bJWnkLqL8dsw-rw-syKUFS84W3G5oZ4kECJq-7NR70jvR1HCl7jbi0y-KxIDyHtdubwF4388kcNX_YmshRGBDnrfJDlKj9CDwCDFdGSmBYz3MCHuvfU8E7zq-r8Hhls439O1Z1xlWwBxUHg-S2pzwk2Q + dp: 48qcVo7c7Ga3aNEVZ3Stbg90HrZq760pvqshDz13V-0MrWnfUFxxh_mi0KHy-uYRlMNllFkQ5p8LTP0dUlt6Y8dReU6r20MWX6BBtX9eP7o8ENm4nL4zqnAtq609gKgWuMNrmkiSQJl6Dx7bdY5zsSkNPvfUa5cQRBTxSjXRdts + dq: R686XcEV4eP0NnsP7hZ28lgrT2felvCMhefPv0nZ0nIUe3c2BHmN0VxEG91ev-rYBLtCQyywvvTiq_pG445cAft6CUOZAaGMDJ49y0z14-PnZPsZdwT7eMqBKSOGplZMFNgkyZ3ps8t0dwMkXlKtkl0oORJf7EG4n2nmHXrv9tE + e: AQAB + kty: RSA + "n": 9D_bK4171aiTNUkrUCHKGMLSQooV-o3wdz2889h9iv0HhhBJCAGU54K3duB8ofHpmYL50QodcR4RLw1vSkaI-FPdPDMyKxKj_YcmofJjz4kW-IqwFbBcbMnKnEVzye-CyW9YYOTu0xWtcgen80zGp2opG0GZX86hBjjXJnjOdrJTk6x2NAiJIbjsQevysmj-2MyqVm8widxw0x-rGhTaCD-ZXWitN0a0WO1aaA8c_7i99I9zhe2peKvXzEtMaqYO9ptHcYmq2z0QWvZuJVMv5Yn0mScLWyh91R099IOtn6sNaMMsOyTpi7E_2IlVgI2uKGPEopKkMFV8Fl2YaAbo7w + p: -g8V-y92SETdcwUkbd5O9Fg5CkfdsALsBXVH6FunrCUV5HS9l5o6MMBbJ_08odW_bP5BmOa4A_Hbk9uG_UfQn2KQ3HCgPlxUEwQO07R1_FcQOe4xmyG6JpDgQ30viE1RtlCkceQWUeitCIqZsYu0i8sLZLWJH-V_07OB4G17ELM + q: -g1vhrlAFNhZvrIX_zcP3xF2pZ-AqkFXdL_tWQZkWAVToONn_LlXTH71C_TO2x-OaQRmqX1bA9Zhyjf1gYQN9RenjUswvggk0aY2Tk28wUqowMGSsjQHmZ20EphHNMWNJpdSfKFfrQIFKCnLlpQVNz-j3bLWZUnq-jPaYnJP7NU + qi: f_khkcYEqJEB7XDDYXM6kO0vxVddN7cQBcq619qOsdOo_P36VeSdf8NQyiyHbridhdhLb1arGElW61sT27x7RWm5jWog33_dHRYp9MtMxQWVm1upN6m-zLVbZRsrvfYjg1-nT-a1S85J0xk7x3FtJ0R4yfD8RzxCDEr1rWtG734 + - note: cryptox509parsersaprivatekey/invalid + query: data.testing.p = x + modules: + - | + package testing + + p := crypto.x509.parse_rsa_private_key("invalid") + want_error_code: eval_builtin_error + want_error: illegal base64 + strict_error: true diff --git a/test/cases/testdata/v1/dataderef/test-data-derefs.yaml b/test/cases/testdata/v1/dataderef/test-data-derefs.yaml new file mode 100644 index 0000000000..c933bb5105 --- /dev/null +++ b/test/cases/testdata/v1/dataderef/test-data-derefs.yaml @@ -0,0 +1,38 @@ +--- +cases: + - note: data/toplevel integer + query: data.test.p = x + modules: + - | + package test + + p := data[2] + data: + "2": bar + want_result: + - x: bar + - note: data/nested integer + query: data.test.p = x + modules: + - | + package test + + p := data.nested[2] + data: + nested: + "2": bar + want_result: + - x: bar + - note: "data/negative case: nested integer" + query: data.test.p = x + modules: + - | + package test + + p := obj[2] if { + obj := data.nested + } + data: + nested: + "2": bar + want_result: [] diff --git a/test/cases/testdata/v1/defaultkeyword/test-default-functions.yaml b/test/cases/testdata/v1/defaultkeyword/test-default-functions.yaml new file mode 100644 index 0000000000..e83cd26fc2 --- /dev/null +++ b/test/cases/testdata/v1/defaultkeyword/test-default-functions.yaml @@ -0,0 +1,40 @@ +--- +cases: + - note: defaultkeyword/function with var arg + query: data.test = x + modules: + - | + package test + + default f(_) := 100 + want_result: + - x: {} + - note: defaultkeyword/function with var arg, ref head + query: data.test = x + modules: + - | + package test + + default p.q.r.f(x) := 100 + want_result: + - x: + p: + q: + r: {} + - note: defaultkeyword/function with var arg, ref head query + query: data.test.foo = x + modules: + - | + package test + + default p.q.r.f(x) := 100 + + p.q.r.f(x) := x if { + x == 2 + } + + foo if { + p.q.r.f(3) == 100 + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0804.yaml b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0804.yaml new file mode 100644 index 0000000000..c0ac23fc31 --- /dev/null +++ b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0804.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: defaultkeyword/undefined + query: data.generated.p = x + modules: + - | + package generated + + p := 1 if { + false + } + + default p := 0 + + p := 2 if { + false + } + data: {} + want_result: + - x: 0 diff --git a/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0805.yaml b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0805.yaml new file mode 100644 index 0000000000..b27dc0bda3 --- /dev/null +++ b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0805.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: defaultkeyword/defined + query: data.generated.p = x + modules: + - | + package generated + + default p := 0 + + p := 1 + + p := 2 if { + false + } + data: {} + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0806.yaml b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0806.yaml new file mode 100644 index 0000000000..986a7ec41d --- /dev/null +++ b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0806.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: defaultkeyword/defined-ooo + query: data.generated.p = x + modules: + - | + package generated + + p := 1 + + default p := 0 + + p := 2 if { + false + } + data: {} + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0807.yaml b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0807.yaml new file mode 100644 index 0000000000..16e9ba5150 --- /dev/null +++ b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0807.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: defaultkeyword/array comprehension + query: data.generated.p = x + modules: + - | + package generated + + p := 1 if { + false + } + + default p := [x | data.a[_] = x] + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: + - "1" + - "2" + - "3" + - "4" diff --git a/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0808.yaml b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0808.yaml new file mode 100644 index 0000000000..d748fe7f7f --- /dev/null +++ b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0808.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: defaultkeyword/object comprehension + query: data.generated.p = x + modules: + - | + package generated + + p := 1 if { + false + } + + default p := {x: k | data.d[k][_] = x} + data: + d: + e: + - bar + - baz + want_result: + - x: + bar: e + baz: e diff --git a/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0809.yaml b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0809.yaml new file mode 100644 index 0000000000..6b3ca5d98e --- /dev/null +++ b/test/cases/testdata/v1/defaultkeyword/test-defaultkeyword-0809.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: defaultkeyword/set comprehension + query: data.generated.p = x + modules: + - | + package generated + + p := 1 if { + false + } + + default p := {x | data.a[_] = x} + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: + - "1" + - "2" + - "3" + - "4" diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0763.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0763.yaml new file mode 100644 index 0000000000..6839029102 --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0763.yaml @@ -0,0 +1,33 @@ +--- +cases: + - note: "disjunction/incr: query set" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.a[i] = x + } + + p contains y if { + data.b[j] = y + } + data: + a: + - "1" + - "2" + - "3" + - "4" + b: + v1: hello + v2: goodbye + want_result: + - x: + - "1" + - "2" + - "3" + - "4" + - goodbye + - hello + sort_bindings: true diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0764.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0764.yaml new file mode 100644 index 0000000000..db6ef1d8b6 --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0764.yaml @@ -0,0 +1,27 @@ +--- +cases: + - note: "disjunction/incr: query set constants" + query: data.generated.p = x + modules: + - | + package generated + + p contains 100 + + p contains x if { + data.a[x] + } + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: + - 0 + - 1 + - 2 + - 3 + - 100 + sort_bindings: true diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0765.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0765.yaml new file mode 100644 index 0000000000..8ec9295963 --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0765.yaml @@ -0,0 +1,48 @@ +--- +cases: + - note: "disjunction/incr: query object" + query: data.generated.p = x + modules: + - | + package generated + + p[k] := v if { + data.b[v] = k + } + + p[k] := v if { + data.a[i] = v + data.g[k][j] = v + } + data: + a: + - "1" + - "2" + - "3" + - "4" + b: + v1: hello + v2: goodbye + g: + a: + - "1" + - "0" + - "0" + - "0" + b: + - "0" + - "2" + - "0" + - "0" + c: + - "0" + - "0" + - "0" + - "4" + want_result: + - x: + a: "1" + b: "2" + c: "4" + goodbye: v2 + hello: v1 diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0766.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0766.yaml new file mode 100644 index 0000000000..622eab91ae --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0766.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "disjunction/incr: query object constant key" + query: data.generated.p = x + modules: + - | + package generated + + p["a"] := 1 + + p["b"] := 2 + data: {} + want_result: + - x: + a: 1 + b: 2 diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0767.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0767.yaml new file mode 100644 index 0000000000..fb7743cdbc --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0767.yaml @@ -0,0 +1,37 @@ +--- +cases: + - note: "disjunction/incr: iter set" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[x] + } + + q contains x if { + data.a[i] = x + } + + q contains y if { + data.b[j] = y + } + data: + a: + - "1" + - "2" + - "3" + - "4" + b: + v1: hello + v2: goodbye + want_result: + - x: + - "1" + - "2" + - "3" + - "4" + - goodbye + - hello + sort_bindings: true diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0768.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0768.yaml new file mode 100644 index 0000000000..58d12c1e66 --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0768.yaml @@ -0,0 +1,38 @@ +--- +cases: + - note: "disjunction/incr: eval set" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q = s + s[x] + } + + q contains x if { + data.a[_0] = x + } + + q contains y if { + data.b[_0] = y + } + data: + a: + - "1" + - "2" + - "3" + - "4" + b: + v1: hello + v2: goodbye + want_result: + - x: + - "1" + - "2" + - "3" + - "4" + - goodbye + - hello + sort_bindings: true diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0769.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0769.yaml new file mode 100644 index 0000000000..98a5df6724 --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0769.yaml @@ -0,0 +1,52 @@ +--- +cases: + - note: "disjunction/incr: eval object" + query: data.generated.p = x + modules: + - | + package generated + + p[k] := v if { + data.generated.q[k] = v + } + + q[k] := v if { + data.b[v] = k + } + + q[k] := v if { + data.a[i] = v + data.g[k][j] = v + } + data: + a: + - "1" + - "2" + - "3" + - "4" + b: + v1: hello + v2: goodbye + g: + a: + - "1" + - "0" + - "0" + - "0" + b: + - "0" + - "2" + - "0" + - "0" + c: + - "0" + - "0" + - "0" + - "4" + want_result: + - x: + a: "1" + b: "2" + c: "4" + goodbye: v2 + hello: v1 diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0770.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0770.yaml new file mode 100644 index 0000000000..4bd7b5fdad --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0770.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "disjunction/incr: eval object constant key" + query: data.generated.p = x + modules: + - | + package generated + + p[k] := v if { + data.generated.q[k] = v + } + + q["a"] := 1 + + q["b"] := 2 + data: {} + want_result: + - x: + a: 1 + b: 2 diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0771.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0771.yaml new file mode 100644 index 0000000000..6d23b2a0d8 --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0771.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: "disjunction/complete: undefined" + query: data.generated.p = x + modules: + - | + package generated + + p if { + false + } + + p if { + false + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0772.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0772.yaml new file mode 100644 index 0000000000..f7ad1950eb --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0772.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "disjunction/complete: error" + query: data.generated.p = x + modules: + - | + package generated + + p := true + + p := false if { + false + } + + p := false + data: {} + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0773.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0773.yaml new file mode 100644 index 0000000000..c2fd560379 --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0773.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "disjunction/complete: valid" + query: data.generated.p = x + modules: + - | + package generated + + p := true + + p := true + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0774.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0774.yaml new file mode 100644 index 0000000000..6aead68e84 --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0774.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "disjunction/complete: valid-2" + query: data.generated.p = x + modules: + - | + package generated + + p := true + + p := false if { + false + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0775.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0775.yaml new file mode 100644 index 0000000000..da8bf2cd7a --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0775.yaml @@ -0,0 +1,208 @@ +--- +cases: + - note: "disjunction/complete: reference error" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q + } + + q := true + + q := false + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs + - note: "disjunction/complete: nested conflict, else" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q + } + + q if { + false + } + + else := true + + q if { + false + } + + else := false + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs + - note: disjunction/nested function with conflict + query: data.test.p = x + modules: + - | + package test + + p if { + x := data.test.q(1) + x == true + } + + q(_) := true + + q(_) := false + want_error_code: eval_conflict_error + want_error: functions must not produce multiple outputs for same inputs + - note: disjunction/nested function with conflict, else + query: data.test.p = x + modules: + - | + package test + + p if { + x := data.test.q(1) + } + + q(_) if { + false + } + + else := true + + q(_) if { + false + } + + else := false + want_error_code: eval_conflict_error + want_error: functions must not produce multiple outputs for same inputs + - note: "disjunction/complete: conflict involving early-exit complete rule (set enumeration)" + query: data.test.p = x + modules: + - | + package test + + p if { + q + } + + xs := {1, 2} + + q := xs[_] + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs + - note: "disjunction/complete: conflict involving early-exit complete rule (array enumeration)" + query: data.test.p = x + modules: + - | + package test + + p if { + q + } + + xs := [1, 2] + + q := xs[_] + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs + - note: "disjunction/complete: conflict involving early-exit complete rule (object enumeration)" + query: data.test.p = x + modules: + - | + package test + + p if { + q + } + + xs := {"a": 1, "b": 2} + + q := xs[_] + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs + - note: "disjunction/complete: conflict involving early-exit partial rule" + query: data.test.p = x + modules: + - | + package test + + p if { + q + } + + xs := {1, 2} + + q[y] := x if { + x := xs[_] + y := 1 + } + want_error_code: eval_conflict_error + want_error: object keys must be unique + - note: "disjunction/complete: conflict involving early-exit complete rule, else" + query: data.test.p = x + modules: + - | + package test + + p if { + q + } + + xs := {1, 2} + + q := false if { + false + } else := xs[_] + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs + - note: "disjunction/complete: conflict involving early-exit complete rule, multiple" + query: data.test.p = x + modules: + - | + package test + + p if { + q + } + + xs := {1, 2} + + q := xs[_] + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs + - note: "disjunction/complete: conflict involving early-exit complete rule, data array enumeration" + query: data.test.p = x + modules: + - | + package test + + p if { + q + } + + q := data.arr[_] + data: + arr: + - "1" + - "2" + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs + - note: "disjunction/complete: conflict involving early-exit complete rule, data object enumeration" + query: data.test.p = x + modules: + - | + package test + + p if { + q + } + + q := data.obj[_] + data: + obj: + a: "1" + b: "2" + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs diff --git a/test/cases/testdata/v1/disjunction/test-disjunction-0776.yaml b/test/cases/testdata/v1/disjunction/test-disjunction-0776.yaml new file mode 100644 index 0000000000..1c80ebd7fa --- /dev/null +++ b/test/cases/testdata/v1/disjunction/test-disjunction-0776.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "disjunction/complete: reference valid" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q + } + + q := true + + q := true + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1054.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1054.yaml new file mode 100644 index 0000000000..480d1a1f97 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1054.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: elsekeyword/no-op + query: data.ex.no_op = x + modules: + - | + package ex + + no_op if { + true + } else := false + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1055.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1055.yaml new file mode 100644 index 0000000000..9ff0d31656 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1055.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: elsekeyword/trivial + query: data.ex.bool = x + modules: + - | + package ex + + bool if { + false + } else := true + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1056.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1056.yaml new file mode 100644 index 0000000000..1e0b1dceb1 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1056.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: elsekeyword/trivial-non-bool + query: data.ex.non_bool = x + modules: + - | + package ex + + non_bool := null if { + false + } else := [100] + data: {} + want_result: + - x: + - 100 diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1057.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1057.yaml new file mode 100644 index 0000000000..19b889d785 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1057.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: elsekeyword/trivial-3 + query: data.ex.triple = x + modules: + - | + package ex + + triple if { + false + } else if { + false + } else := "hello" + data: {} + want_result: + - x: hello diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1058.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1058.yaml new file mode 100644 index 0000000000..84ceb34b0c --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1058.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: elsekeyword/var-head + query: data.ex.vars = x + modules: + - | + package ex + + vars if { + false + } else := ["hello", x] if { + data.b.v2 = x + } + data: + a: + - "1" + - "2" + - "3" + - "4" + b: + v1: hello + v2: goodbye + want_result: + - x: + - hello + - goodbye diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1059.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1059.yaml new file mode 100644 index 0000000000..af20775e34 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1059.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: elsekeyword/ref-head + query: data.ex.refs = x + modules: + - | + package ex + + refs if { + false + } else := __local6__ if { + true + __local7__ = data.b.v2 + __local6__ = ["hello", __local7__] + } + data: + a: + - "1" + - "2" + - "3" + - "4" + b: + v1: hello + v2: goodbye + want_result: + - x: + - hello + - goodbye diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1060.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1060.yaml new file mode 100644 index 0000000000..d1bca9bea7 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1060.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: elsekeyword/first-match + query: data.ex.multiple_defined = x + modules: + - | + package ex + + multiple_defined := false if { + false + } else if { + true + } else := false + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1061.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1061.yaml new file mode 100644 index 0000000000..05fce710a2 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1061.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: elsekeyword/default-1 + query: data.ex.default_1 = x + modules: + - | + package ex + + default default_1 := 1 + + default_1 if { + false + } + + default_1 := 2 + data: {} + want_result: + - x: 2 diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1062.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1062.yaml new file mode 100644 index 0000000000..9506a81290 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1062.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: elsekeyword/default-2 + query: data.ex.default_2 = x + modules: + - | + package ex + + default default_2 := 2 + + default_2 if { + false + } + + default_2 := 1 if { + false + } + data: {} + want_result: + - x: 2 diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1063.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1063.yaml new file mode 100644 index 0000000000..c846e888e6 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1063.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: elsekeyword/multiple-roots + query: data.ex.multiple_roots = x + modules: + - | + package ex + + multiple_roots if { + false + } else := 1 if { + false + } else := 2 if { + true + } else := 3 + + multiple_roots := 2 + + multiple_roots := 3 if { + false + } else := 2 + data: {} + want_result: + - x: 2 diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1064.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1064.yaml new file mode 100644 index 0000000000..5c4e2e9268 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1064.yaml @@ -0,0 +1,34 @@ +--- +cases: + - note: elsekeyword/indexed + query: data.ex.indexed = x + modules: + - | + package ex + + indexed if { + data.a[0] = 0 + } else := 2 if { + data.a[0] = 1 + } else := 3 if { + data.a[0] = 1 + } + + indexed if { + data.a[0] = 1 + data.a[2] = 2 + } else if { + false + } else := 2 if { + data.a[0] = x + x = 1 + data.a[2] = 3 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: 2 diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1065.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1065.yaml new file mode 100644 index 0000000000..4184394b9f --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1065.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: elsekeyword/conflict-1 + query: data.ex.conflict_1 = x + modules: + - | + package ex + + conflict_1 if { + false + } else := true + + conflict_1 := false + data: {} + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1066.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1066.yaml new file mode 100644 index 0000000000..5c715eb0a6 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1066.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: elsekeyword/conflict-2 + query: data.ex.conflict_2 = x + modules: + - | + package ex + + conflict_2 if { + false + } + + else := false + + conflict_2 if { + false + } + + else := true + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs diff --git a/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1067.yaml b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1067.yaml new file mode 100644 index 0000000000..dc222ac716 --- /dev/null +++ b/test/cases/testdata/v1/elsekeyword/test-elsekeyword-1067.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: elsekeyword/functions + query: data.ex.fn_result = x + modules: + - | + package ex + + fn_result := [x, y, z] if { + data.ex.fn(101, true, x) + data.ex.fn(100, true, y) + data.ex.fn(100, false, z) + } + + fn(x, y) := "large" if { + x > 100 + } else := "small" if { + y = true + } else := "medium" + data: {} + want_result: + - x: + - large + - small + - medium diff --git a/test/cases/testdata/v1/embeddedvirtualdoc/test-embeddedvirtualdoc-0976.yaml b/test/cases/testdata/v1/embeddedvirtualdoc/test-embeddedvirtualdoc-0976.yaml new file mode 100644 index 0000000000..a935e4ffc2 --- /dev/null +++ b/test/cases/testdata/v1/embeddedvirtualdoc/test-embeddedvirtualdoc-0976.yaml @@ -0,0 +1,45 @@ +--- +cases: + - note: embeddedvirtualdoc/deep embedded vdoc + query: data.b.c.d.p = x + modules: + - | + package b.c.d + + p contains x if { + data.a[i] = x + data.b.c.d.q[x] + } + + q contains x if { + data.g[j][k] = x + } + data: + a: + - "1" + - "2" + - "3" + - "4" + g: + a: + - "1" + - "0" + - "0" + - "0" + b: + - "0" + - "2" + - "0" + - "0" + c: + - "0" + - "0" + - "0" + - "4" + input_term: "{}" + want_result: + - x: + - "1" + - "2" + - "4" + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0545.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0545.yaml new file mode 100644 index 0000000000..fc69e14ccf --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0545.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "eqexpr/undefined: same type" + query: data.generated.p = x + modules: + - | + package generated + + p if { + true = false + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0546.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0546.yaml new file mode 100644 index 0000000000..970b2acd40 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0546.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "eqexpr/undefined: array order" + query: data.generated.p = x + modules: + - | + package generated + + p if { + [1, 2, 3] = [1, 3, 2] + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0547.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0547.yaml new file mode 100644 index 0000000000..7c6f967058 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0547.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "eqexpr/undefined: ref value" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[3] = 9999 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0548.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0548.yaml new file mode 100644 index 0000000000..6b55a7db37 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0548.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "eqexpr/undefined: ref values" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[i] = 9999 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0549.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0549.yaml new file mode 100644 index 0000000000..c14d06dd03 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0549.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: "eqexpr/undefined: ground var" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[3] = x + x = 3 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0550.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0550.yaml new file mode 100644 index 0000000000..2cb17de750 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0550.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "eqexpr/undefined: array var 1" + query: data.generated.p = x + modules: + - | + package generated + + p if { + [1, x, x] = [1, 2, 3] + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0551.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0551.yaml new file mode 100644 index 0000000000..e89495ee88 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0551.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "eqexpr/undefined: array var 2" + query: data.generated.p = x + modules: + - | + package generated + + p if { + [1, x, 3] = [1, 2, x] + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0552.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0552.yaml new file mode 100644 index 0000000000..40815a366d --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0552.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "eqexpr/undefined: object var 1" + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.a + __local1__ = data.a + {"a": 1, "b": 2} = {"a": __local0__, "b": __local1__} + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0553.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0553.yaml new file mode 100644 index 0000000000..a25ad359ff --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0553.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "eqexpr/undefined: array deep var 1" + query: data.generated.p = x + modules: + - | + package generated + + p if { + [[1, x], [3, x]] = [[1, 2], [3, 4]] + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0554.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0554.yaml new file mode 100644 index 0000000000..2313d80278 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0554.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "eqexpr/undefined: array deep var 2" + query: data.generated.p = x + modules: + - | + package generated + + p if { + [[1, x], [3, 4]] = [[1, 2], [x, 4]] + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0555.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0555.yaml new file mode 100644 index 0000000000..7c3f2c19af --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0555.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "eqexpr/undefined: set" + query: data.generated.p = x + modules: + - | + package generated + + p if { + {1, 2, 3} = {1, 2, 4} + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0556.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0556.yaml new file mode 100644 index 0000000000..86ffb11a09 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0556.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "eqexpr/ground: bool" + query: data.generated.p = x + modules: + - | + package generated + + p if { + true = true + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0557.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0557.yaml new file mode 100644 index 0000000000..a91013e649 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0557.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "eqexpr/ground: string" + query: data.generated.p = x + modules: + - | + package generated + + p if { + "string" = "string" + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0558.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0558.yaml new file mode 100644 index 0000000000..7ef36aabfc --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0558.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "eqexpr/ground: number" + query: data.generated.p = x + modules: + - | + package generated + + p if { + 17 = 17 + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0559.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0559.yaml new file mode 100644 index 0000000000..b4ea68dfce --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0559.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "eqexpr/ground: null" + query: data.generated.p = x + modules: + - | + package generated + + p if { + null = null + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0560.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0560.yaml new file mode 100644 index 0000000000..5d358f1826 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0560.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "eqexpr/ground: array" + query: data.generated.p = x + modules: + - | + package generated + + p if { + [1, 2, 3] = [1, 2, 3] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0561.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0561.yaml new file mode 100644 index 0000000000..6238c8436f --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0561.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "eqexpr/ground: set" + query: data.generated.p = x + modules: + - | + package generated + + p if { + {1, 2, 3} = {1, 2, 3} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0562.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0562.yaml new file mode 100644 index 0000000000..6ed349f7ec --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0562.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "eqexpr/ground: object" + query: data.generated.p = x + modules: + - | + package generated + + p if { + {"a": [1, 2, 3], "b": false} = {"a": [1, 2, 3], "b": false} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0563.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0563.yaml new file mode 100644 index 0000000000..a249db2414 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0563.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: "eqexpr/ground: ref 1" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[2] = 3 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0564.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0564.yaml new file mode 100644 index 0000000000..88ec1f234c --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0564.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "eqexpr/ground: ref 2" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.b.v2 = "goodbye" + } + data: + b: + v2: goodbye + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0565.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0565.yaml new file mode 100644 index 0000000000..7fcd4d71f4 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0565.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "eqexpr/ground: ref 3" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.d.e = ["bar", "baz"] + } + data: + d: + e: + - bar + - baz + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0566.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0566.yaml new file mode 100644 index 0000000000..8efa46908b --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0566.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "eqexpr/ground: ref 4" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.c[0].x[1] = data.c[0].z.q + } + data: + c: + - "true": + - null + - 3.1415 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0567.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0567.yaml new file mode 100644 index 0000000000..bdf5962468 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0567.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "eqexpr/var: x=y=z" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + z = 42 + y = z + x = y + } + data: {} + want_result: + - x: + - 42 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0568.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0568.yaml new file mode 100644 index 0000000000..47e5879be5 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0568.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "eqexpr/var: ref value" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[3] = x + x = 4 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0569.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0569.yaml new file mode 100644 index 0000000000..6ad291f516 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0569.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "eqexpr/var: ref values" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[i] = x + x = 2 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0570.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0570.yaml new file mode 100644 index 0000000000..aed93ececc --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0570.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "eqexpr/var: ref key" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[i] = 4 + x = 3 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0571.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0571.yaml new file mode 100644 index 0000000000..8da9c1abb1 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0571.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "eqexpr/var: ref keys" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[i] = x + i = 2 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0572.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0572.yaml new file mode 100644 index 0000000000..7333bae404 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0572.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "eqexpr/var: ref ground var" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + i = 2 + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0573.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0573.yaml new file mode 100644 index 0000000000..c52be467f8 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0573.yaml @@ -0,0 +1,31 @@ +--- +cases: + - note: "eqexpr/var: ref ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.c[0].x[i] = data.c[0].z[j] + x = [i, j] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - - 0 + - p + - - 1 + - q + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0574.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0574.yaml new file mode 100644 index 0000000000..013929d730 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0574.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "eqexpr/pattern: array" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + [1, x, 3] = [1, 2, 3] + } + data: {} + want_result: + - x: + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0575.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0575.yaml new file mode 100644 index 0000000000..92b7a71fdb --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0575.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "eqexpr/pattern: array 2" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + [[1, x], [3, 4]] = [[1, 2], [3, 4]] + } + data: {} + want_result: + - x: + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0576.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0576.yaml new file mode 100644 index 0000000000..d09d77062f --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0576.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "eqexpr/pattern: array same var" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + [2, x, 3] = [x, 2, 3] + } + data: {} + want_result: + - x: + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0577.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0577.yaml new file mode 100644 index 0000000000..2f38989577 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0577.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "eqexpr/pattern: array multiple vars" + query: data.generated.p = x + modules: + - | + package generated + + p contains z if { + [1, x, y] = [1, 2, 3] + z = [x, y] + } + data: {} + want_result: + - x: + - - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0578.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0578.yaml new file mode 100644 index 0000000000..f356cb1517 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0578.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "eqexpr/pattern: array multiple vars 2" + query: data.generated.p = x + modules: + - | + package generated + + p contains z if { + [1, x, 3] = [y, 2, 3] + z = [x, y] + } + data: {} + want_result: + - x: + - - 2 + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0579.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0579.yaml new file mode 100644 index 0000000000..79a9969d9c --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0579.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "eqexpr/pattern: array ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.a[0] + __local1__ = data.a[1] + __local2__ = data.a[2] + __local3__ = data.a[3] + [1, 2, 3, x] = [__local0__, __local1__, __local2__, __local3__] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0580.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0580.yaml new file mode 100644 index 0000000000..0ec923f5d9 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0580.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: "eqexpr/pattern: array non-ground ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.a[0] + __local1__ = data.a[1] + __local2__ = data.a[2] + __local3__ = data.a[i] + [1, 2, 3, x] = [__local0__, __local1__, __local2__, __local3__] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0581.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0581.yaml new file mode 100644 index 0000000000..9c317f7282 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0581.yaml @@ -0,0 +1,27 @@ +--- +cases: + - note: "eqexpr/pattern: array = ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + [true, false, x] = data.c[i][j] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - foo + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0582.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0582.yaml new file mode 100644 index 0000000000..f31dd61088 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0582.yaml @@ -0,0 +1,27 @@ +--- +cases: + - note: "eqexpr/pattern: array = ref (reversed)" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.c[i][j] = [true, false, x] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - foo + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0583.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0583.yaml new file mode 100644 index 0000000000..7dd7b7c60f --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0583.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: "eqexpr/pattern: array = var" + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + x = 3 + [1, 2, x] = y + } + data: {} + want_result: + - x: + - - 1 + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0584.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0584.yaml new file mode 100644 index 0000000000..cef4989911 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0584.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "eqexpr/pattern: object val" + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + {"x": y} = {"x": "y"} + } + data: {} + want_result: + - x: + - "y" + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0585.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0585.yaml new file mode 100644 index 0000000000..a08ba102da --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0585.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "eqexpr/pattern: object same var" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + {"x": x, "y": x} = {"x": 1, "y": 1} + } + data: {} + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0586.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0586.yaml new file mode 100644 index 0000000000..e259e72f5b --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0586.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "eqexpr/pattern: object multiple vars" + query: data.generated.p = x + modules: + - | + package generated + + p contains z if { + {"x": x, "y": y} = {"x": 1, "y": 2} + z = [x, y] + } + data: {} + want_result: + - x: + - - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0587.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0587.yaml new file mode 100644 index 0000000000..3b83c43ecc --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0587.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "eqexpr/pattern: object multiple vars 2" + query: data.generated.p = x + modules: + - | + package generated + + p contains z if { + {"x": x, "y": 2} = {"x": 1, "y": y} + z = [x, y] + } + data: {} + want_result: + - x: + - - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0588.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0588.yaml new file mode 100644 index 0000000000..e98e387137 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0588.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: "eqexpr/pattern: object ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.c[0].x[0] + {"p": __local0__, "q": x} = data.c[i][j] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0589.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0589.yaml new file mode 100644 index 0000000000..788f21f9be --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0589.yaml @@ -0,0 +1,30 @@ +--- +cases: + - note: "eqexpr/pattern: object non-ground ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.c[0].x[i] + {"a": 1, "b": x} = {"a": 1, "b": __local0__} + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - false + - true + - foo + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0590.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0590.yaml new file mode 100644 index 0000000000..071bd6be85 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0590.yaml @@ -0,0 +1,31 @@ +--- +cases: + - note: "eqexpr/pattern: object = ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + {"p": y, "q": z} = data.c[i][j] + x = [i, j, y, z] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - - 0 + - z + - true + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0591.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0591.yaml new file mode 100644 index 0000000000..193006963e --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0591.yaml @@ -0,0 +1,31 @@ +--- +cases: + - note: "eqexpr/pattern: object = ref (reversed)" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.c[i][j] = {"p": y, "q": z} + x = [i, j, y, z] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - - 0 + - z + - true + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0592.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0592.yaml new file mode 100644 index 0000000000..b1dcecc87f --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0592.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "eqexpr/pattern: object = var" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + y = 2 + {"a": 1, "b": y} = x + } + data: {} + want_result: + - x: + - a: 1 + b: 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0593.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0593.yaml new file mode 100644 index 0000000000..f35e87295e --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0593.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "eqexpr/pattern: object/array nested" + query: data.generated.p = x + modules: + - | + package generated + + p contains ys if { + data.f[i] = {"xs": [2], "ys": ys} + } + data: + f: + - xs: + - 1 + ys: + - 2 + - xs: + - 2 + ys: + - 3 + want_result: + - x: + - - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0594.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0594.yaml new file mode 100644 index 0000000000..1e0171348e --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0594.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: "eqexpr/pattern: object/array nested 2" + query: data.generated.p = x + modules: + - | + package generated + + p contains v if { + data.f[i] = {"xs": [x], "ys": [y]} + v = [x, y] + } + data: + f: + - xs: + - 1 + ys: + - 2 + - xs: + - 2 + ys: + - 3 + want_result: + - x: + - - 1 + - 2 + - - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0595.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0595.yaml new file mode 100644 index 0000000000..ec6ee0dab6 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0595.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: "eqexpr/unordered: sets" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + x = 2 + {1, 3, x} = {1, 2, 3} + } + data: {} + want_result: + - x: + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0596.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0596.yaml new file mode 100644 index 0000000000..a9a85518f2 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0596.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: "eqexpr/unordered: object keys" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + x = "a" + {x: 1} = {"a": 1} + } + want_result: + - x: + - a diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0597.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0597.yaml new file mode 100644 index 0000000000..1c7f29da7c --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0597.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: "eqexpr/unordered: object keys (reverse)" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + x = "a" + {"a": 1} = {x: 1} + } + data: {} + want_result: + - x: + - a + sort_bindings: true diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0598.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0598.yaml new file mode 100644 index 0000000000..93fcced60f --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0598.yaml @@ -0,0 +1,34 @@ +--- +cases: + - note: "eqexpr/indexing: intersection" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[i] = data.g[i][j] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + g: + a: + - 1 + - 0 + - 0 + - 0 + b: + - 0 + - 2 + - 0 + - 0 + c: + - 0 + - 0 + - 0 + - 4 + want_result: [] diff --git a/test/cases/testdata/v1/eqexpr/test-eqexpr-0599.yaml b/test/cases/testdata/v1/eqexpr/test-eqexpr-0599.yaml new file mode 100644 index 0000000000..e637b9dd23 --- /dev/null +++ b/test/cases/testdata/v1/eqexpr/test-eqexpr-0599.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "eqexpr/indexing: input is 1.0" + query: data.test.p = x + modules: + - | + package test + + p if input == 1.0 + input_term: "1.0" + want_result: + - x: true + - note: "eqexpr/indexing: input is 1" + query: data.test.p = x + modules: + - | + package test + + p if input == 1.0 + input_term: "1" + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0525.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0525.yaml new file mode 100644 index 0000000000..6438e1130d --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0525.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: evaltermexpr/true + query: data.generated.p = x + modules: + - | + package generated + + p := true + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0526.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0526.yaml new file mode 100644 index 0000000000..7d226a2792 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0526.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: evaltermexpr/false + query: data.generated.p = x + modules: + - | + package generated + + p if { + false + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0527.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0527.yaml new file mode 100644 index 0000000000..3a4ebd2b70 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0527.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/number non-zero + query: data.generated.p = x + modules: + - | + package generated + + p if { + -3.14 + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0528.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0528.yaml new file mode 100644 index 0000000000..33b41ae3ff --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0528.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/number zero + query: data.generated.p = x + modules: + - | + package generated + + p if { + null + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0529.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0529.yaml new file mode 100644 index 0000000000..bed461cac5 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0529.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/null + query: data.generated.p = x + modules: + - | + package generated + + p if { + null + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0530.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0530.yaml new file mode 100644 index 0000000000..4d80cdbae6 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0530.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/string non-empty + query: data.generated.p = x + modules: + - | + package generated + + p if { + "abc" + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0531.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0531.yaml new file mode 100644 index 0000000000..2febd007d9 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0531.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/string empty + query: data.generated.p = x + modules: + - | + package generated + + p if { + "" + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0532.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0532.yaml new file mode 100644 index 0000000000..c3abc40479 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0532.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/array non-empty + query: data.generated.p = x + modules: + - | + package generated + + p if { + [1, 2, 3] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0533.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0533.yaml new file mode 100644 index 0000000000..e81e8fd8b7 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0533.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/array empty + query: data.generated.p = x + modules: + - | + package generated + + p if { + [] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0534.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0534.yaml new file mode 100644 index 0000000000..470d9c5a1e --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0534.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/object non-empty + query: data.generated.p = x + modules: + - | + package generated + + p if { + {"a": 1} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0535.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0535.yaml new file mode 100644 index 0000000000..a00c217293 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0535.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/object empty + query: data.generated.p = x + modules: + - | + package generated + + p if { + {} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0536.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0536.yaml new file mode 100644 index 0000000000..57d63af160 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0536.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/set non-empty + query: data.generated.p = x + modules: + - | + package generated + + p if { + {1, 2, 3} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0537.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0537.yaml new file mode 100644 index 0000000000..ae7b07e6bd --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0537.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/set empty + query: data.generated.p = x + modules: + - | + package generated + + p if { + set() + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0538.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0538.yaml new file mode 100644 index 0000000000..af41407d7a --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0538.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: evaltermexpr/ref + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[i] + } + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0539.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0539.yaml new file mode 100644 index 0000000000..37081d880e --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0539.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: evaltermexpr/ref undefined + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.deadbeef[i] + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0540.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0540.yaml new file mode 100644 index 0000000000..6bcb307c66 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0540.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: evaltermexpr/ref undefined (path) + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[true] + } + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: [] diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0541.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0541.yaml new file mode 100644 index 0000000000..734b22393f --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0541.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: evaltermexpr/ref false + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.c[0].x[1] + } + data: + c: + - "true": + - null + - "3.14159" + x: + - true + - false + - foo + z: + p: true + q: false + want_result: [] diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0542.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0542.yaml new file mode 100644 index 0000000000..9f936c76d8 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0542.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/array comprehension + query: data.generated.p = x + modules: + - | + package generated + + p if { + [x | x = 1] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0543.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0543.yaml new file mode 100644 index 0000000000..d272fdaa01 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0543.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: evaltermexpr/array comprehension empty + query: data.generated.p = x + modules: + - | + package generated + + p if { + [x | x = 1; x = 2] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0544.yaml b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0544.yaml new file mode 100644 index 0000000000..5726b0cc92 --- /dev/null +++ b/test/cases/testdata/v1/evaltermexpr/test-evaltermexpr-0544.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: evaltermexpr/arbitrary position + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a[i] = x + x + i + } + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: true diff --git a/test/cases/testdata/v1/every/every.yaml b/test/cases/testdata/v1/every/every.yaml new file mode 100644 index 0000000000..db4debaadb --- /dev/null +++ b/test/cases/testdata/v1/every/every.yaml @@ -0,0 +1,212 @@ +--- +cases: + - note: every/empty domain (array) + query: data.test.p = x + modules: + - | + package test + + p if { + every x in [] { x != x } + } + want_result: + - x: true + - note: every/empty domain (set) + query: data.test.p = x + modules: + - | + package test + + p if { + every x in set() { x != x } + } + want_result: + - x: true + - note: every/empty domain (object) + query: data.test.p = x + modules: + - | + package test + + p if { + every x in {} { x != x } + } + want_result: + - x: true + - note: every/empty domain (partial rule ref) + query: data.test.p = x + modules: + - | + package test + + l contains 1 if { + false + } + + p if { + every x in l { x != x } + } + want_result: + - x: true + - note: every/domain undefined (input) + query: data.test.p = x + modules: + - | + package test + + p if { + every _ in input { true } + } + want_result: [] + - note: every/domain undefined (data ref) + query: data.test.p = x + modules: + - | + package test + + p if { + every _ in data.foo { true } + } + want_result: [] + - note: every/domain is call + query: data.test.p = x + modules: + - | + package test + + p if { + every x in numbers.range(1, 10) { x >= 1 } + } + want_result: + - x: true + - note: every/simple key/val + query: data.test.p = x + modules: + - | + package test + + p if { + every k, v in [1, 2] { k + 1 == v } + } + want_result: + - x: true + - note: every/simple key/val (set) + query: data.test.p = x + modules: + - | + package test + + p if { + every k, v in {1, 2} { k == v } + } + want_result: + - x: true + - note: every/simple key/val (partial rule ref) + query: data.test.p = x + modules: + - | + package test + + l contains 1 + + l contains 2 + + p if { + every k, v in l { k == v } + } + want_result: + - x: true + - note: every/outer bindings + query: data.test.p = x + modules: + - | + package test + + p if { + i := 10 + every k, v in [1, 2] { k + v != i } + } + want_result: + - x: true + - note: every/simple failure, first + query: data.test.p = x + modules: + - | + package test + + p if { + every v in [1, 2] { v != 1 } + } + want_result: [] + - note: every/simple failure, last + query: data.test.p = x + modules: + - | + package test + + p if { + every v in [1, 2] { v != 2 } + } + want_result: [] + - note: "every/with: domain" + query: data.test.p = x + modules: + - | + package test + + p if { + every v in input { v == 1 } with input as [1, 1, 1] + } + want_result: + - x: true + - note: "every/with: body" + query: data.test.p = x + modules: + - | + package test + + p if { + every v in [1, 2] { v in input } with input as [1, 2, 1, 0] + } + want_result: + - x: true + - note: every/followed by another query + query: data.test.p = x + modules: + - | + package test + + p contains v if { + every v in [1, 2] { v < 3 } + v := 10 + v > 3 + } + want_result: + - x: + - 10 + - note: every/array with calls + query: data.test.p = x + modules: + - | + package test + + p if { + every v in [1 / 2, 3, 4 + 5] { v < 10 } + } + want_result: + - x: true + - note: every/array with calls (fail) + query: data.test.q = x + modules: + - | + package test + + p if { + every v in [1 / 2, 3, 4 + 5] { v < 9 } + } + + q if { + not p + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/every/non_iterable_domain.yaml b/test/cases/testdata/v1/every/non_iterable_domain.yaml new file mode 100644 index 0000000000..3a1cf51e80 --- /dev/null +++ b/test/cases/testdata/v1/every/non_iterable_domain.yaml @@ -0,0 +1,141 @@ +--- +cases: + - note: "every/non-iter domain: int" + query: data.test.p = x + modules: + - | + package test + + default p := 1 + + p := 2 if { + every v in 42 { v > 1 } + } + want_result: + - x: 1 + - note: "every/non-iter domain: string" + query: data.test.p = x + modules: + - | + package test + + default p := 1 + + p := 2 if { + every v in "foobar" { v > 1 } + } + want_result: + - x: 1 + - note: "every/non-iter domain: bool" + query: data.test.p = x + modules: + - | + package test + + default p := 1 + + p := 2 if { + every v in true { v > 1 } + } + want_result: + - x: 1 + - note: "every/non-iter domain: null" + query: data.test.p = x + modules: + - | + package test + + default p := 1 + + p := 2 if { + every v in null { v > 1 } + } + want_result: + - x: 1 + - note: "every/non-iter domain: built-in call" + query: data.test.p = x + modules: + - | + package test + + default p := 1 + + p := 2 if { + every v in floor(13.37) { v > 1 } + } + want_result: + - x: 1 + - note: "every/non-iter domain: function call" + query: data.test.p = x + modules: + - | + package test + + default p := 1 + + p := 2 if { + every v in foo(1, 2) { v > 1 } + } + + foo(a, b) := a + b + want_result: + - x: 1 + - note: "every/non-iter domain: rule ref" + query: data.test.p = x + modules: + - | + package test + + default p := 1 + + p := 2 if { + every v in q { v > 1 } + } + + q := 1 + want_result: + - x: 1 + - note: "every/non-iter domain: data int" + query: data.test.p = x + modules: + - | + package test + + default p := 1 + + p := 2 if { + every v in data.iterate_me { v > 1 } + } + data: + iterate_me: 1 + want_result: + - x: 1 + - note: "every/non-iter domain: input int" + query: data.test.p = x + modules: + - | + package test + + default p := 1 + + p := 2 if { + every v in input.iterate_me { v > 1 } + } + input: + iterate_me: 1 + want_result: + - x: 1 + - note: "every/non-iter domain: input int (1st level)" + query: data.test.p = x + modules: + - | + package test + + default p := 1 + + p := 2 if { + every v in input { v > 1 } + } + input: 1 + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/every/textbook.yaml b/test/cases/testdata/v1/every/textbook.yaml new file mode 100644 index 0000000000..b67ebdb14e --- /dev/null +++ b/test/cases/testdata/v1/every/textbook.yaml @@ -0,0 +1,138 @@ +--- +cases: + - note: every/example, fail + query: data.test.p = x + modules: + - | + package test + + p if { + every x in input.containers { + startswith(x.image, "acmecorp.com/") + } + } + input: + containers: + - image: bitcoin-miner + - image: acmecorp.com/webapp + want_result: [] + - note: every/example, success + query: data.test.p = x + modules: + - | + package test + + p if { + every x in input.containers { + startswith(x.image, "acmecorp.com/") + } + } + input: + containers: + - image: acmecorp.com/bitcoin-miner + - image: acmecorp.com/webapp + want_result: + - x: true + - note: every/example with two sets + query: data.test.p = x + modules: + - | + package test + + p if { + containers := {c | c := input.containers[_]} + init_containers := {c | c := input.init_containers[_]} + every x in containers | init_containers { + startswith(x.image, "acmecorp.com/") + } + } + input: + containers: + - image: acmecorp.com/bitcoin-miner + - image: acmecorp.com/webapp + init_containers: + - image: acmecorp.com/bitcoin-miner + want_result: + - x: true + - note: every/example with two sets (fail) + query: data.test.p = x + modules: + - | + package test + + p if { + containers := {c | c := input.containers[_]} + init_containers := {c | c := input.init_containers[_]} + every x in containers | init_containers { + startswith(x.image, "acmecorp.com/") + } + } + input: + containers: + - image: acmecorp.com/bitcoin-miner + - image: acmecorp.com/webapp + init_containers: + - image: bitcoin-miner + want_result: [] + - note: every/example every/some, fail + query: data.test.p = x + modules: + - | + package test + + allowed_repos := {"hooli.com/", "acmecorp.net/"} + + p if { + every c in input.containers { + some repo in allowed_repos + startswith(c.image, repo) + } + } + input: + containers: + - image: hooli.com/bitcoin-miner + - image: acmecorp.net/webapp + - image: nginx + want_result: [] + - note: every/example every/some, success + query: data.test.p = x + modules: + - | + package test + + allowed_repos := {"hooli.com/", "acmecorp.net/"} + + p if { + every c in input.containers { + some repo in allowed_repos + startswith(c.image, repo) + } + } + input: + containers: + - image: hooli.com/bitcoin-miner + - image: acmecorp.net/webapp + - image: hooli.com/nginx + want_result: + - x: true + - note: every/example some/every + query: data.test.deny = x + modules: + - | + package test + + deny if { + some s in input.servers + every port in s.ports { + port != 443 + } + } + input: + servers: + - ports: + - "80" + - "443" + - ports: + - "80" + want_result: + - x: true diff --git a/test/cases/testdata/v1/example/test-example-1070.yaml b/test/cases/testdata/v1/example/test-example-1070.yaml new file mode 100644 index 0000000000..5aedf7794b --- /dev/null +++ b/test/cases/testdata/v1/example/test-example-1070.yaml @@ -0,0 +1,88 @@ +--- +cases: + - note: example/public servers + query: data.opa.example.public_servers = x + modules: + - | + package opa.example + + public_servers contains server if { + server = data.servers[_] + server.ports[_] = data.ports[i].id + data.ports[i].networks[_] = data.networks[j].id + data.networks[j].public = true + } + + violations contains server if { + server = data.servers[_] + server.protocols[_] = "http" + data.opa.example.public_servers[server] + } + data: + networks: + - id: n1 + public: false + - id: n2 + public: false + - id: n3 + public: true + ports: + - id: p1 + networks: + - n1 + - id: p2 + networks: + - n3 + - id: p3 + networks: + - n2 + servers: + - id: s1 + name: app + ports: + - p1 + - p2 + - p3 + protocols: + - https + - ssh + - id: s2 + name: db + ports: + - p3 + protocols: + - mysql + - id: s3 + name: cache + ports: + - p3 + protocols: + - memcache + - http + - id: s4 + name: dev + ports: + - p1 + - p2 + protocols: + - http + input_term: "{}" + want_result: + - x: + - id: s1 + name: app + ports: + - p1 + - p2 + - p3 + protocols: + - https + - ssh + - id: s4 + name: dev + ports: + - p1 + - p2 + protocols: + - http + sort_bindings: true diff --git a/test/cases/testdata/v1/example/test-example-1071.yaml b/test/cases/testdata/v1/example/test-example-1071.yaml new file mode 100644 index 0000000000..7af9c040b6 --- /dev/null +++ b/test/cases/testdata/v1/example/test-example-1071.yaml @@ -0,0 +1,85 @@ +--- +cases: + - note: example/violations + query: data.opa.example.violations = x + modules: + - | + package opa.example + + public_servers contains server if { + server = data.servers[_] + server.ports[_] = data.ports[i].id + data.ports[i].networks[_] = data.networks[j].id + data.networks[j].public = true + } + + violations contains server if { + server = data.servers[_] + server.protocols[_] = "http" + data.opa.example.public_servers[server] + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = {{"id": "s1", "name": "app", "ports": ["p1", "p2", "p3"], "protocols": ["https", "ssh"]}, {"id": "s4", "name": "dev", "ports": ["p1", "p2"], "protocols": ["http"]}} + } + data: + networks: + - id: n1 + public: false + - id: n2 + public: false + - id: n3 + public: true + ports: + - id: p1 + networks: + - n1 + - id: p2 + networks: + - n3 + - id: p3 + networks: + - n2 + servers: + - id: s1 + name: app + ports: + - p1 + - p2 + - p3 + protocols: + - https + - ssh + - id: s2 + name: db + ports: + - p3 + protocols: + - mysql + - id: s3 + name: cache + ports: + - p3 + protocols: + - memcache + - http + - id: s4 + name: dev + ports: + - p1 + - p2 + protocols: + - http + input_term: "{}" + want_result: + - x: + - id: s4 + name: dev + ports: + - p1 + - p2 + protocols: + - http + sort_bindings: true diff --git a/test/cases/testdata/v1/example/test-example-1072.yaml b/test/cases/testdata/v1/example/test-example-1072.yaml new file mode 100644 index 0000000000..52670d0d05 --- /dev/null +++ b/test/cases/testdata/v1/example/test-example-1072.yaml @@ -0,0 +1,102 @@ +--- +cases: + - note: example/both + query: data.opa.example = x + modules: + - | + package opa.example + + public_servers contains server if { + server = data.servers[_] + server.ports[_] = data.ports[i].id + data.ports[i].networks[_] = data.networks[j].id + data.networks[j].public = true + } + + violations contains server if { + server = data.servers[_] + server.protocols[_] = "http" + data.opa.example.public_servers[server] + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = {{"id": "s4", "name": "dev", "ports": ["p1", "p2"], "protocols": ["http"]}} + } + data: + networks: + - id: n1 + public: false + - id: n2 + public: false + - id: n3 + public: true + ports: + - id: p1 + networks: + - n1 + - id: p2 + networks: + - n3 + - id: p3 + networks: + - n2 + servers: + - id: s1 + name: app + ports: + - p1 + - p2 + - p3 + protocols: + - https + - ssh + - id: s2 + name: db + ports: + - p3 + protocols: + - mysql + - id: s3 + name: cache + ports: + - p3 + protocols: + - memcache + - http + - id: s4 + name: dev + ports: + - p1 + - p2 + protocols: + - http + input_term: "{}" + want_result: + - x: + public_servers: + - id: s1 + name: app + ports: + - p1 + - p2 + - p3 + protocols: + - https + - ssh + - id: s4 + name: dev + ports: + - p1 + - p2 + protocols: + - http + violations: + - id: s4 + name: dev + ports: + - p1 + - p2 + protocols: + - http diff --git a/test/cases/testdata/v1/fix1863/test-fix1863-0706.yaml b/test/cases/testdata/v1/fix1863/test-fix1863-0706.yaml new file mode 100644 index 0000000000..f0cb1b3e31 --- /dev/null +++ b/test/cases/testdata/v1/fix1863/test-fix1863-0706.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: fix1863/is defined + query: data = x + modules: + - | + package a.b + + # this module is empty + - | + package x + + p := __local0__ if { # p should be defined (an empty object) + true + __local0__ = data.a.b + } + data: {} + want_result: + - x: + a: + b: {} + x: + p: {} diff --git a/test/cases/testdata/v1/fix1863/test-fix1863-0707.yaml b/test/cases/testdata/v1/fix1863/test-fix1863-0707.yaml new file mode 100644 index 0000000000..1ca629e846 --- /dev/null +++ b/test/cases/testdata/v1/fix1863/test-fix1863-0707.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: fix1863/is defined + query: data.x = x + modules: + - | + package a.b + + # this module is empty + - | + package x + + p := __local0__ if { # p should be defined (an empty object) + true + __local0__ = data.a.b + } + data: {} + want_result: + - x: + p: {} diff --git a/test/cases/testdata/v1/fix1863/test-fix1863-0708.yaml b/test/cases/testdata/v1/fix1863/test-fix1863-0708.yaml new file mode 100644 index 0000000000..4177b561e0 --- /dev/null +++ b/test/cases/testdata/v1/fix1863/test-fix1863-0708.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: fix1863/is defined + query: data.x.p = x + modules: + - | + package a.b + + # this module is empty + - | + package x + + p := __local0__ if { # p should be defined (an empty object) + true + __local0__ = data.a.b + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = {"p": {}} + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/functionerrors/test-conflicts.yaml b/test/cases/testdata/v1/functionerrors/test-conflicts.yaml new file mode 100644 index 0000000000..a55af72471 --- /dev/null +++ b/test/cases/testdata/v1/functionerrors/test-conflicts.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: "functionerrors/conflict: plain false and true result, first round" + query: data.test.p = x + modules: + - | + package test + + o := ["1", "2"] + + f(x) := o[_] == x + + p if f("1") + want_error_code: eval_conflict_error + want_error: functions must not produce multiple outputs for same inputs + - note: "functionerrors/conflict: plain false and true result, second round" + query: data.test.p = x + modules: + - | + package test + + o := ["1", "2"] + + f(x) := o[_] == x + + p if f("2") + want_error_code: eval_conflict_error + want_error: functions must not produce multiple outputs for same inputs diff --git a/test/cases/testdata/v1/functionerrors/test-functionerrors-1012.yaml b/test/cases/testdata/v1/functionerrors/test-functionerrors-1012.yaml new file mode 100644 index 0000000000..48d4247b0f --- /dev/null +++ b/test/cases/testdata/v1/functionerrors/test-functionerrors-1012.yaml @@ -0,0 +1,32 @@ +--- +cases: + - note: functionerrors/function output conflict single + query: data.test1.r = x + modules: + - | + package test1 + + p(a) := y if { + y = a[_] + } + + r := y if { + data.test1.p([1, 2, 3], y) + } + want_error_code: eval_conflict_error + want_error: functions must not produce multiple outputs for same inputs + - note: functionerrors/function output conflict, used as boolean + query: data.test.r = x + modules: + - | + package test + + f(_) := true + + f(_) := false + + r if { + data.test.f(1) + } + want_error_code: eval_conflict_error + want_error: functions must not produce multiple outputs for same inputs diff --git a/test/cases/testdata/v1/functionerrors/test-functionerrors-1013.yaml b/test/cases/testdata/v1/functionerrors/test-functionerrors-1013.yaml new file mode 100644 index 0000000000..4229fb789b --- /dev/null +++ b/test/cases/testdata/v1/functionerrors/test-functionerrors-1013.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: functionerrors/function input no match + query: data.test2.r = x + modules: + - | + package test2 + + p(1, a) := y if { + y = a + } + + p(2, b) := y if { + y = b + 1 + } + + r := y if { + data.test2.p(3, 0, y) + } + want_result: [] diff --git a/test/cases/testdata/v1/functionerrors/test-functionerrors-1014.yaml b/test/cases/testdata/v1/functionerrors/test-functionerrors-1014.yaml new file mode 100644 index 0000000000..41b9e089ea --- /dev/null +++ b/test/cases/testdata/v1/functionerrors/test-functionerrors-1014.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: functionerrors/function output conflict multiple + query: data.test3.r = x + modules: + - | + package test3 + + p(1, a) := y if { + y = a + } + + p(x, y) := z if { + z = x + } + + r := y if { + data.test3.p(1, 0, y) + } + want_error_code: eval_conflict_error + want_error: functions must not produce multiple outputs for same inputs diff --git a/test/cases/testdata/v1/functionerrors/test-functionerrors-undefined-builtin-result.yaml b/test/cases/testdata/v1/functionerrors/test-functionerrors-undefined-builtin-result.yaml new file mode 100644 index 0000000000..2d3429a9f3 --- /dev/null +++ b/test/cases/testdata/v1/functionerrors/test-functionerrors-undefined-builtin-result.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: functionerrors/undefined builtin result + query: data.test = x + modules: + - | + package test + + foo := units.parse_bytes("1KB") + + bar := units.parse_bytes("foo") # undefined + want_result: + - x: + foo: 1000 diff --git a/test/cases/testdata/v1/functions/test-functions-0990.yaml b/test/cases/testdata/v1/functions/test-functions-0990.yaml new file mode 100644 index 0000000000..b2a8730520 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-0990.yaml @@ -0,0 +1,277 @@ +--- +cases: + - note: functions/basic call + query: data.ex.bar.alice = x + modules: + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local20__) := __local20__ + - | + package test.l1.l2 + + p := true + + f(__local21__) := __local21__ + - | + package test.omit_result + + f(__local22__) := __local22__ + + p if { + data.test.omit_result.f(1) + } + - | + package ex + + foo(__local0__) := y if { + split(__local0__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local1__) := y if { + data.ex.foo(__local1__, y) + } + + chain1(__local2__) := b if { + data.ex.chain0(__local2__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local3__) := [a, b] if { + split(__local3__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local4__) := false + + falsy_func_else(__local5__) if { + __local5__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local7__, __local8__]) := [a, b] if { + data.ex.foo(__local7__, a) + data.ex.foo(__local8__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local9__, "bar": __local10__}) := z if { + data.ex.foo(__local9__, a) + data.test.foo(__local10__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local11__) if { + __local11__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local12__) := y if { + y = __local12__ + } + + multi(2, __local13__) := y if { + __local24__ = 2 * __local13__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local14__) := y if { + __local26__ = __local14__ * 10 + y = __local26__ + } + + multi("foo", __local15__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local16__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local17__) := y if { + trim(__local17__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local18__) := y if { + y = __local18__ + } + + multi("bar", __local19__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + data: + a: + - "1" + - "2" + - "3" + - "4" + b: + v1: hello + v2: goodbye + c: + - x: + - true + - false + - foo + "y": + - null + - "3.14159" + z: + p: true + q: false + d: + e: + - bar + - baz + f: + - xs: + - "1" + ys: + - "2" + - xs: + - "2" + ys: + - "3" + g: + a: + - "1" + - "0" + - "0" + - "0" + b: + - "0" + - "2" + - "0" + - "0" + c: + - "0" + - "0" + - "0" + - "4" + h: + - - "1" + - "2" + - "3" + - - "2" + - "3" + - "4" + l: + - a: bob + b: "-1" + c: + - "1" + - "2" + - "3" + - "4" + - a: alice + b: "1" + c: + - "2" + - "3" + - "4" + - "5" + d: null + m: [] + numbers: + - "1" + - "2" + - "3" + - "4" + strings: + bar: "2" + baz: "3" + foo: "1" + three: "3" + want_result: + - x: + - al + - ce diff --git a/test/cases/testdata/v1/functions/test-functions-0991.yaml b/test/cases/testdata/v1/functions/test-functions-0991.yaml new file mode 100644 index 0000000000..40287aed95 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-0991.yaml @@ -0,0 +1,198 @@ +--- +cases: + - note: functions/false result + query: data.ex.falsy_undefined = x + modules: + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local70__) := __local70__ + - | + package test.l1.l2 + + p := true + + f(__local72__) := __local72__ + - | + package test.omit_result + + f(__local74__) := __local74__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = ["al", "ce"] + } + - | + package ex + + foo(__local46__) := y if { + split(__local46__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local47__) := y if { + data.ex.foo(__local47__, y) + } + + chain1(__local48__) := b if { + data.ex.chain0(__local48__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local49__) := [a, b] if { + split(__local49__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local50__) := false + + falsy_func_else(__local51__) if { + __local51__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local53__, __local54__]) := [a, b] if { + data.ex.foo(__local53__, a) + data.ex.foo(__local54__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local55__, "bar": __local56__}) := z if { + data.ex.foo(__local55__, a) + data.test.foo(__local56__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local57__) if { + __local57__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local58__) := y if { + y = __local58__ + } + + multi(2, __local59__) := y if { + __local24__ = 2 * __local59__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local60__) := y if { + __local26__ = __local60__ * 10 + y = __local26__ + } + + multi("foo", __local61__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local62__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local66__) := y if { + trim(__local66__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local67__) := y if { + y = __local67__ + } + + multi("bar", __local68__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/functions/test-functions-0992.yaml b/test/cases/testdata/v1/functions/test-functions-0992.yaml new file mode 100644 index 0000000000..8ef25d9a6d --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-0992.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/false result negation + query: data.ex.falsy_negation = x + modules: + - | + package topdown_test_partial + + __result__ := _result if { + _result = ["al", "ce"] + } + - | + package ex + + foo(__local46__) := y if { + split(__local46__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local47__) := y if { + data.ex.foo(__local47__, y) + } + + chain1(__local48__) := b if { + data.ex.chain0(__local48__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local49__) := [a, b] if { + split(__local49__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local50__) := false + + falsy_func_else(__local51__) if { + __local51__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local53__, __local54__]) := [a, b] if { + data.ex.foo(__local53__, a) + data.ex.foo(__local54__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local55__, "bar": __local56__}) := z if { + data.ex.foo(__local55__, a) + data.test.foo(__local56__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local57__) if { + __local57__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local58__) := y if { + y = __local58__ + } + + multi(2, __local59__) := y if { + __local24__ = 2 * __local59__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local60__) := y if { + __local26__ = __local60__ * 10 + y = __local26__ + } + + multi("foo", __local61__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local62__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local66__) := y if { + trim(__local66__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local67__) := y if { + y = __local67__ + } + + multi("bar", __local68__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local70__) := __local70__ + - | + package test.l1.l2 + + p := true + + f(__local72__) := __local72__ + - | + package test.omit_result + + f(__local74__) := __local74__ + + p if { + data.test.omit_result.f(1) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/functions/test-functions-0993.yaml b/test/cases/testdata/v1/functions/test-functions-0993.yaml new file mode 100644 index 0000000000..3b4f412c9c --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-0993.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/false else value + query: data.ex.falsy_else_value = x + modules: + - | + package topdown_test_partial + + __result__ := _result if { + _result = true + } + - | + package ex + + foo(__local40__) := y if { + split(__local40__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local41__) := y if { + data.ex.foo(__local41__, y) + } + + chain1(__local42__) := b if { + data.ex.chain0(__local42__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local43__) := [a, b] if { + split(__local43__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local44__) := false + + falsy_func_else(__local45__) if { + __local45__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local64__, __local65__]) := [a, b] if { + data.ex.foo(__local64__, a) + data.ex.foo(__local65__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local69__, "bar": __local71__}) := z if { + data.ex.foo(__local69__, a) + data.test.foo(__local71__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local73__) if { + __local73__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local75__) := y if { + y = __local75__ + } + + multi(2, __local76__) := y if { + __local24__ = 2 * __local76__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local77__) := y if { + __local26__ = __local77__ * 10 + y = __local26__ + } + + multi("foo", __local78__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local79__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local86__) := y if { + trim(__local86__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local87__) := y if { + y = __local87__ + } + + multi("bar", __local88__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local91__) := __local91__ + - | + package test.l1.l2 + + p := true + + f(__local94__) := __local94__ + - | + package test.omit_result + + f(__local97__) := __local97__ + + p if { + data.test.omit_result.f(1) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/functions/test-functions-0994.yaml b/test/cases/testdata/v1/functions/test-functions-0994.yaml new file mode 100644 index 0000000000..8f3346c543 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-0994.yaml @@ -0,0 +1,198 @@ +--- +cases: + - note: functions/false else undefined + query: data.ex.falsy_else_undefined = x + modules: + - | + package topdown_test_partial + + __result__ := _result if { + _result = false + } + - | + package ex + + foo(__local66__) := y if { + split(__local66__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local67__) := y if { + data.ex.foo(__local67__, y) + } + + chain1(__local68__) := b if { + data.ex.chain0(__local68__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local70__) := [a, b] if { + split(__local70__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local72__) := false + + falsy_func_else(__local74__) if { + __local74__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local81__, __local82__]) := [a, b] if { + data.ex.foo(__local81__, a) + data.ex.foo(__local82__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local83__, "bar": __local84__}) := z if { + data.ex.foo(__local83__, a) + data.test.foo(__local84__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local85__) if { + __local85__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local89__) := y if { + y = __local89__ + } + + multi(2, __local90__) := y if { + __local24__ = 2 * __local90__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local92__) := y if { + __local26__ = __local92__ * 10 + y = __local26__ + } + + multi("foo", __local93__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local95__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local106__) := y if { + trim(__local106__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local107__) := y if { + y = __local107__ + } + + multi("bar", __local108__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local112__) := __local112__ + - | + package test.l1.l2 + + p := true + + f(__local116__) := __local116__ + - | + package test.omit_result + + f(__local120__) := __local120__ + + p if { + data.test.omit_result.f(1) + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/functions/test-functions-0995.yaml b/test/cases/testdata/v1/functions/test-functions-0995.yaml new file mode 100644 index 0000000000..27a5309557 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-0995.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/false else negation + query: data.ex.falsy_else_negation = x + modules: + - | + package test.l1.l2 + + p := true + + f(__local116__) := __local116__ + - | + package test.omit_result + + f(__local120__) := __local120__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = false + } + - | + package ex + + foo(__local66__) := y if { + split(__local66__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local67__) := y if { + data.ex.foo(__local67__, y) + } + + chain1(__local68__) := b if { + data.ex.chain0(__local68__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local70__) := [a, b] if { + split(__local70__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local72__) := false + + falsy_func_else(__local74__) if { + __local74__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local81__, __local82__]) := [a, b] if { + data.ex.foo(__local81__, a) + data.ex.foo(__local82__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local83__, "bar": __local84__}) := z if { + data.ex.foo(__local83__, a) + data.test.foo(__local84__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local85__) if { + __local85__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local89__) := y if { + y = __local89__ + } + + multi(2, __local90__) := y if { + __local24__ = 2 * __local90__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local92__) := y if { + __local26__ = __local92__ * 10 + y = __local26__ + } + + multi("foo", __local93__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local95__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local106__) := y if { + trim(__local106__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local107__) := y if { + y = __local107__ + } + + multi("bar", __local108__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local112__) := __local112__ + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/functions/test-functions-0996.yaml b/test/cases/testdata/v1/functions/test-functions-0996.yaml new file mode 100644 index 0000000000..bd8e468389 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-0996.yaml @@ -0,0 +1,201 @@ +--- +cases: + - note: functions/chained + query: data.ex.chain2 = x + modules: + - | + package test + + foo(__local126__) := y if { + trim(__local126__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local127__) := y if { + y = __local127__ + } + + multi("bar", __local128__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local133__) := __local133__ + - | + package test.l1.l2 + + p := true + + f(__local138__) := __local138__ + - | + package test.omit_result + + f(__local143__) := __local143__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = true + } + - | + package ex + + foo(__local86__) := y if { + split(__local86__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local87__) := y if { + data.ex.foo(__local87__, y) + } + + chain1(__local88__) := b if { + data.ex.chain0(__local88__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local91__) := [a, b] if { + split(__local91__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local94__) := false + + falsy_func_else(__local96__) if { + __local96__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local98__, __local99__]) := [a, b] if { + data.ex.foo(__local98__, a) + data.ex.foo(__local99__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local100__, "bar": __local101__}) := z if { + data.ex.foo(__local100__, a) + data.test.foo(__local101__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local102__) if { + __local102__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local103__) := y if { + y = __local103__ + } + + multi(2, __local104__) := y if { + __local24__ = 2 * __local104__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local105__) := y if { + __local26__ = __local105__ * 10 + y = __local26__ + } + + multi("foo", __local109__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local110__) := true + + always_true if { + data.ex.always_true_fn(1) + } + data: {} + want_result: + - x: + - foo + - bar diff --git a/test/cases/testdata/v1/functions/test-functions-0997.yaml b/test/cases/testdata/v1/functions/test-functions-0997.yaml new file mode 100644 index 0000000000..cee39d032b --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-0997.yaml @@ -0,0 +1,201 @@ +--- +cases: + - note: functions/cross package + query: data.test.cross = x + modules: + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local154__) := __local154__ + - | + package test.l1.l2 + + p := true + + f(__local160__) := __local160__ + - | + package test.omit_result + + f(__local166__) := __local166__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = ["foo", "bar"] + } + - | + package ex + + foo(__local106__) := y if { + split(__local106__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local107__) := y if { + data.ex.foo(__local107__, y) + } + + chain1(__local108__) := b if { + data.ex.chain0(__local108__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local111__) := [a, b] if { + split(__local111__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local112__) := false + + falsy_func_else(__local113__) if { + __local113__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local115__, __local116__]) := [a, b] if { + data.ex.foo(__local115__, a) + data.ex.foo(__local116__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local117__, "bar": __local118__}) := z if { + data.ex.foo(__local117__, a) + data.test.foo(__local118__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local119__) if { + __local119__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local120__) := y if { + y = __local120__ + } + + multi(2, __local121__) := y if { + __local24__ = 2 * __local121__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local122__) := y if { + __local26__ = __local122__ * 10 + y = __local26__ + } + + multi("foo", __local123__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local124__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local146__) := y if { + trim(__local146__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local147__) := y if { + y = __local147__ + } + + multi("bar", __local148__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + data: {} + want_result: + - x: + - s f + - - ", my name " diff --git a/test/cases/testdata/v1/functions/test-functions-0998.yaml b/test/cases/testdata/v1/functions/test-functions-0998.yaml new file mode 100644 index 0000000000..c9a263cd1f --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-0998.yaml @@ -0,0 +1,202 @@ +--- +cases: + - note: functions/array params + query: data.ex.arraysrule = x + modules: + - | + package test.l1.l3 + + g(__local175__) := __local175__ + - | + package test.l1.l2 + + p := true + + f(__local182__) := __local182__ + - | + package test.omit_result + + f(__local189__) := __local189__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = ["s f", [", my name "]] + } + - | + package ex + + foo(__local125__) := y if { + split(__local125__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local126__) := y if { + data.ex.foo(__local126__, y) + } + + chain1(__local127__) := b if { + data.ex.chain0(__local127__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local128__) := [a, b] if { + split(__local128__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local129__) := false + + falsy_func_else(__local130__) if { + __local130__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local132__, __local133__]) := [a, b] if { + data.ex.foo(__local132__, a) + data.ex.foo(__local133__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local134__, "bar": __local135__}) := z if { + data.ex.foo(__local134__, a) + data.test.foo(__local135__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local136__) if { + __local136__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local137__) := y if { + y = __local137__ + } + + multi(2, __local138__) := y if { + __local24__ = 2 * __local138__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local139__) := y if { + __local26__ = __local139__ * 10 + y = __local26__ + } + + multi("foo", __local140__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local141__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local165__) := y if { + trim(__local165__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local167__) := y if { + y = __local167__ + } + + multi("bar", __local168__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + data: {} + want_result: + - x: + - - h + - h + - - foo diff --git a/test/cases/testdata/v1/functions/test-functions-0999.yaml b/test/cases/testdata/v1/functions/test-functions-0999.yaml new file mode 100644 index 0000000000..4aae7becbf --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-0999.yaml @@ -0,0 +1,202 @@ +--- +cases: + - note: functions/object params + query: data.ex.objectsrule = x + modules: + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local196__) := __local196__ + - | + package test.l1.l2 + + p := true + + f(__local204__) := __local204__ + - | + package test.omit_result + + f(__local212__) := __local212__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = [["h", "h"], ["foo"]] + } + - | + package ex + + foo(__local142__) := y if { + split(__local142__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local143__) := y if { + data.ex.foo(__local143__, y) + } + + chain1(__local144__) := b if { + data.ex.chain0(__local144__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local145__) := [a, b] if { + split(__local145__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local146__) := false + + falsy_func_else(__local147__) if { + __local147__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local149__, __local150__]) := [a, b] if { + data.ex.foo(__local149__, a) + data.ex.foo(__local150__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local151__, "bar": __local152__}) := z if { + data.ex.foo(__local151__, a) + data.test.foo(__local152__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local153__) if { + __local153__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local154__) := y if { + y = __local154__ + } + + multi(2, __local155__) := y if { + __local24__ = 2 * __local155__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local156__) := y if { + __local26__ = __local156__ * 10 + y = __local26__ + } + + multi("foo", __local157__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local158__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local185__) := y if { + trim(__local185__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local186__) := y if { + y = __local186__ + } + + multi("bar", __local187__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + data: {} + want_result: + - x: + - - h + - h + - i diff --git a/test/cases/testdata/v1/functions/test-functions-1000.yaml b/test/cases/testdata/v1/functions/test-functions-1000.yaml new file mode 100644 index 0000000000..cbd77584d5 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1000.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/ref func output + query: data.ex.refoutput = x + modules: + - | + package topdown_test_partial + + __result__ := _result if { + _result = [["h", "h"], "i"] + } + - | + package ex + + foo(__local159__) := y if { + split(__local159__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local160__) := y if { + data.ex.foo(__local160__, y) + } + + chain1(__local161__) := b if { + data.ex.chain0(__local161__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local162__) := [a, b] if { + split(__local162__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local163__) := false + + falsy_func_else(__local164__) if { + __local164__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local166__, __local167__]) := [a, b] if { + data.ex.foo(__local166__, a) + data.ex.foo(__local167__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local168__, "bar": __local169__}) := z if { + data.ex.foo(__local168__, a) + data.test.foo(__local169__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local170__) if { + __local170__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local171__) := y if { + y = __local171__ + } + + multi(2, __local172__) := y if { + __local24__ = 2 * __local172__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local173__) := y if { + __local26__ = __local173__ * 10 + y = __local26__ + } + + multi("foo", __local174__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local175__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local205__) := y if { + trim(__local205__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local206__) := y if { + y = __local206__ + } + + multi("bar", __local207__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local217__) := __local217__ + - | + package test.l1.l2 + + p := true + + f(__local226__) := __local226__ + - | + package test.omit_result + + f(__local235__) := __local235__ + + p if { + data.test.omit_result.f(1) + } + data: {} + want_result: + - x: h diff --git a/test/cases/testdata/v1/functions/test-functions-1001.yaml b/test/cases/testdata/v1/functions/test-functions-1001.yaml new file mode 100644 index 0000000000..e3ce870cbb --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1001.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/always_true + query: data.ex.always_true = x + modules: + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local238__) := __local238__ + - | + package test.l1.l2 + + p := true + + f(__local248__) := __local248__ + - | + package test.omit_result + + f(__local258__) := __local258__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = "h" + } + - | + package ex + + foo(__local176__) := y if { + split(__local176__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local177__) := y if { + data.ex.foo(__local177__, y) + } + + chain1(__local178__) := b if { + data.ex.chain0(__local178__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local179__) := [a, b] if { + split(__local179__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local180__) := false + + falsy_func_else(__local181__) if { + __local181__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local183__, __local184__]) := [a, b] if { + data.ex.foo(__local183__, a) + data.ex.foo(__local184__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local185__, "bar": __local186__}) := z if { + data.ex.foo(__local185__, a) + data.test.foo(__local186__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local187__) if { + __local187__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local188__) := y if { + y = __local188__ + } + + multi(2, __local189__) := y if { + __local24__ = 2 * __local189__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local190__) := y if { + __local26__ = __local190__ * 10 + y = __local26__ + } + + multi("foo", __local191__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local192__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local224__) := y if { + trim(__local224__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local225__) := y if { + y = __local225__ + } + + multi("bar", __local227__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/functions/test-functions-1002.yaml b/test/cases/testdata/v1/functions/test-functions-1002.yaml new file mode 100644 index 0000000000..d838b0607b --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1002.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/same package call + query: data.test.samepkg = x + modules: + - | + package ex + + foo(__local193__) := y if { + split(__local193__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local194__) := y if { + data.ex.foo(__local194__, y) + } + + chain1(__local195__) := b if { + data.ex.chain0(__local195__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local196__) := [a, b] if { + split(__local196__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local197__) := false + + falsy_func_else(__local198__) if { + __local198__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local200__, __local201__]) := [a, b] if { + data.ex.foo(__local200__, a) + data.ex.foo(__local201__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local202__, "bar": __local203__}) := z if { + data.ex.foo(__local202__, a) + data.test.foo(__local203__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local204__) if { + __local204__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local205__) := y if { + y = __local205__ + } + + multi(2, __local206__) := y if { + __local24__ = 2 * __local206__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local207__) := y if { + __local26__ = __local207__ * 10 + y = __local26__ + } + + multi("foo", __local208__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local209__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local244__) := y if { + trim(__local244__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local245__) := y if { + y = __local245__ + } + + multi("bar", __local246__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local259__) := __local259__ + - | + package test.l1.l2 + + p := true + + f(__local270__) := __local270__ + - | + package test.omit_result + + f(__local281__) := __local281__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = true + } + data: {} + want_result: + - x: w do you do? diff --git a/test/cases/testdata/v1/functions/test-functions-1003.yaml b/test/cases/testdata/v1/functions/test-functions-1003.yaml new file mode 100644 index 0000000000..549eb65788 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1003.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/void good + query: data.ex.voidGood = x + modules: + - | + package test.l1.l2 + + p := true + + f(__local292__) := __local292__ + - | + package test.omit_result + + f(__local304__) := __local304__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = "w do you do?" + } + - | + package ex + + foo(__local210__) := y if { + split(__local210__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local211__) := y if { + data.ex.foo(__local211__, y) + } + + chain1(__local212__) := b if { + data.ex.chain0(__local212__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local213__) := [a, b] if { + split(__local213__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local214__) := false + + falsy_func_else(__local215__) if { + __local215__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local217__, __local218__]) := [a, b] if { + data.ex.foo(__local217__, a) + data.ex.foo(__local218__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local219__, "bar": __local220__}) := z if { + data.ex.foo(__local219__, a) + data.test.foo(__local220__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local221__) if { + __local221__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local222__) := y if { + y = __local222__ + } + + multi(2, __local223__) := y if { + __local24__ = 2 * __local223__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local224__) := y if { + __local26__ = __local224__ * 10 + y = __local26__ + } + + multi("foo", __local225__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local226__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local264__) := y if { + trim(__local264__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local265__) := y if { + y = __local265__ + } + + multi("bar", __local266__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local279__) := __local279__ + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/functions/test-functions-1004.yaml b/test/cases/testdata/v1/functions/test-functions-1004.yaml new file mode 100644 index 0000000000..c28ee4cf6b --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1004.yaml @@ -0,0 +1,198 @@ +--- +cases: + - note: functions/void bad + query: data.ex.voidBad = x + modules: + - | + package test.omit_result + + f(__local327__) := __local327__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = true + } + - | + package ex + + foo(__local227__) := y if { + split(__local227__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local228__) := y if { + data.ex.foo(__local228__, y) + } + + chain1(__local229__) := b if { + data.ex.chain0(__local229__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local230__) := [a, b] if { + split(__local230__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local231__) := false + + falsy_func_else(__local232__) if { + __local232__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local234__, __local235__]) := [a, b] if { + data.ex.foo(__local234__, a) + data.ex.foo(__local235__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local236__, "bar": __local237__}) := z if { + data.ex.foo(__local236__, a) + data.test.foo(__local237__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local238__) if { + __local238__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local239__) := y if { + y = __local239__ + } + + multi(2, __local240__) := y if { + __local24__ = 2 * __local240__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local241__) := y if { + __local26__ = __local241__ * 10 + y = __local26__ + } + + multi("foo", __local242__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local243__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local284__) := y if { + trim(__local284__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local285__) := y if { + y = __local285__ + } + + multi("bar", __local286__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local300__) := __local300__ + - | + package test.l1.l2 + + p := true + + f(__local314__) := __local314__ + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/functions/test-functions-1005.yaml b/test/cases/testdata/v1/functions/test-functions-1005.yaml new file mode 100644 index 0000000000..2e97502037 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1005.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/multi1 + query: data.ex.multi1 = x + modules: + - | + package test.l1.l3 + + g(__local300__) := __local300__ + - | + package test.l1.l2 + + p := true + + f(__local314__) := __local314__ + - | + package test.omit_result + + f(__local327__) := __local327__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = true + } + - | + package ex + + foo(__local227__) := y if { + split(__local227__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local228__) := y if { + data.ex.foo(__local228__, y) + } + + chain1(__local229__) := b if { + data.ex.chain0(__local229__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local230__) := [a, b] if { + split(__local230__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local231__) := false + + falsy_func_else(__local232__) if { + __local232__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local234__, __local235__]) := [a, b] if { + data.ex.foo(__local234__, a) + data.ex.foo(__local235__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local236__, "bar": __local237__}) := z if { + data.ex.foo(__local236__, a) + data.test.foo(__local237__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local238__) if { + __local238__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local239__) := y if { + y = __local239__ + } + + multi(2, __local240__) := y if { + __local24__ = 2 * __local240__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local241__) := y if { + __local26__ = __local241__ * 10 + y = __local26__ + } + + multi("foo", __local242__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local243__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local284__) := y if { + trim(__local284__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local285__) := y if { + y = __local285__ + } + + multi("bar", __local286__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + data: {} + want_result: + - x: 2 diff --git a/test/cases/testdata/v1/functions/test-functions-1006.yaml b/test/cases/testdata/v1/functions/test-functions-1006.yaml new file mode 100644 index 0000000000..9875aef6ab --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1006.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/multi2 + query: data.ex.multi2 = x + modules: + - | + package test.omit_result + + f(__local350__) := __local350__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = 2 + } + - | + package ex + + foo(__local244__) := y if { + split(__local244__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local245__) := y if { + data.ex.foo(__local245__, y) + } + + chain1(__local246__) := b if { + data.ex.chain0(__local246__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local247__) := [a, b] if { + split(__local247__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local248__) := false + + falsy_func_else(__local249__) if { + __local249__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local251__, __local252__]) := [a, b] if { + data.ex.foo(__local251__, a) + data.ex.foo(__local252__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local253__, "bar": __local254__}) := z if { + data.ex.foo(__local253__, a) + data.test.foo(__local254__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local255__) if { + __local255__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local256__) := y if { + y = __local256__ + } + + multi(2, __local257__) := y if { + __local24__ = 2 * __local257__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local258__) := y if { + __local26__ = __local258__ * 10 + y = __local26__ + } + + multi("foo", __local259__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local260__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local304__) := y if { + trim(__local304__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local305__) := y if { + y = __local305__ + } + + multi("bar", __local306__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local321__) := __local321__ + - | + package test.l1.l2 + + p := true + + f(__local336__) := __local336__ + data: {} + want_result: + - x: 5 diff --git a/test/cases/testdata/v1/functions/test-functions-1007.yaml b/test/cases/testdata/v1/functions/test-functions-1007.yaml new file mode 100644 index 0000000000..8770d5e2b6 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1007.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/multi3 + query: data.ex.multi3 = x + modules: + - | + package ex + + foo(__local261__) := y if { + split(__local261__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local262__) := y if { + data.ex.foo(__local262__, y) + } + + chain1(__local263__) := b if { + data.ex.chain0(__local263__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local264__) := [a, b] if { + split(__local264__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local265__) := false + + falsy_func_else(__local266__) if { + __local266__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local268__, __local269__]) := [a, b] if { + data.ex.foo(__local268__, a) + data.ex.foo(__local269__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local270__, "bar": __local271__}) := z if { + data.ex.foo(__local270__, a) + data.test.foo(__local271__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local272__) if { + __local272__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local273__) := y if { + y = __local273__ + } + + multi(2, __local274__) := y if { + __local24__ = 2 * __local274__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local275__) := y if { + __local26__ = __local275__ * 10 + y = __local26__ + } + + multi("foo", __local276__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local277__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local324__) := y if { + trim(__local324__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local325__) := y if { + y = __local325__ + } + + multi("bar", __local326__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local342__) := __local342__ + - | + package test.l1.l2 + + p := true + + f(__local358__) := __local358__ + - | + package test.omit_result + + f(__local373__) := __local373__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = 5 + } + data: {} + want_result: + - x: 20 diff --git a/test/cases/testdata/v1/functions/test-functions-1008.yaml b/test/cases/testdata/v1/functions/test-functions-1008.yaml new file mode 100644 index 0000000000..b325968257 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1008.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/multi4 + query: data.ex.multi4 = x + modules: + - | + package test.omit_result + + f(__local396__) := __local396__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = 20 + } + - | + package ex + + foo(__local278__) := y if { + split(__local278__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local279__) := y if { + data.ex.foo(__local279__, y) + } + + chain1(__local280__) := b if { + data.ex.chain0(__local280__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local281__) := [a, b] if { + split(__local281__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local282__) := false + + falsy_func_else(__local283__) if { + __local283__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local285__, __local286__]) := [a, b] if { + data.ex.foo(__local285__, a) + data.ex.foo(__local286__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local287__, "bar": __local288__}) := z if { + data.ex.foo(__local287__, a) + data.test.foo(__local288__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local289__) if { + __local289__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local290__) := y if { + y = __local290__ + } + + multi(2, __local291__) := y if { + __local24__ = 2 * __local291__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local292__) := y if { + __local26__ = __local292__ * 10 + y = __local26__ + } + + multi("foo", __local293__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local294__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local344__) := y if { + trim(__local344__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local345__) := y if { + y = __local345__ + } + + multi("bar", __local346__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local363__) := __local363__ + - | + package test.l1.l2 + + p := true + + f(__local380__) := __local380__ + data: {} + want_result: + - x: bar diff --git a/test/cases/testdata/v1/functions/test-functions-1009.yaml b/test/cases/testdata/v1/functions/test-functions-1009.yaml new file mode 100644 index 0000000000..eabd13daf0 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1009.yaml @@ -0,0 +1,201 @@ +--- +cases: + - note: functions/multi cross package + query: data.test.multi_cross_pkg = x + modules: + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local384__) := __local384__ + - | + package test.l1.l2 + + p := true + + f(__local402__) := __local402__ + - | + package test.omit_result + + f(__local419__) := __local419__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = "bar" + } + - | + package ex + + foo(__local295__) := y if { + split(__local295__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local296__) := y if { + data.ex.foo(__local296__, y) + } + + chain1(__local297__) := b if { + data.ex.chain0(__local297__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local298__) := [a, b] if { + split(__local298__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local299__) := false + + falsy_func_else(__local300__) if { + __local300__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local302__, __local303__]) := [a, b] if { + data.ex.foo(__local302__, a) + data.ex.foo(__local303__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local304__, "bar": __local305__}) := z if { + data.ex.foo(__local304__, a) + data.test.foo(__local305__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local306__) if { + __local306__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local307__) := y if { + y = __local307__ + } + + multi(2, __local308__) := y if { + __local24__ = 2 * __local308__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local309__) := y if { + __local26__ = __local309__ * 10 + y = __local26__ + } + + multi("foo", __local310__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local311__) := true + + always_true if { + data.ex.always_true_fn(1) + } + - | + package test + + foo(__local364__) := y if { + trim(__local364__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local365__) := y if { + y = __local365__ + } + + multi("bar", __local366__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + data: {} + want_result: + - x: + - bar + - 3 diff --git a/test/cases/testdata/v1/functions/test-functions-1010.yaml b/test/cases/testdata/v1/functions/test-functions-1010.yaml new file mode 100644 index 0000000000..40db1f7d98 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1010.yaml @@ -0,0 +1,202 @@ +--- +cases: + - note: functions/skip-functions + query: data.test.l1 = x + modules: + - | + package test + + foo(__local383__) := y if { + trim(__local383__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local385__) := y if { + y = __local385__ + } + + multi("bar", __local386__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local405__) := __local405__ + - | + package test.l1.l2 + + p := true + + f(__local424__) := __local424__ + - | + package test.omit_result + + f(__local442__) := __local442__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = ["bar", 3] + } + - | + package ex + + foo(__local312__) := y if { + split(__local312__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local313__) := y if { + data.ex.foo(__local313__, y) + } + + chain1(__local314__) := b if { + data.ex.chain0(__local314__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local315__) := [a, b] if { + split(__local315__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local316__) := false + + falsy_func_else(__local317__) if { + __local317__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local319__, __local320__]) := [a, b] if { + data.ex.foo(__local319__, a) + data.ex.foo(__local320__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local321__, "bar": __local322__}) := z if { + data.ex.foo(__local321__, a) + data.test.foo(__local322__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local323__) if { + __local323__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local324__) := y if { + y = __local324__ + } + + multi(2, __local325__) := y if { + __local24__ = 2 * __local325__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local326__) := y if { + __local26__ = __local326__ * 10 + y = __local26__ + } + + multi("foo", __local327__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local328__) := true + + always_true if { + data.ex.always_true_fn(1) + } + data: {} + want_result: + - x: + l2: + p: true + l3: {} diff --git a/test/cases/testdata/v1/functions/test-functions-1011.yaml b/test/cases/testdata/v1/functions/test-functions-1011.yaml new file mode 100644 index 0000000000..eec09745af --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-1011.yaml @@ -0,0 +1,199 @@ +--- +cases: + - note: functions/omit result + query: data.test.omit_result.p = x + modules: + - | + package test + + foo(__local403__) := y if { + trim(__local403__, "h o", y) + } + + cross := y if { + data.ex.cross("hi, my name is foo", y) + } + + multi("foo", __local404__) := y if { + y = __local404__ + } + + multi("bar", __local406__) := y if { + y = "baz" + } + + multi_cross_pkg := [y, z] if { + data.test.multi("foo", "bar", y) + data.ex.multi(2, 1, z) + } + - | + package test + + samepkg := y if { + data.test.foo("how do you do?", y) + } + - | + package test.l1.l3 + + g(__local426__) := __local426__ + - | + package test.l1.l2 + + p := true + + f(__local446__) := __local446__ + - | + package test.omit_result + + f(__local465__) := __local465__ + + p if { + data.test.omit_result.f(1) + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = {"l2": {"p": true}, "l3": {}} + } + - | + package ex + + foo(__local329__) := y if { + split(__local329__, "i", y) + } + + bar[x] := y if { + data.l[_].a = x + data.ex.foo(x, y) + } + + chain0(__local330__) := y if { + data.ex.foo(__local330__, y) + } + + chain1(__local331__) := b if { + data.ex.chain0(__local331__, b) + } + + chain2 := d if { + data.ex.chain1("fooibar", d) + } + + cross(__local332__) := [a, b] if { + split(__local332__, "i", y) + __local27__ = y[1] + data.ex.foo(__local27__, b) + __local28__ = y[2] + data.test.foo(__local28__, a) + } + + falsy_func(__local333__) := false + + falsy_func_else(__local334__) if { + __local334__ = 1 + } + + else := false + + falsy_undefined if { + data.ex.falsy_func(1) + } + + falsy_negation if { + not data.ex.falsy_func(1) + } + + falsy_else_value := __local23__ if { + true + data.ex.falsy_func_else(2, __local23__) + } + + falsy_else_undefined if { + data.ex.falsy_func_else(2) + } + + falsy_else_negation if { + not data.ex.falsy_func_else(2) + } + + arrays([__local336__, __local337__]) := [a, b] if { + data.ex.foo(__local336__, a) + data.ex.foo(__local337__, b) + } + + arraysrule := y if { + data.ex.arrays(["hih", "foo"], y) + } + + objects({"foo": __local338__, "bar": __local339__}) := z if { + data.ex.foo(__local338__, a) + data.test.foo(__local339__, b) + z = [a, b] + } + + objectsrule := y if { + data.ex.objects({"bar": "hi ho", "foo": "hih"}, y) + } + + refoutput := y if { + data.ex.foo("hih", z) + y = z[1] + } + + void(__local340__) if { + __local340__ = "foo" + } + + voidGood if { + not data.ex.void("bar", true) + } + + voidBad if { + data.ex.void("bar", true) + } + + multi(1, __local341__) := y if { + y = __local341__ + } + + multi(2, __local342__) := y if { + __local24__ = 2 * __local342__ + a = __local24__ + __local25__ = a + 1 + y = __local25__ + } + + multi(3, __local343__) := y if { + __local26__ = __local343__ * 10 + y = __local26__ + } + + multi("foo", __local344__) := y if { + y = "bar" + } + + multi1 := y if { + data.ex.multi(1, 2, y) + } + + multi2 := y if { + data.ex.multi(2, 2, y) + } + + multi3 := y if { + data.ex.multi(3, 2, y) + } + + multi4 := y if { + data.ex.multi("foo", 2, y) + } + + always_true_fn(__local345__) := true + + always_true if { + data.ex.always_true_fn(1) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/functions/test-functions-default.yaml b/test/cases/testdata/v1/functions/test-functions-default.yaml new file mode 100644 index 0000000000..d107e0d312 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-default.yaml @@ -0,0 +1,86 @@ +--- +cases: + - note: functions/default + query: data.test.p = x + modules: + - | + package test + + default f(x) := 1 + + f(x) := x if { + x > 0 + } + + p if { + f(-1) == 1 + } + want_result: + - x: true + - note: functions/non default + query: data.test.p = x + modules: + - | + package test + + default f(x) := 1 + + f(x) := x if { + x > 0 + } + + p if { + f(2) == 2 + } + want_result: + - x: true + - note: functions/only default + query: data.test.p = x + modules: + - | + package test + + default f(x) := 1 + + p if { + f(2) == 1 + } + want_result: + - x: true + - note: functions/wildcard args + query: data.test.p = x + modules: + - | + package test + + default f(_, _) := 1 + + f(x, y) := x if { + x == y + } + + p if { + f(2, 2) == 2 + } + want_result: + - x: true + - note: functions/comprehensions + query: data.test.p = x + modules: + - | + package test + + default f(x) := 1000 + + f(x) := x if { + x > 0 + } + + p := xs if { + xs := [y | x = [1, -2, 3][_]; y := f(x)] + } + want_result: + - x: + - 1 + - 1000 + - 3 diff --git a/test/cases/testdata/v1/functions/test-functions-nested-with-early-exit.yaml b/test/cases/testdata/v1/functions/test-functions-nested-with-early-exit.yaml new file mode 100644 index 0000000000..2dc626d16d --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-nested-with-early-exit.yaml @@ -0,0 +1,93 @@ +--- +cases: + - note: functions/nested complete doc with conflict + query: data.generated.p(1) = x + modules: + - | + package generated + + p(_) if { + data.generated.q + } + + q := true + + q := false + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs + - note: functions/nested complete doc with conflict, else + query: data.generated.p(1) = x + modules: + - | + package generated + + p(_) if { + data.generated.q + } + + q if { + false + } + + else := true + + q if { + false + } + + else := false + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs + - note: functions/nested function with conflict + query: data.generated.p(1) = x + modules: + - | + package generated + + p(x) if { + y := data.generated.q(x) + } + + q(_) := true + + q(_) := false + want_error_code: eval_conflict_error + want_error: functions must not produce multiple outputs for same inputs + - note: functions/nested function with conflict, else + query: data.generated.p(1) = x + modules: + - | + package generated + + p(x) if { + y := data.generated.q(x) + } + + q(_) if { + false + } + + else := true + + q(_) if { + false + } + + else := false + want_error_code: eval_conflict_error + want_error: functions must not produce multiple outputs for same inputs + - note: functions/nested function with conflict, else, no extra return + query: data.test.p(1) = x + modules: + - | + package test + + p(x) if { + y := data.test.q(x) + } + + xs := {1, 2} + + q(_) := xs[_] + want_error_code: eval_conflict_error + want_error: functions must not produce multiple outputs for same inputs diff --git a/test/cases/testdata/v1/functions/test-functions-unused-arg.yaml b/test/cases/testdata/v1/functions/test-functions-unused-arg.yaml new file mode 100644 index 0000000000..9c1a1c37d0 --- /dev/null +++ b/test/cases/testdata/v1/functions/test-functions-unused-arg.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: unused arg + query: data.p.f(1) + modules: + - | + package p + + f(x) if { + r = input.that_is_not_there + } + want_result: [] diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0133.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0133.yaml new file mode 100644 index 0000000000..ada2793a75 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0133.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with . delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("*.github.com", ["."], "api.github.com", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0134.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0134.yaml new file mode 100644 index 0000000000..1e03e58a67 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0134.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/super glob match with . delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("api.**.com", ["."], "api.github.com", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0135.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0135.yaml new file mode 100644 index 0000000000..4405758543 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0135.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/super glob match with . delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("api.**.com", ["."], "api.cdn.github.com", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0136.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0136.yaml new file mode 100644 index 0000000000..3ec3dc208c --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0136.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "globmatch/glob match with : delimiter" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("*:github:com", [":"], "api:github:com", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0137.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0137.yaml new file mode 100644 index 0000000000..83ee861ca7 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0137.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob no match with . delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("*.github.com", ["."], "api.not-github.com", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0138.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0138.yaml new file mode 100644 index 0000000000..22219ea934 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0138.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with character-list matchers + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("[abc]at", [], "cat", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0139.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0139.yaml new file mode 100644 index 0000000000..67e9ea30d2 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0139.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob no match with character-list matchers + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("[abc]at", [], "fat", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0140.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0140.yaml new file mode 100644 index 0000000000..6ba476338c --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0140.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with negated character-list matchers + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("[!abc]at", [], "fat", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0141.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0141.yaml new file mode 100644 index 0000000000..7f66f522ea --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0141.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob no match with negated character-list matchers + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("[!abc]at", [], "cat", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0142.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0142.yaml new file mode 100644 index 0000000000..d1af45bf63 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0142.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with character-range matchers + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("[a-c]at", [], "bat", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0143.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0143.yaml new file mode 100644 index 0000000000..c1b2176174 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0143.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob no match with character-range matchers + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("[a-c]at", [], "fat", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0144.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0144.yaml new file mode 100644 index 0000000000..45523ec6bf --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0144.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob no match with character-range matchers + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("[!a-c]at", [], "bat", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0145.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0145.yaml new file mode 100644 index 0000000000..1f528cf1a2 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0145.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with character-range matchers + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("[!a-c]at", [], "fat", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0146.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0146.yaml new file mode 100644 index 0000000000..d0684df605 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0146.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with single wild-card + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("?at", [], "fat", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0147.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0147.yaml new file mode 100644 index 0000000000..fbe01053c1 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0147.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob no match with single wild-card + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("?at", [], "at", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0148.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0148.yaml new file mode 100644 index 0000000000..d2c6651045 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0148.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with single wild-card and delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("?at", ["f"], "bat", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0149.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0149.yaml new file mode 100644 index 0000000000..07681d53fe --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0149.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob no match with single wild-card and delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("?at", ["f"], "fat", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0150.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0150.yaml new file mode 100644 index 0000000000..5c9580ad9e --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0150.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with pattern-alternatives list (cat) + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("{cat,bat,[fr]at}", [], "cat", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0151.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0151.yaml new file mode 100644 index 0000000000..c6fc7d3042 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0151.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with pattern-alternatives list (bat) + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("{cat,bat,[fr]at}", [], "bat", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0152.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0152.yaml new file mode 100644 index 0000000000..08ac93bd4b --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0152.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with pattern-alternatives list (fat) + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("{cat,bat,[fr]at}", [], "fat", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0153.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0153.yaml new file mode 100644 index 0000000000..acd06f916f --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0153.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match with pattern-alternatives list (rat) + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("{cat,bat,[fr]at}", [], "rat", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0154.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0154.yaml new file mode 100644 index 0000000000..d60382cf6b --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0154.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob no match with pattern-alternatives list + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("{cat,bat,[fr]at}", [], "at", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0155.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0155.yaml new file mode 100644 index 0000000000..ab4b7bc66f --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0155.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match single with . delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("*", ["."], "foo", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0156.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0156.yaml new file mode 100644 index 0000000000..ac40685705 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0156.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob match single with default delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("*", [], "foo", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0157.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0157.yaml new file mode 100644 index 0000000000..6de5c59dbe --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0157.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob no match single with . delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("*", ["."], "foo.bar", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0158.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0158.yaml new file mode 100644 index 0000000000..16a4268826 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0158.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globmatch/glob no match single with default delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("*", [], "foo.bar", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-0159.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-0159.yaml new file mode 100644 index 0000000000..92bc23d204 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-0159.yaml @@ -0,0 +1,30 @@ +--- +cases: + - note: globmatch/glob match single without default delimiter + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("*", null, "foo.bar", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true + - note: globmatch/glob match single without default delimiter, glob non-empty + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.match("foo*", null, "foo.bar", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-issue-5273.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-issue-5273.yaml new file mode 100644 index 0000000000..c101c3fbf4 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-issue-5273.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: globmatch/no deadlocks for glob match + query: data.test.p = x + modules: + - | + package test + + p contains x if { + glob.match("*.github.com", ["."], "api.github.com", x) + glob.match("*.github.com", ["."], "api.github.com", x) + } + want_result: + - x: + - true diff --git a/test/cases/testdata/v1/globmatch/test-globmatch-issue-5283.yaml b/test/cases/testdata/v1/globmatch/test-globmatch-issue-5283.yaml new file mode 100644 index 0000000000..c94d2e8888 --- /dev/null +++ b/test/cases/testdata/v1/globmatch/test-globmatch-issue-5283.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: globmatch/captured negative results, variable + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := glob.match("*.github.com", ["."], input) + } + input: api.example.com + want_result: + - x: false + - note: globmatch/captured negative result, constant + query: data.test.p = x + modules: + - | + package test + + p if { + glob.match("*.github.com", ["."], input, false) + } + input: api.example.com + want_result: + - x: true diff --git a/test/cases/testdata/v1/globquotemeta/test-globquotemeta-0159.yaml b/test/cases/testdata/v1/globquotemeta/test-globquotemeta-0159.yaml new file mode 100644 index 0000000000..09ea2ee382 --- /dev/null +++ b/test/cases/testdata/v1/globquotemeta/test-globquotemeta-0159.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: globquotemeta/glob quote meta + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + glob.quote_meta("*.github.com", x) + } + data: {} + want_result: + - x: + - \*.github.com + sort_bindings: true diff --git a/test/cases/testdata/v1/globsmatch/test-globsmatch-0865.yaml b/test/cases/testdata/v1/globsmatch/test-globsmatch-0865.yaml new file mode 100644 index 0000000000..4bfaff40ac --- /dev/null +++ b/test/cases/testdata/v1/globsmatch/test-globsmatch-0865.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: globsmatch/regex.globs_match + query: data.generated.p = x + modules: + - | + package generated + + p if { + regex.globs_match("a.a.[0-9]+z", ".b.b2359825792*594823z") + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/globsmatch/test-globsmatch-0866.yaml b/test/cases/testdata/v1/globsmatch/test-globsmatch-0866.yaml new file mode 100644 index 0000000000..52b515d15b --- /dev/null +++ b/test/cases/testdata/v1/globsmatch/test-globsmatch-0866.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: globsmatch/regex.globs_match + query: data.generated.p = x + modules: + - | + package generated + + p if { + regex.globs_match("[a-z]+", "[0-9]*") + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/globsmatch/test-globsmatch-0867.yaml b/test/cases/testdata/v1/globsmatch/test-globsmatch-0867.yaml new file mode 100644 index 0000000000..3f11405b86 --- /dev/null +++ b/test/cases/testdata/v1/globsmatch/test-globsmatch-0867.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "globsmatch/regex.globs_match: bad pattern err" + query: data.generated.p = x + modules: + - | + package generated + + p if { + regex.globs_match("pqrs]", "[a-b]+") + } + want_error_code: eval_builtin_error + want_error: "input:pqrs], pos:5, set-close ']' with no preceding '[': the input provided is invalid" + strict_error: true diff --git a/test/cases/testdata/v1/globsmatch/test-globsmatch-0868.yaml b/test/cases/testdata/v1/globsmatch/test-globsmatch-0868.yaml new file mode 100644 index 0000000000..cdc7196168 --- /dev/null +++ b/test/cases/testdata/v1/globsmatch/test-globsmatch-0868.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "globsmatch/regex.globs_match: ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.d.e[x] + regex.globs_match("b.*", __local0__) + } + data: + d: + e: + - bar + - baz + want_result: + - x: + - 0 + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/globsmatch/test-globsmatch-0869.yaml b/test/cases/testdata/v1/globsmatch/test-globsmatch-0869.yaml new file mode 100644 index 0000000000..001519e209 --- /dev/null +++ b/test/cases/testdata/v1/globsmatch/test-globsmatch-0869.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "globsmatch/regex.globs_match: raw" + query: data.generated.p = x + modules: + - | + package generated + + p if { + regex.globs_match(`[a-z]+\[[0-9]+\]`, "foo\\[1\\]") + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/globsmatch/test-globsmatch-0870.yaml b/test/cases/testdata/v1/globsmatch/test-globsmatch-0870.yaml new file mode 100644 index 0000000000..3f4ed0c016 --- /dev/null +++ b/test/cases/testdata/v1/globsmatch/test-globsmatch-0870.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "globsmatch/regex.globs_match: raw: undefined" + query: data.generated.p = x + modules: + - | + package generated + + p if { + regex.globs_match(`[a-z]+\[[0-9]+\]`, "foo[\"bar\"]") + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/graphql/test-graphql-basic-ast.yaml b/test/cases/testdata/v1/graphql/test-graphql-basic-ast.yaml new file mode 100644 index 0000000000..6f2ecc677f --- /dev/null +++ b/test/cases/testdata/v1/graphql/test-graphql-basic-ast.yaml @@ -0,0 +1,265 @@ +--- +cases: + - note: graphql_parse_query/success-basic-ast simple query + query: data.test.p = x + modules: + - | + package test + + ast := {"Operations": [{ + "Name": "", + "Operation": "query", + "SelectionSet": [{ + "Alias": "hero", + "Name": "hero", + "SelectionSet": [{ + "Alias": "name", + "Name": "name", + }], + }], + }]} + + p if { + graphql.parse_query("{hero {name}}") == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-basic-ast with arguments + query: data.test.p = x + modules: + - | + package test + + gql := `query hero ($episode: Episode!) { + hero (episode: $episode) { + id + name + friends { + id + name + friends { + id + name + appearsIn + } + appearsIn + } + appearsIn + } + }` + + ast := {"Operations": [{ + "Name": "hero", + "Operation": "query", + "SelectionSet": [{ + "Alias": "hero", + "Arguments": [{ + "Name": "episode", + "Value": { + "Kind": 0, + "Raw": "episode", + }, + }], + "Name": "hero", + "SelectionSet": [ + { + "Alias": "id", + "Name": "id", + }, + { + "Alias": "name", + "Name": "name", + }, + { + "Alias": "friends", + "Name": "friends", + "SelectionSet": [ + { + "Alias": "id", + "Name": "id", + }, + { + "Alias": "name", + "Name": "name", + }, + { + "Alias": "friends", + "Name": "friends", + "SelectionSet": [ + { + "Alias": "id", + "Name": "id", + }, + { + "Alias": "name", + "Name": "name", + }, + { + "Alias": "appearsIn", + "Name": "appearsIn", + }, + ], + }, + { + "Alias": "appearsIn", + "Name": "appearsIn", + }, + ], + }, + { + "Alias": "appearsIn", + "Name": "appearsIn", + }, + ], + }], + "VariableDefinitions": [{ + "Type": { + "NamedType": "Episode", + "NonNull": true, + }, + "Used": false, + "Variable": "episode", + }], + }]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-basic-ast inline fragments and type conditions + query: data.test.p = x + modules: + - | + package test + + gql := `query HeroForEpisode($ep: Episode!) { + hero(episode: $ep) { + name + ... on Droid { + primaryFunction + } + ... on Human { + height + } + } + }` + + ast := {"Operations": [{ + "Name": "HeroForEpisode", + "Operation": "query", + "SelectionSet": [{ + "Alias": "hero", + "Arguments": [{ + "Name": "episode", + "Value": { + "Kind": 0, + "Raw": "ep", + }, + }], + "Name": "hero", + "SelectionSet": [ + { + "Alias": "name", + "Name": "name", + }, + { + "SelectionSet": [{ + "Alias": "primaryFunction", + "Name": "primaryFunction", + }], + "TypeCondition": "Droid", + }, + { + "SelectionSet": [{ + "Alias": "height", + "Name": "height", + }], + "TypeCondition": "Human", + }, + ], + }], + "VariableDefinitions": [{ + "Type": { + "NamedType": "Episode", + "NonNull": true, + }, + "Used": false, + "Variable": "ep", + }], + }]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-basic-ast meta fields and introspection + query: data.test.p = x + modules: + - | + package test + + gql := `{ + search(text: "an") { + __typename + ... on Human { + name + } + ... on Droid { + name + } + ... on Starship { + name + } + } + }` + + ast := {"Operations": [{ + "Name": "", + "Operation": "query", + "SelectionSet": [{ + "Alias": "search", + "Arguments": [{ + "Name": "text", + "Value": { + "Kind": 3, + "Raw": "an", + }, + }], + "Name": "search", + "SelectionSet": [ + { + "Alias": "__typename", + "Name": "__typename", + }, + { + "SelectionSet": [{ + "Alias": "name", + "Name": "name", + }], + "TypeCondition": "Human", + }, + { + "SelectionSet": [{ + "Alias": "name", + "Name": "name", + }], + "TypeCondition": "Droid", + }, + { + "SelectionSet": [{ + "Alias": "name", + "Name": "name", + }], + "TypeCondition": "Starship", + }, + ], + }], + }]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/graphql/test-graphql-is-valid.yaml b/test/cases/testdata/v1/graphql/test-graphql-is-valid.yaml new file mode 100644 index 0000000000..5e568bd396 --- /dev/null +++ b/test/cases/testdata/v1/graphql/test-graphql-is-valid.yaml @@ -0,0 +1,184 @@ +--- +cases: + - note: graphql_is_valid/success extending non-existent types + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type User { + id: ID! + } + extend type Product { + upc: String! + } + union _Entity = Product | User + extend type Query { + entity: _Entity + } + ` + + query := ` + { + entity { + ... on User { + id + } + } + } + ` + + p if { + graphql.is_valid(query, schema) + } + want_result: + - x: true + - note: graphql_is_valid/success validation rules are independent case 1 + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Query { + myAction(myEnum: Locale!): SomeResult! + } + type SomeResult { + id: String + } + enum Locale { + EN + LT + DE + } + ` + + query := ` + query SomeOperation { + # Note: Not providing mandatory parameter: (myEnum: Locale!) + myAction { + id + } + } + ` + + # We use the unification style from semver's is_valid tests here: + p := x if { + x = graphql.is_valid(query, schema) + } + want_result: + - x: false + - note: graphql_is_valid/success validation rules are independent case 2 + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Query { + myAction(myEnum: Locale!): SomeResult! + } + type SomeResult { + id: String + } + enum Locale { + EN + LT + DE + } + ` + + query := ` + # Note: there is default enum value in variables + query SomeOperation ($locale: Locale! = DE) { + myAction(myEnum: $locale) { + id + } + } + ` + + p if { + graphql.is_valid(query, schema) + } + want_result: + - x: true + - note: graphql_is_valid/success deprecating types + query: data.test.p = x + modules: + - | + package test + + schema := ` + type DeprecatedType { + deprecatedField: String @deprecated + newField(deprecatedArg: Int): Boolean + } + enum DeprecatedEnum { + ALPHA @deprecated + } + ` + + query := `` + + p if { + graphql.is_valid(query, schema) + } + want_result: + - x: true + - note: graphql_is_valid/success no unused variables + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Query { + bar: String! + } + ` + + query := ` + query Foo($flag: Boolean!) { + ...Bar + } + fragment Bar on Query { + bar @include(if: $flag) + } + ` + + p if { + graphql.is_valid(query, schema) + } + want_result: + - x: true + - note: graphql_is_valid/success - AST objects - Employee example + query: data.test.p = x + modules: + - | + package test + + schema_ast := graphql.parse_schema(` + type Employee { + id: String! + salary: Int! + } + + schema { + query: Query + } + + type Query { + employeeByID(id: String): Employee + } + `) + + query_ast := graphql.parse_query(` + query { employeeByID(id: "alice") { salary }} + `) + + p if { + graphql.is_valid(query_ast, schema_ast) + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/graphql/test-graphql-parse-and-verify.yaml b/test/cases/testdata/v1/graphql/test-graphql-parse-and-verify.yaml new file mode 100644 index 0000000000..bb4f0950ef --- /dev/null +++ b/test/cases/testdata/v1/graphql/test-graphql-parse-and-verify.yaml @@ -0,0 +1,195 @@ +--- +cases: + - note: graphql_parse_and_verify/success extending non-existent types + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type User { + id: ID! + } + extend type Product { + upc: String! + } + union _Entity = Product | User + extend type Query { + entity: _Entity + } + ` + + query := ` + { + entity { + ... on User { + id + } + } + } + ` + + q_ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "entity", "Name": "entity", "SelectionSet": [{"SelectionSet": [{"Alias": "id", "Name": "id"}], "TypeCondition": "User"}]}]}]} + + p if { + [valid, q_ast, _] = graphql.parse_and_verify(query, schema) + valid + } + want_result: + - x: true + - note: graphql_parse_and_verify/success validation rules are independent case 1 + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Query { + myAction(myEnum: Locale!): SomeResult! + } + type SomeResult { + id: String + } + enum Locale { + EN + LT + DE + } + ` + + query := ` + query SomeOperation { + # Note: Not providing mandatory parameter: (myEnum: Locale!) + myAction { + id + } + } + ` + + p if { + [valid, q_ast, _] = graphql.parse_and_verify(query, schema) + not valid + } + want_result: + - x: true + - note: graphql_parse_and_verify/success validation rules are independent case 2 + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Query { + myAction(myEnum: Locale!): SomeResult! + } + type SomeResult { + id: String + } + enum Locale { + EN + LT + DE + } + ` + + query := ` + # Note: there is default enum value in variables + query SomeOperation ($locale: Locale! = DE) { + myAction(myEnum: $locale) { + id + } + } + ` + + q_ast := {"Operations": [{"Name": "SomeOperation", "Operation": "query", "SelectionSet": [{"Alias": "myAction", "Arguments": [{"Name": "myEnum", "Value": {"Kind": 0, "Raw": "locale"}}], "Name": "myAction", "SelectionSet": [{"Alias": "id", "Name": "id"}]}], "VariableDefinitions": [{"DefaultValue": {"Kind": 7, "Raw": "DE"}, "Type": {"NamedType": "Locale", "NonNull": true}, "Used": false, "Variable": "locale"}]}]} + + p if { + [valid, q_ast, _] = graphql.parse_and_verify(query, schema) + valid + } + want_result: + - x: true + - note: graphql_parse_and_verify/success deprecating types + query: data.test.p = x + modules: + - | + package test + + schema := ` + type DeprecatedType { + deprecatedField: String @deprecated + newField(deprecatedArg: Int): Boolean + } + enum DeprecatedEnum { + ALPHA @deprecated + } + ` + + query := `` + + p if { + [valid, {}, _] = graphql.parse_and_verify(query, schema) + valid + } + want_result: + - x: true + - note: graphql_parse_and_verify/success no unused variables + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Query { + bar: String! + } + ` + + query := ` + query Foo($flag: Boolean!) { + ...Bar + } + fragment Bar on Query { + bar @include(if: $flag) + } + ` + + q_ast := {"Fragments": [{"Name": "Bar", "SelectionSet": [{"Alias": "bar", "Directives": [{"Arguments": [{"Name": "if", "Value": {"Kind": 0, "Raw": "flag"}}], "Location": "", "Name": "include"}], "Name": "bar"}], "TypeCondition": "Query"}], "Operations": [{"Name": "Foo", "Operation": "query", "SelectionSet": [{"Name": "Bar"}], "VariableDefinitions": [{"Type": {"NamedType": "Boolean", "NonNull": true}, "Used": false, "Variable": "flag"}]}]} + + p if { + [valid, q_ast, _] = graphql.parse_and_verify(query, schema) + valid + } + want_result: + - x: true + - note: graphql_parse_and_verify/success - AST objects - Employee example + query: data.test.p = x + modules: + - | + package test + + schema_ast := graphql.parse_schema(` + type Employee { + id: String! + salary: Int! + } + + schema { + query: Query + } + + type Query { + employeeByID(id: String): Employee + } + `) + + query_ast := graphql.parse_query(` + query { employeeByID(id: "alice") { salary }} + `) + + p if { + [valid, query_ast, schema_ast] = graphql.parse_and_verify(query_ast, schema_ast) + valid + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/graphql/test-graphql-parse-query.yaml b/test/cases/testdata/v1/graphql/test-graphql-parse-query.yaml new file mode 100644 index 0000000000..9b9fe751c2 --- /dev/null +++ b/test/cases/testdata/v1/graphql/test-graphql-parse-query.yaml @@ -0,0 +1,509 @@ +--- +cases: + - note: graphql_parse_query/failure-unclosed paren + query: data.test.p = x + modules: + - | + package test + + p if { + graphql.parse_query(`{`) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_query: Expected Name, found in GraphQL string at location 1:2" + strict_error: true + - note: graphql_parse_query/failure-missing on in fragment + query: data.test.p = x + modules: + - | + package test + + gql := ` + { ...MissingOn } + fragment MissingOn Type + ` + + p if { + graphql.parse_query(gql) + } + want_error_code: eval_builtin_error + want_error: 'graphql.parse_query: Expected "on", found Name "Type" in GraphQL string at location 3:22' + strict_error: true + - note: graphql_parse_query/failure-missing name after alias + query: data.test.p = x + modules: + - | + package test + + gql := `{ field: {} }` + + p if { + graphql.parse_query(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_query: Expected Name, found { in GraphQL string at location 1:10" + strict_error: true + - note: graphql_parse_query/failure-not an operation + query: data.test.p = x + modules: + - | + package test + + gql := `notanoperation Foo { field }` + + p if { + graphql.parse_query(gql) + } + want_error_code: eval_builtin_error + want_error: 'graphql.parse_query: Unexpected Name "notanoperation" in GraphQL string at location 1:1' + strict_error: true + - note: graphql_parse_query/failure-a wild splat appears + query: data.test.p = x + modules: + - | + package test + + gql := `...` + + p if { + graphql.parse_query(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_query: Unexpected ... in GraphQL string at location 1:1" + strict_error: true + - note: graphql_parse_query/success-variables are allowed in args + query: data.test.p = x + modules: + - | + package test + + gql := `{ field(complex: { a: { b: [ $var ] } }) }` + + ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "field", "Arguments": [{"Name": "complex", "Value": {"Children": [{"Name": "a", "Value": {"Children": [{"Name": "b", "Value": {"Children": [{"Name": "", "Value": {"Kind": 0, "Raw": "var"}}], "Kind": 8, "Raw": ""}}], "Kind": 9, "Raw": ""}}], "Kind": 9, "Raw": ""}}], "Name": "field"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/failure-variables are not allowed in default args + query: data.test.p = x + modules: + - | + package test + + gql := `query Foo($x: Complex = { a: { b: [ $var ] } }) { field }` + + p if { + graphql.parse_query(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_query: Unexpected $ in GraphQL string at location 1:37" + strict_error: true + - note: graphql_parse_query/success-variables can have directives + query: data.test.p = x + modules: + - | + package test + + gql := `query ($withDirective: String @first @second, $withoutDirective: String) { f }` + + ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "f", "Name": "f"}], "VariableDefinitions": [{"Directives": [{"Location": "", "Name": "first"}, {"Location": "", "Name": "second"}], "Type": {"NamedType": "String", "NonNull": false}, "Used": false, "Variable": "withDirective"}, {"Type": {"NamedType": "String", "NonNull": false}, "Used": false, "Variable": "withoutDirective"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/failure-fragment can not be named 'on' + query: data.test.p = x + modules: + - | + package test + + gql := `fragment on on on { on }` + + p if { + graphql.parse_query(gql) + } + want_error_code: eval_builtin_error + want_error: 'graphql.parse_query: Unexpected Name "on" in GraphQL string at location 1:10' + strict_error: true + - note: graphql_parse_query/failure-fragment can not spread fragments called 'on' + query: data.test.p = x + modules: + - | + package test + + gql := `{ ...on }` + + p if { + graphql.parse_query(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_query: Expected Name, found } in GraphQL string at location 1:9" + strict_error: true + - note: graphql_parse_query/success-encoding multibyte characters are supported + query: data.test.p = x + modules: + - | + package test + + gql := ` + # This comment has a ਊ multi-byte character. + { field(arg: "Has a ਊ multi-byte character.") } + ` + + ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "field", "Arguments": [{"Name": "arg", "Value": {"Kind": 3, "Raw": "Has a ਊ multi-byte character."}}], "Name": "field"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-keywords-allowed-where-names-are on + query: data.test.p = x + modules: + - | + package test + + gql := ` + query on { + ... a + ... on on { field } + } + fragment a on Type { + on(on: $on) + @on(on: on) + } + ` + + ast := {"Fragments": [{"Name": "a", "SelectionSet": [{"Alias": "on", "Arguments": [{"Name": "on", "Value": {"Kind": 0, "Raw": "on"}}], "Directives": [{"Arguments": [{"Name": "on", "Value": {"Kind": 7, "Raw": "on"}}], "Location": "", "Name": "on"}], "Name": "on"}], "TypeCondition": "Type"}], "Operations": [{"Name": "on", "Operation": "query", "SelectionSet": [{"Name": "a"}, {"SelectionSet": [{"Alias": "field", "Name": "field"}], "TypeCondition": "on"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-keywords-allowed-where-names-are subscription + query: data.test.p = x + modules: + - | + package test + + gql := ` + query subscription { + ... subscription + ... on subscription { field } + } + fragment subscription on Type { + subscription(subscription: $subscription) + @subscription(subscription: subscription) + } + ` + + ast := {"Fragments": [{"Name": "subscription", "SelectionSet": [{"Alias": "subscription", "Arguments": [{"Name": "subscription", "Value": {"Kind": 0, "Raw": "subscription"}}], "Directives": [{"Arguments": [{"Name": "subscription", "Value": {"Kind": 7, "Raw": "subscription"}}], "Location": "", "Name": "subscription"}], "Name": "subscription"}], "TypeCondition": "Type"}], "Operations": [{"Name": "subscription", "Operation": "query", "SelectionSet": [{"Name": "subscription"}, {"SelectionSet": [{"Alias": "field", "Name": "field"}], "TypeCondition": "subscription"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-keywords-allowed-where-names-are true + query: data.test.p = x + modules: + - | + package test + + gql := ` + query true { + ... true + ... on true { field } + } + fragment true on Type { + true(true: $true) + @true(true: true) + } + ` + + ast := {"Fragments": [{"Name": "true", "SelectionSet": [{"Alias": "true", "Arguments": [{"Name": "true", "Value": {"Kind": 0, "Raw": "true"}}], "Directives": [{"Arguments": [{"Name": "true", "Value": {"Kind": 5, "Raw": "true"}}], "Location": "", "Name": "true"}], "Name": "true"}], "TypeCondition": "Type"}], "Operations": [{"Name": "true", "Operation": "query", "SelectionSet": [{"Name": "true"}, {"SelectionSet": [{"Alias": "field", "Name": "field"}], "TypeCondition": "true"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-operations anonymous mutation + query: data.test.p = x + modules: + - | + package test + + gql := `mutation { mutationField }` + + ast := {"Operations": [{"Name": "", "Operation": "mutation", "SelectionSet": [{"Alias": "mutationField", "Name": "mutationField"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-operations named mutation + query: data.test.p = x + modules: + - | + package test + + gql := `mutation Foo { mutationField }` + + ast := {"Operations": [{"Name": "Foo", "Operation": "mutation", "SelectionSet": [{"Alias": "mutationField", "Name": "mutationField"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-operations anonymous subscription + query: data.test.p = x + modules: + - | + package test + + gql := `subscription { subscriptionField }` + + ast := {"Operations": [{"Name": "", "Operation": "subscription", "SelectionSet": [{"Alias": "subscriptionField", "Name": "subscriptionField"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-operations named subscription + query: data.test.p = x + modules: + - | + package test + + gql := `subscription Foo { subscriptionField }` + + ast := {"Operations": [{"Name": "Foo", "Operation": "subscription", "SelectionSet": [{"Alias": "subscriptionField", "Name": "subscriptionField"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-ast simple query + query: data.test.p = x + modules: + - | + package test + + gql := ` + { + node(id: 4) { + id, + name + } + } + ` + + ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "node", "Arguments": [{"Name": "id", "Value": {"Kind": 1, "Raw": "4"}}], "Name": "node", "SelectionSet": [{"Alias": "id", "Name": "id"}, {"Alias": "name", "Name": "name"}]}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-ast nameless query with no variables + query: data.test.p = x + modules: + - | + package test + + gql := ` + query { + node { + id + } + } + ` + + ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "node", "Name": "node", "SelectionSet": [{"Alias": "id", "Name": "id"}]}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-ast fragment defined variables + query: data.test.p = x + modules: + - | + package test + + gql := `fragment a($v: Boolean = false) on t { f(v: $v) }` + + ast := {"Fragments": [{"Name": "a", "SelectionSet": [{"Alias": "f", "Arguments": [{"Name": "v", "Value": {"Kind": 0, "Raw": "v"}}], "Name": "f"}], "TypeCondition": "t", "VariableDefinition": [{"DefaultValue": {"Kind": 5, "Raw": "false"}, "Type": {"NamedType": "Boolean", "NonNull": false}, "Used": false, "Variable": "v"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-values null + query: data.test.p = x + modules: + - | + package test + + gql := `{ f(id: null) }` + + ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "f", "Arguments": [{"Name": "id", "Value": {"Kind": 6, "Raw": "null"}}], "Name": "f"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-values strings + query: data.test.p = x + modules: + - | + package test + + gql := `{ f(long: """long""", short: "short") }` + + ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "f", "Arguments": [{"Name": "long", "Value": {"Kind": 4, "Raw": "long"}}, {"Name": "short", "Value": {"Kind": 3, "Raw": "short"}}], "Name": "f"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-values list + query: data.test.p = x + modules: + - | + package test + + gql := `{ f(id: [1,2]) }` + + ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "f", "Arguments": [{"Name": "id", "Value": {"Children": [{"Name": "", "Value": {"Kind": 1, "Raw": "1"}}, {"Name": "", "Value": {"Kind": 1, "Raw": "2"}}], "Kind": 8, "Raw": ""}}], "Name": "f"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-types common types + query: data.test.p = x + modules: + - | + package test + + gql := `query ($string: String, $int: Int, $arr: [Arr], $notnull: [Arr!]!) { f }` + + ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "f", "Name": "f"}], "VariableDefinitions": [{"Type": {"NamedType": "String", "NonNull": false}, "Used": false, "Variable": "string"}, {"Type": {"NamedType": "Int", "NonNull": false}, "Used": false, "Variable": "int"}, {"Type": {"Elem": {"NamedType": "Arr", "NonNull": false}, "NamedType": "", "NonNull": false}, "Used": false, "Variable": "arr"}, {"Type": {"Elem": {"NamedType": "Arr", "NonNull": true}, "NamedType": "", "NonNull": true}, "Used": false, "Variable": "notnull"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/success-large-queries kitchen sink + query: data.test.p = x + modules: + - | + package test + + gql := ` + # Copyright (c) 2015-present, Facebook, Inc. + # + # This source code is licensed under the MIT license found in the + # LICENSE file in the root directory of this source tree. + query queryName($foo: ComplexType, $site: Site = MOBILE) { + whoever123is: node(id: [123, 456]) { + id , + ... on User @defer { + field2 { + id , + alias: field1(first:10, after:$foo,) @include(if: $foo) { + id, + ...frag + } + } + } + ... @skip(unless: $foo) { + id + } + ... { + id + } + } + } + mutation likeStory { + like(story: 123) @defer { + story { + id + } + } + } + subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) { + storyLikeSubscribe(input: $input) { + story { + likers { + count + } + likeSentence { + text + } + } + } + } + fragment frag on Friend { + foo(size: $size, bar: $b, obj: {key: "value", block: """ + block string uses \""" + """}) + } + { + unnamed(truthy: true, falsey: false, nullish: null), + query + } + ` + + ast := {"Fragments": [{"Name": "frag", "SelectionSet": [{"Alias": "foo", "Arguments": [{"Name": "size", "Value": {"Kind": 0, "Raw": "size"}}, {"Name": "bar", "Value": {"Kind": 0, "Raw": "b"}}, {"Name": "obj", "Value": {"Children": [{"Name": "key", "Value": {"Kind": 3, "Raw": "value"}}, {"Name": "block", "Value": {"Kind": 4, "Raw": "block string uses \"\"\""}}], "Kind": 9, "Raw": ""}}], "Name": "foo"}], "TypeCondition": "Friend"}], "Operations": [{"Name": "queryName", "Operation": "query", "SelectionSet": [{"Alias": "whoever123is", "Arguments": [{"Name": "id", "Value": {"Children": [{"Name": "", "Value": {"Kind": 1, "Raw": "123"}}, {"Name": "", "Value": {"Kind": 1, "Raw": "456"}}], "Kind": 8, "Raw": ""}}], "Name": "node", "SelectionSet": [{"Alias": "id", "Name": "id"}, {"Directives": [{"Location": "", "Name": "defer"}], "SelectionSet": [{"Alias": "field2", "Name": "field2", "SelectionSet": [{"Alias": "id", "Name": "id"}, {"Alias": "alias", "Arguments": [{"Name": "first", "Value": {"Kind": 1, "Raw": "10"}}, {"Name": "after", "Value": {"Kind": 0, "Raw": "foo"}}], "Directives": [{"Arguments": [{"Name": "if", "Value": {"Kind": 0, "Raw": "foo"}}], "Location": "", "Name": "include"}], "Name": "field1", "SelectionSet": [{"Alias": "id", "Name": "id"}, {"Name": "frag"}]}]}], "TypeCondition": "User"}, {"Directives": [{"Arguments": [{"Name": "unless", "Value": {"Kind": 0, "Raw": "foo"}}], "Location": "", "Name": "skip"}], "SelectionSet": [{"Alias": "id", "Name": "id"}], "TypeCondition": ""}, {"SelectionSet": [{"Alias": "id", "Name": "id"}], "TypeCondition": ""}]}], "VariableDefinitions": [{"Type": {"NamedType": "ComplexType", "NonNull": false}, "Used": false, "Variable": "foo"}, {"DefaultValue": {"Kind": 7, "Raw": "MOBILE"}, "Type": {"NamedType": "Site", "NonNull": false}, "Used": false, "Variable": "site"}]}, {"Name": "likeStory", "Operation": "mutation", "SelectionSet": [{"Alias": "like", "Arguments": [{"Name": "story", "Value": {"Kind": 1, "Raw": "123"}}], "Directives": [{"Location": "", "Name": "defer"}], "Name": "like", "SelectionSet": [{"Alias": "story", "Name": "story", "SelectionSet": [{"Alias": "id", "Name": "id"}]}]}]}, {"Name": "StoryLikeSubscription", "Operation": "subscription", "SelectionSet": [{"Alias": "storyLikeSubscribe", "Arguments": [{"Name": "input", "Value": {"Kind": 0, "Raw": "input"}}], "Name": "storyLikeSubscribe", "SelectionSet": [{"Alias": "story", "Name": "story", "SelectionSet": [{"Alias": "likers", "Name": "likers", "SelectionSet": [{"Alias": "count", "Name": "count"}]}, {"Alias": "likeSentence", "Name": "likeSentence", "SelectionSet": [{"Alias": "text", "Name": "text"}]}]}]}], "VariableDefinitions": [{"Type": {"NamedType": "StoryLikeSubscribeInput", "NonNull": false}, "Used": false, "Variable": "input"}]}, {"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "unnamed", "Arguments": [{"Name": "truthy", "Value": {"Kind": 5, "Raw": "true"}}, {"Name": "falsey", "Value": {"Kind": 5, "Raw": "false"}}, {"Name": "nullish", "Value": {"Kind": 6, "Raw": "null"}}], "Name": "unnamed"}, {"Alias": "query", "Name": "query"}]}]} + + p if { + graphql.parse_query(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_query/failure-fuzzer 01 + query: data.test.p = x + modules: + - | + package test + + gql := `{__typename{...}}` + + p if { + graphql.parse_query(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_query: Expected {, found } in GraphQL string at location 1:16" + strict_error: true + - note: graphql_parse_query/failure-fuzzer 02 + query: data.test.p = x + modules: + - | + package test + + gql := `{...{__typename{...{}}}}` + + p if { + graphql.parse_query(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_query: expected at least one definition, found } in GraphQL string at location 1:21" + strict_error: true diff --git a/test/cases/testdata/v1/graphql/test-graphql-parse-schema.yaml b/test/cases/testdata/v1/graphql/test-graphql-parse-schema.yaml new file mode 100644 index 0000000000..ea94ae3a7d --- /dev/null +++ b/test/cases/testdata/v1/graphql/test-graphql-parse-schema.yaml @@ -0,0 +1,742 @@ +--- +cases: + - note: graphql_parse_schema/success-object-types simple + query: data.test.p = x + modules: + - | + package test + + gql := ` + type Hello { + world: String + } + ` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Description": "", "Name": "world", "Type": {"NamedType": "String", "NonNull": false}}], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-object-types with description + query: data.test.p = x + modules: + - | + package test + + gql := ` + "Description" + type Hello { + world: String + } + ` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "Description", "Fields": [{"Description": "", "Name": "world", "Type": {"NamedType": "String", "NonNull": false}}], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-object-types with block description + query: data.test.p = x + modules: + - | + package test + + gql := ` + """ + Description + """ + # Even with comments between them + type Hello { + world: String + } + ` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "Description", "Fields": [{"Description": "", "Name": "world", "Type": {"NamedType": "String", "NonNull": false}}], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-object-types with field arg + query: data.test.p = x + modules: + - | + package test + + gql := ` + type Hello { + world(flag: Boolean): String + } + ` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Arguments": [{"Description": "", "Name": "flag", "Type": {"NamedType": "Boolean", "NonNull": false}}], "Description": "", "Name": "world", "Type": {"NamedType": "String", "NonNull": false}}], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-object-types with field arg and default value + query: data.test.p = x + modules: + - | + package test + + gql := ` + type Hello { + world(flag: Boolean = true): String + } + ` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Arguments": [{"DefaultValue": {"Kind": 5, "Raw": "true"}, "Description": "", "Name": "flag", "Type": {"NamedType": "Boolean", "NonNull": false}}], "Description": "", "Name": "world", "Type": {"NamedType": "String", "NonNull": false}}], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-object-types with field list arg + query: data.test.p = x + modules: + - | + package test + + gql := ` + type Hello { + world(things: [String]): String + } + ` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Arguments": [{"Description": "", "Name": "things", "Type": {"Elem": {"NamedType": "String", "NonNull": false}, "NamedType": "", "NonNull": false}}], "Description": "", "Name": "world", "Type": {"NamedType": "String", "NonNull": false}}], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-object-types with two args + query: data.test.p = x + modules: + - | + package test + + gql := ` + type Hello { + world(argOne: Boolean, argTwo: Int): String + } + ` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Arguments": [{"Description": "", "Name": "argOne", "Type": {"NamedType": "Boolean", "NonNull": false}}, {"Description": "", "Name": "argTwo", "Type": {"NamedType": "Int", "NonNull": false}}], "Description": "", "Name": "world", "Type": {"NamedType": "String", "NonNull": false}}], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/failure-object-types must define one or more fields + query: data.test.p = x + modules: + - | + package test + + gql := `type Hello {}` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: expected at least one definition, found } in GraphQL string at location 1:13" + strict_error: true + - note: graphql_parse_schema/success-type-extensions Object extension + query: data.test.p = x + modules: + - | + package test + + gql := ` + extend type Hello { + world: String + } + ` + + ast := {"Extensions": [{"BuiltIn": false, "Description": "", "Fields": [{"Description": "", "Name": "world", "Type": {"NamedType": "String", "NonNull": false}}], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-type-extensions without any fields + query: data.test.p = x + modules: + - | + package test + + gql := `extend type Hello implements Greeting` + + ast := {"Extensions": [{"BuiltIn": false, "Description": "", "Interfaces": ["Greeting"], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-type-extensions without fields twice + query: data.test.p = x + modules: + - | + package test + + gql := ` + extend type Hello implements Greeting + extend type Hello implements SecondGreeting + ` + + ast := {"Extensions": [{"BuiltIn": false, "Description": "", "Interfaces": ["Greeting"], "Kind": "OBJECT", "Name": "Hello"}, {"BuiltIn": false, "Description": "", "Interfaces": ["SecondGreeting"], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/failure-type-extensions without anything errors + query: data.test.p = x + modules: + - | + package test + + gql := `extend type Hello` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: Unexpected in GraphQL string at location 1:18" + strict_error: true + - note: graphql_parse_schema/failure-type-extensions can have descriptions + query: data.test.p = x + modules: + - | + package test + + gql := ` + "Description" + extend type Hello { + world: String + } + ` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: 'graphql.parse_schema: Unexpected String "Description" in GraphQL string at location 2:4' + strict_error: true + - note: graphql_parse_schema/failure-type-extensions can not have descriptions on types + query: data.test.p = x + modules: + - | + package test + + gql := ` + extend "Description" type Hello { + world: String + } + ` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: 'graphql.parse_schema: Unexpected String "Description" in GraphQL string at location 2:11' + strict_error: true + - note: graphql_parse_schema/success-type-extensions all can have directives + query: data.test.p = x + modules: + - | + package test + + gql := ` + extend scalar Foo @deprecated + extend type Foo @deprecated + extend interface Foo @deprecated + extend union Foo @deprecated + extend enum Foo @deprecated + extend input Foo @deprecated + ` + + ast := {"Extensions": [{"BuiltIn": false, "Description": "", "Directives": [{"Location": "", "Name": "deprecated"}], "Kind": "SCALAR", "Name": "Foo"}, {"BuiltIn": false, "Description": "", "Directives": [{"Location": "", "Name": "deprecated"}], "Kind": "OBJECT", "Name": "Foo"}, {"BuiltIn": false, "Description": "", "Directives": [{"Location": "", "Name": "deprecated"}], "Kind": "INTERFACE", "Name": "Foo"}, {"BuiltIn": false, "Description": "", "Directives": [{"Location": "", "Name": "deprecated"}], "Kind": "UNION", "Name": "Foo"}, {"BuiltIn": false, "Description": "", "Directives": [{"Location": "", "Name": "deprecated"}], "Kind": "ENUM", "Name": "Foo"}, {"BuiltIn": false, "Description": "", "Directives": [{"Location": "", "Name": "deprecated"}], "Kind": "INPUT_OBJECT", "Name": "Foo"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-schema-definition simple + query: data.test.p = x + modules: + - | + package test + + gql := ` + schema { + query: Query + } + ` + + ast := {"Schema": [{"Description": "", "OperationTypes": [{"Operation": "query", "Type": "Query"}]}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-schema-extensions simple + query: data.test.p = x + modules: + - | + package test + + gql := ` + extend schema { + mutation: Mutation + } + ` + + ast := {"SchemaExtension": [{"Description": "", "OperationTypes": [{"Operation": "mutation", "Type": "Mutation"}]}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-schema-extensions directive only + query: data.test.p = x + modules: + - | + package test + + gql := `extend schema @directive` + + ast := {"SchemaExtension": [{"Description": "", "Directives": [{"Location": "", "Name": "directive"}]}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/failure-schema-extensions without anything errors + query: data.test.p = x + modules: + - | + package test + + gql := `extend schema` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: Unexpected in GraphQL string at location 1:14" + strict_error: true + - note: graphql_parse_schema/success-inheritance single + query: data.test.p = x + modules: + - | + package test + + gql := `type Hello implements World { field: String }` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Description": "", "Name": "field", "Type": {"NamedType": "String", "NonNull": false}}], "Interfaces": ["World"], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-inheritance multi + query: data.test.p = x + modules: + - | + package test + + gql := `type Hello implements Wo & rld { field: String }` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Description": "", "Name": "field", "Type": {"NamedType": "String", "NonNull": false}}], "Interfaces": ["Wo", "rld"], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-inheritance multi with leading amp + query: data.test.p = x + modules: + - | + package test + + gql := `type Hello implements & Wo & rld { field: String }` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Description": "", "Name": "field", "Type": {"NamedType": "String", "NonNull": false}}], "Interfaces": ["Wo", "rld"], "Kind": "OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-enums single value + query: data.test.p = x + modules: + - | + package test + + gql := `enum Hello { WORLD }` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "EnumValues": [{"Description": "", "Name": "WORLD"}], "Kind": "ENUM", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-enums double value + query: data.test.p = x + modules: + - | + package test + + gql := `enum Hello { WO, RLD }` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "EnumValues": [{"Description": "", "Name": "WO"}, {"Description": "", "Name": "RLD"}], "Kind": "ENUM", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) + } + want_result: + - x: true + - note: graphql_parse_schema/failure-enums must define one or more unique enum values + query: data.test.p = x + modules: + - | + package test + + gql := `enum Hello {}` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: expected at least one definition, found } in GraphQL string at location 1:13" + strict_error: true + - note: graphql_parse_schema/success-interface simple + query: data.test.p = x + modules: + - | + package test + + gql := ` + interface Hello { + world: String + } + ` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Description": "", "Name": "world", "Type": {"NamedType": "String", "NonNull": false}}], "Kind": "INTERFACE", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/failure-interface must define one or more fields + query: data.test.p = x + modules: + - | + package test + + gql := `interface Hello {}` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: expected at least one definition, found } in GraphQL string at location 1:18" + strict_error: true + - note: graphql_parse_schema/success-interface may define intermediate interfaces + query: data.test.p = x + modules: + - | + package test + + gql := ` + interface IA { + id: ID! + } + interface IIA implements IA { + id: ID! + } + type A implements IIA { + id: ID! + } + ` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Description": "", "Name": "id", "Type": {"NamedType": "ID", "NonNull": true}}], "Kind": "INTERFACE", "Name": "IA"}, {"BuiltIn": false, "Description": "", "Fields": [{"Description": "", "Name": "id", "Type": {"NamedType": "ID", "NonNull": true}}], "Interfaces": ["IA"], "Kind": "INTERFACE", "Name": "IIA"}, {"BuiltIn": false, "Description": "", "Fields": [{"Description": "", "Name": "id", "Type": {"NamedType": "ID", "NonNull": true}}], "Interfaces": ["IIA"], "Kind": "OBJECT", "Name": "A"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-unions simple + query: data.test.p = x + modules: + - | + package test + + gql := `union Hello = World` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Kind": "UNION", "Name": "Hello", "Types": ["World"]}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-unions with two types + query: data.test.p = x + modules: + - | + package test + + gql := `union Hello = Wo | Rld` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Kind": "UNION", "Name": "Hello", "Types": ["Wo", "Rld"]}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-unions with leading pipe + query: data.test.p = x + modules: + - | + package test + + gql := `union Hello = | Wo | Rld` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Kind": "UNION", "Name": "Hello", "Types": ["Wo", "Rld"]}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/failure-unions cant be empty + query: data.test.p = x + modules: + - | + package test + + gql := `union Hello = || Wo | Rld` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: Expected Name, found | in GraphQL string at location 1:16" + strict_error: true + - note: graphql_parse_schema/failure-unions cant double pipe + query: data.test.p = x + modules: + - | + package test + + gql := `union Hello = Wo || Rld` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: Expected Name, found | in GraphQL string at location 1:19" + strict_error: true + - note: graphql_parse_schema/failure-unions cant have trailing pipe + query: data.test.p = x + modules: + - | + package test + + gql := `union Hello = | Wo | Rld |` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: Expected Name, found in GraphQL string at location 1:27" + strict_error: true + - note: graphql_parse_schema/success-scalar simple + query: data.test.p = x + modules: + - | + package test + + gql := `scalar Hello` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Kind": "SCALAR", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-input-object simple + query: data.test.p = x + modules: + - | + package test + + gql := ` + input Hello { + world: String + } + ` + + ast := {"Definitions": [{"BuiltIn": false, "Description": "", "Fields": [{"Description": "", "Name": "world", "Type": {"NamedType": "String", "NonNull": false}}], "Kind": "INPUT_OBJECT", "Name": "Hello"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/failure-input-object can not have args + query: data.test.p = x + modules: + - | + package test + + gql := ` + input Hello { + world(foo: Int): String + } + ` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: Expected :, found ( in GraphQL string at location 3:10" + strict_error: true + - note: graphql_parse_schema/failure-input-object must define one or more input fields + query: data.test.p = x + modules: + - | + package test + + gql := `input Hello {}` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: expected at least one definition, found } in GraphQL string at location 1:14" + strict_error: true + - note: graphql_parse_schema/success-directives simple + query: data.test.p = x + modules: + - | + package test + + gql := `directive @foo on FIELD` + + ast := {"Directives": [{"Description": "", "IsRepeatable": false, "Locations": ["FIELD"], "Name": "foo"}]} + + p if { + graphql.parse_schema(gql) + } + want_result: + - x: true + - note: graphql_parse_schema/success-directives executable + query: data.test.p = x + modules: + - | + package test + + gql := ` + directive @onQuery on QUERY + directive @onMutation on MUTATION + directive @onSubscription on SUBSCRIPTION + directive @onField on FIELD + directive @onFragmentDefinition on FRAGMENT_DEFINITION + directive @onFragmentSpread on FRAGMENT_SPREAD + directive @onInlineFragment on INLINE_FRAGMENT + directive @onVariableDefinition on VARIABLE_DEFINITION + ` + + ast := {"Directives": [{"Description": "", "IsRepeatable": false, "Locations": ["QUERY"], "Name": "onQuery"}, {"Description": "", "IsRepeatable": false, "Locations": ["MUTATION"], "Name": "onMutation"}, {"Description": "", "IsRepeatable": false, "Locations": ["SUBSCRIPTION"], "Name": "onSubscription"}, {"Description": "", "IsRepeatable": false, "Locations": ["FIELD"], "Name": "onField"}, {"Description": "", "IsRepeatable": false, "Locations": ["FRAGMENT_DEFINITION"], "Name": "onFragmentDefinition"}, {"Description": "", "IsRepeatable": false, "Locations": ["FRAGMENT_SPREAD"], "Name": "onFragmentSpread"}, {"Description": "", "IsRepeatable": false, "Locations": ["INLINE_FRAGMENT"], "Name": "onInlineFragment"}, {"Description": "", "IsRepeatable": false, "Locations": ["VARIABLE_DEFINITION"], "Name": "onVariableDefinition"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/success-directives repeatable + query: data.test.p = x + modules: + - | + package test + + gql := `directive @foo repeatable on FIELD` + + ast := {"Directives": [{"Description": "", "IsRepeatable": true, "Locations": ["FIELD"], "Name": "foo"}]} + + p if { + graphql.parse_schema(gql) == ast + } + want_result: + - x: true + - note: graphql_parse_schema/failure-directives invalid location + query: data.test.p = x + modules: + - | + package test + + gql := `directive @foo on FIELD | INCORRECT_LOCATION` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: 'graphql.parse_schema: Unexpected Name "INCORRECT_LOCATION" in GraphQL string at location 1:27' + strict_error: true + - note: graphql_parse_schema/failure-fuzzer 1 + query: data.test.p = x + modules: + - | + package test + + gql := `type o{d(g:[` + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: Expected Name, found in GraphQL string at location 1:13" + strict_error: true + - note: graphql_parse_schema/failure-fuzzer 2 + query: data.test.p = x + modules: + - | + package test + + gql := "\"\"\"\r" + + p if { + graphql.parse_schema(gql) + } + want_error_code: eval_builtin_error + want_error: "graphql.parse_schema: Unexpected in GraphQL string at location 2:1" + strict_error: true diff --git a/test/cases/testdata/v1/graphql/test-graphql-parse.yaml b/test/cases/testdata/v1/graphql/test-graphql-parse.yaml new file mode 100644 index 0000000000..47ee92ffe7 --- /dev/null +++ b/test/cases/testdata/v1/graphql/test-graphql-parse.yaml @@ -0,0 +1,190 @@ +--- +cases: + - note: graphql_parse/success extending non-existent types + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type User { + id: ID! + } + extend type Product { + upc: String! + } + union _Entity = Product | User + extend type Query { + entity: _Entity + } + ` + + query := ` + { + entity { + ... on User { + id + } + } + } + ` + + q_ast := {"Operations": [{"Name": "", "Operation": "query", "SelectionSet": [{"Alias": "entity", "Name": "entity", "SelectionSet": [{"SelectionSet": [{"Alias": "id", "Name": "id"}], "TypeCondition": "User"}]}]}]} + + p if { + [q_ast, _] = graphql.parse(query, schema) + } + want_result: + - x: true + - note: graphql_parse/failure validation rules are independent case 1 + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Query { + myAction(myEnum: Locale!): SomeResult! + } + type SomeResult { + id: String + } + enum Locale { + EN + LT + DE + } + ` + + query := ` + query SomeOperation { + # Note: Not providing mandatory parameter: (myEnum: Locale!) + myAction { + id + } + } + ` + + p if { + graphql.parse(query, schema) + } + want_error_code: eval_builtin_error + want_error: 'graphql.parse: Field "myAction" argument "myEnum" of type "Locale!" is required, but it was not provided in GraphQL query string at location 4:5' + strict_error: true + - note: graphql_parse/success validation rules are independent case 2 + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Query { + myAction(myEnum: Locale!): SomeResult! + } + type SomeResult { + id: String + } + enum Locale { + EN + LT + DE + } + ` + + query := ` + # Note: there is default enum value in variables + query SomeOperation ($locale: Locale! = DE) { + myAction(myEnum: $locale) { + id + } + } + ` + + q_ast := {"Operations": [{"Name": "SomeOperation", "Operation": "query", "SelectionSet": [{"Alias": "myAction", "Arguments": [{"Name": "myEnum", "Value": {"Kind": 0, "Raw": "locale"}}], "Name": "myAction", "SelectionSet": [{"Alias": "id", "Name": "id"}]}], "VariableDefinitions": [{"DefaultValue": {"Kind": 7, "Raw": "DE"}, "Type": {"NamedType": "Locale", "NonNull": true}, "Used": false, "Variable": "locale"}]}]} + + p if { + [q_ast, _] = graphql.parse(query, schema) + } + want_result: + - x: true + - note: graphql_parse/success deprecating types + query: data.test.p = x + modules: + - | + package test + + schema := ` + type DeprecatedType { + deprecatedField: String @deprecated + newField(deprecatedArg: Int): Boolean + } + enum DeprecatedEnum { + ALPHA @deprecated + } + ` + + query := `` + + p if { + [{}, _] = graphql.parse(query, schema) + } + want_result: + - x: true + - note: graphql_parse/success no unused variables + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Query { + bar: String! + } + ` + + query := ` + query Foo($flag: Boolean!) { + ...Bar + } + fragment Bar on Query { + bar @include(if: $flag) + } + ` + + q_ast := {"Fragments": [{"Name": "Bar", "SelectionSet": [{"Alias": "bar", "Directives": [{"Arguments": [{"Name": "if", "Value": {"Kind": 0, "Raw": "flag"}}], "Location": "", "Name": "include"}], "Name": "bar"}], "TypeCondition": "Query"}], "Operations": [{"Name": "Foo", "Operation": "query", "SelectionSet": [{"Name": "Bar"}], "VariableDefinitions": [{"Type": {"NamedType": "Boolean", "NonNull": true}, "Used": false, "Variable": "flag"}]}]} + + p if { + [q_ast, _] = graphql.parse(query, schema) + } + want_result: + - x: true + - note: graphql_parse/success - AST objects - Employee example + query: data.test.p = x + modules: + - | + package test + + schema_ast := graphql.parse_schema(` + type Employee { + id: String! + salary: Int! + } + + schema { + query: Query + } + + type Query { + employeeByID(id: String): Employee + } + `) + + query_ast := graphql.parse_query(` + query { employeeByID(id: "alice") { salary }} + `) + + p if { + [query_ast, schema_ast] = graphql.parse(query_ast, schema_ast) + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/graphql/test-graphql-schema-is-valid.yaml b/test/cases/testdata/v1/graphql/test-graphql-schema-is-valid.yaml new file mode 100644 index 0000000000..6d828e085f --- /dev/null +++ b/test/cases/testdata/v1/graphql/test-graphql-schema-is-valid.yaml @@ -0,0 +1,805 @@ +--- +cases: + - note: graphql_schema_is_valid/success extending non-existent types + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type User { + id: ID! + } + extend type Product { + upc: String! + } + union _Entity = Product | User + extend type Query { + entity: _Entity + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success validation rules are independent case 1 and 2 + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Query { + myAction(myEnum: Locale!): SomeResult! + } + type SomeResult { + id: String + } + enum Locale { + EN + LT + DE + } + ` + + # We use the unification style from semver's is_valid tests here: + p := x if { + x = graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success deprecating types + query: data.test.p = x + modules: + - | + package test + + schema := ` + type DeprecatedType { + deprecatedField: String @deprecated + newField(deprecatedArg: Int): Boolean + } + enum DeprecatedEnum { + ALPHA @deprecated + } + ` + + query := `` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success no unused variables + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Query { + bar: String! + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success - AST objects - Employee example + query: data.test.p = x + modules: + - | + package test + + schema_ast := graphql.parse_schema(` + type Employee { + id: String! + salary: Int! + } + + schema { + query: Query + } + + type Query { + employeeByID(id: String): Employee + } + `) + + p if { + graphql.schema_is_valid(schema_ast) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-object-extensions simple + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Hello { + world: String + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-object-extensions with description + query: data.test.p = x + modules: + - | + package test + + schema := ` + "Description" + type Hello { + world: String + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-object-extensions with block description + query: data.test.p = x + modules: + - | + package test + + schema := ` + """ + Description + """ + # Even with comments between them + type Hello { + world: String + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-object-extensions with field arg + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Hello { + world(flag: Boolean): String + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-object-extensions with field arg and default value + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Hello { + world(flag: Boolean = true): String + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-object-extensions with field list arg + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Hello { + world(things: [String]): String + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-object-extensions with two args + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Hello { + world(argOne: Boolean, argTwo: Int): String + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/failure-object-extensions must define one or more fields + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Hello {} + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-type-extensions object extension + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Hello { + world: String + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-type-extensions without any fields + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Hello implements Greeting + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-type-extensions without fields twice + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Hello implements Greeting + extend type Hello implements SecondGreeting + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/failure-type-extensions without anything errors + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend type Hello + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/failure-type-extensions can have descriptions + query: data.test.p = x + modules: + - | + package test + + schema := ` + "Description" + extend type Hello { + world: String + } + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/failure-type-extensions can not have descriptions on types + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend "Description" type Hello { + world: String + } + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-type-extensions all can have directives + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend scalar Foo @deprecated + extend type Foo @deprecated + extend interface Foo @deprecated + extend union Foo @deprecated + extend enum Foo @deprecated + extend input Foo @deprecated + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-schema-definition simple + query: data.test.p = x + modules: + - | + package test + + schema := ` + schema { + query: Query + } + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-schema-extensions simple + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend schema { + mutation: Mutation + } + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-schema-extensions directive only + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend schema @directive + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/failure-schema-extensions without anything errors + query: data.test.p = x + modules: + - | + package test + + schema := ` + extend schema + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/failure-inheritance single + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Hello implements World { field: String } + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/failure-inheritance multi + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Hello implements Wo & rld { field: String } + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-inheritance multi with leading amp + query: data.test.p = x + modules: + - | + package test + + schema := ` + type Hello implements & Wo & rld { field: String } + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-enums single value + query: data.test.p = x + modules: + - | + package test + + schema := ` + enum Hello { WORLD } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-enums double value + query: data.test.p = x + modules: + - | + package test + + schema := ` + enum Hello { WO, RLD } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/failure-enums must define one or more unique enum values + query: data.test.p = x + modules: + - | + package test + + schema := ` + enum Hello {} + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-interface simple + query: data.test.p = x + modules: + - | + package test + + schema := ` + interface Hello { + world: String + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/failure-interface must define one or more fields + query: data.test.p = x + modules: + - | + package test + + schema := ` + interface Hello {} + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/failure-interface may define intermediate interfaces + query: data.test.p = x + modules: + - | + package test + + schema := ` + interface IA { + id: ID! + } + interface IIA implements IA { + id: ID! + } + type A implements IIA { + id: ID! + } + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-unions simple + query: data.test.p = x + modules: + - | + package test + + schema := ` + union Hello = World + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-unions with two types + query: data.test.p = x + modules: + - | + package test + + schema := ` + union Hello = Wo | Rld + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-unions with leading pipe + query: data.test.p = x + modules: + - | + package test + + schema := ` + union Hello = | Wo | Rld + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/failure-unions cant be empty + query: data.test.p = x + modules: + - | + package test + + schema := ` + union Hello = || Wo | Rld + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/failure-unions cant double pipe + query: data.test.p = x + modules: + - | + package test + + schema := ` + union Hello = Wo || Rld + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/failure-unions cant have trailing pipe + query: data.test.p = x + modules: + - | + package test + + schema := ` + union Hello = | Wo | Rld | + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-scalar simple + query: data.test.p = x + modules: + - | + package test + + schema := ` + scalar Hello + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-input-objects simple + query: data.test.p = x + modules: + - | + package test + + schema := ` + input Hello { + world: String + } + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/failure-input-objects can not have args + query: data.test.p = x + modules: + - | + package test + + schema := ` + input Hello { + world(foo: Int): String + } + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/failure-input-objects must define one or more input fields + query: data.test.p = x + modules: + - | + package test + + schema := ` + input Hello {} + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false + - note: graphql_schema_is_valid/success-directives simple + query: data.test.p = x + modules: + - | + package test + + schema := ` + directive @foo on FIELD + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-directives executable + query: data.test.p = x + modules: + - | + package test + + schema := ` + directive @onQuery on QUERY + directive @onMutation on MUTATION + directive @onSubscription on SUBSCRIPTION + directive @onField on FIELD + directive @onFragmentDefinition on FRAGMENT_DEFINITION + directive @onFragmentSpread on FRAGMENT_SPREAD + directive @onInlineFragment on INLINE_FRAGMENT + directive @onVariableDefinition on VARIABLE_DEFINITION + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/success-directives repeatable + query: data.test.p = x + modules: + - | + package test + + schema := ` + directive @foo repeatable on FIELD + ` + + p if { + graphql.schema_is_valid(schema) + } + want_result: + - x: true + - note: graphql_schema_is_valid/failure-directives invalid location + query: data.test.p = x + modules: + - | + package test + + schema := ` + directive @foo on FIELD | INCORRECT_LOCATION + ` + + p := x if { + x := graphql.schema_is_valid(schema) + } + want_result: + - x: false diff --git a/test/cases/testdata/v1/helloworld/test-helloworld-1.yaml b/test/cases/testdata/v1/helloworld/test-helloworld-1.yaml new file mode 100644 index 0000000000..fa878e19dc --- /dev/null +++ b/test/cases/testdata/v1/helloworld/test-helloworld-1.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: helloworld/test_case + query: data.test.p = x + modules: + - | + package test + + p := 7 if { + data.foo == q + } + + q := input.baz + data: + foo: bar + input: + baz: bar + want_result: + - x: 7 + - note: helloworld/another_test_for_builtin_error + query: 1 / 0 + want_error_code: eval_builtin_error + want_error: "div: divide by zero" + strict_error: true diff --git a/test/cases/testdata/v1/hexbuiltins/test-hexbuiltins-0939.yaml b/test/cases/testdata/v1/hexbuiltins/test-hexbuiltins-0939.yaml new file mode 100644 index 0000000000..e3ca5f4ca8 --- /dev/null +++ b/test/cases/testdata/v1/hexbuiltins/test-hexbuiltins-0939.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: hexbuiltins/hex_encode with string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + hex.encode("lorem ipsum", x) + } + want_result: + - x: 6c6f72656d20697073756d diff --git a/test/cases/testdata/v1/hexbuiltins/test-hexbuiltins-0940.yaml b/test/cases/testdata/v1/hexbuiltins/test-hexbuiltins-0940.yaml new file mode 100644 index 0000000000..f302e4292d --- /dev/null +++ b/test/cases/testdata/v1/hexbuiltins/test-hexbuiltins-0940.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: hexbuiltins/hex_decode with string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + hex.decode("6c6f72656d20697073756d", x) + } + want_result: + - x: lorem ipsum diff --git a/test/cases/testdata/v1/hexbuiltins/test-hexbuiltins-0941.yaml b/test/cases/testdata/v1/hexbuiltins/test-hexbuiltins-0941.yaml new file mode 100644 index 0000000000..10f850b831 --- /dev/null +++ b/test/cases/testdata/v1/hexbuiltins/test-hexbuiltins-0941.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: hexbuiltins/hex_decode with invalid hex encoded string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + hex.decode("fghijkl", x) + } + want_error_code: eval_builtin_error + want_error: "invalid byte: U+0067 'g'" + strict_error: true diff --git a/test/cases/testdata/v1/indexing/array-any.yaml b/test/cases/testdata/v1/indexing/array-any.yaml new file mode 100644 index 0000000000..e2314b777e --- /dev/null +++ b/test/cases/testdata/v1/indexing/array-any.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: indexing on any and arrays + query: data.indexing.p = x + modules: + - | + package indexing + + f(val) if { + [_, _] = val + } + + p if { + f([1, ["foo", "bar"]]) + } + data: {} + input_term: "{}" + want_result: + - x: true diff --git a/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0758.yaml b/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0758.yaml new file mode 100644 index 0000000000..06ab694a57 --- /dev/null +++ b/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0758.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: indirectreferences/array + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = [1, 2, 3] + __local0__[x] + } + data: {} + want_result: + - x: + - 0 + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0759.yaml b/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0759.yaml new file mode 100644 index 0000000000..c2f16f3fbc --- /dev/null +++ b/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0759.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: indirectreferences/call + query: data.generated.p = x + modules: + - | + package generated + + p if { + split("foo.bar", ".", __local0__) + __local0__[0] = "foo" + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0760.yaml b/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0760.yaml new file mode 100644 index 0000000000..862d4b978b --- /dev/null +++ b/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0760.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: indirectreferences/multiple call + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + split("foo.bar:qux", ".", __local0__) + __local2__ = __local0__[_] + split(__local2__, ":", __local1__) + __local1__[i] = x + } + data: {} + want_result: + - x: + - bar + - foo + - qux + sort_bindings: true diff --git a/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0761.yaml b/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0761.yaml new file mode 100644 index 0000000000..5246a106ac --- /dev/null +++ b/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0761.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: indirectreferences/user call + query: data.generated.p = x + modules: + - | + package generated + + fn(__local0__) := [__local0__] + + p contains x if { + data.generated.fn(1, __local1__) + x = __local1__[0] + } + data: {} + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0762.yaml b/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0762.yaml new file mode 100644 index 0000000000..f0354176e8 --- /dev/null +++ b/test/cases/testdata/v1/indirectreferences/test-indirectreferences-0762.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: indirectreferences/user call in comprehension + query: data.generated.p = x + modules: + - | + package generated + + fn(__local0__) := [__local0__] + + p contains x if { + __local2__ = [y | data.generated.fn(1, __local1__); y = __local1__] + x = __local2__[_][_] + } + data: {} + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/inputvalues/test-inputvalues-0977.yaml b/test/cases/testdata/v1/inputvalues/test-inputvalues-0977.yaml new file mode 100644 index 0000000000..7fa3f70a36 --- /dev/null +++ b/test/cases/testdata/v1/inputvalues/test-inputvalues-0977.yaml @@ -0,0 +1,65 @@ +--- +cases: + - note: inputvalues/loopback + query: data.z.loopback = x + modules: + - | + package z + + p if { + data.a[i] = x + input.req1.foo = x + input.req2.bar = x + data.z.q[x] + } + + q contains x if { + input.req1.foo = x + input.req2.bar = x + data.z.r[x] + } + + r contains x if { + __local1__ = input.req2.bar + __local2__ = input.req1.foo + {"bar": [x], "foo": __local1__} = {"bar": [__local2__], "foo": x} + } + + s if { + input.req3.a.b.x[0] = 1 + } + + t if { + input.req4.a.b.x[0] = 1 + } + + u contains x if { + input.req3.a.b[_] = x + x > 1 + } + + w := [[1, 2], [3, 4]] + + gt1 if { + __local3__ = input.req1 + __local3__ > 1 + } + + keys[x] := y if { + data.numbers[_] = x + to_number(x, y) + } + + loopback := __local0__ if { + true + __local0__ = input + } + + sets if { + input.foo[{1}][1] = 1 + } + data: {} + input_term: '{"foo": 1}' + want_result: + - x: + foo: 1 diff --git a/test/cases/testdata/v1/inputvalues/test-inputvalues-0978.yaml b/test/cases/testdata/v1/inputvalues/test-inputvalues-0978.yaml new file mode 100644 index 0000000000..48b16e15ac --- /dev/null +++ b/test/cases/testdata/v1/inputvalues/test-inputvalues-0978.yaml @@ -0,0 +1,68 @@ +--- +cases: + - note: inputvalues/loopback undefined + query: data.z.loopback = x + modules: + - | + package z + + p if { + data.a[i] = x + input.req1.foo = x + input.req2.bar = x + data.z.q[x] + } + + q contains x if { + input.req1.foo = x + input.req2.bar = x + data.z.r[x] + } + + r contains x if { + __local1__ = input.req2.bar + __local2__ = input.req1.foo + {"bar": [x], "foo": __local1__} = {"bar": [__local2__], "foo": x} + } + + s if { + input.req3.a.b.x[0] = 1 + } + + t if { + input.req4.a.b.x[0] = 1 + } + + u contains x if { + input.req3.a.b[_] = x + x > 1 + } + + w := [[1, 2], [3, 4]] + + gt1 if { + __local3__ = input.req1 + __local3__ > 1 + } + + keys[x] := y if { + data.numbers[_] = x + to_number(x, y) + } + + loopback := __local0__ if { + true + __local0__ = input + } + + sets if { + input.foo[{1}][1] = 1 + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = input + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/inputvalues/test-inputvalues-0979.yaml b/test/cases/testdata/v1/inputvalues/test-inputvalues-0979.yaml new file mode 100644 index 0000000000..dc45ab6096 --- /dev/null +++ b/test/cases/testdata/v1/inputvalues/test-inputvalues-0979.yaml @@ -0,0 +1,75 @@ +--- +cases: + - note: inputvalues/simple + query: data.z.p = x + modules: + - | + package z + + p if { + data.a[i] = x + input.req1.foo = x + input.req2.bar = x + data.z.q[x] + } + + q contains x if { + input.req1.foo = x + input.req2.bar = x + data.z.r[x] + } + + r contains x if { + __local1__ = input.req2.bar + __local2__ = input.req1.foo + {"bar": [x], "foo": __local1__} = {"bar": [__local2__], "foo": x} + } + + s if { + input.req3.a.b.x[0] = 1 + } + + t if { + input.req4.a.b.x[0] = 1 + } + + u contains x if { + input.req3.a.b[_] = x + x > 1 + } + + w := [[1, 2], [3, 4]] + + gt1 if { + __local3__ = input.req1 + __local3__ > 1 + } + + keys[x] := y if { + data.numbers[_] = x + to_number(x, y) + } + + loopback := __local0__ if { + true + __local0__ = input + } + + sets if { + input.foo[{1}][1] = 1 + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = input + } + data: + a: + - 1 + - 2 + - 3 + - 4 + input_term: '{"req1": {"foo": 4}, "req2": {"bar": 4}}' + want_result: + - x: true diff --git a/test/cases/testdata/v1/inputvalues/test-inputvalues-0980.yaml b/test/cases/testdata/v1/inputvalues/test-inputvalues-0980.yaml new file mode 100644 index 0000000000..ef7e4e19be --- /dev/null +++ b/test/cases/testdata/v1/inputvalues/test-inputvalues-0980.yaml @@ -0,0 +1,110 @@ +--- +cases: + - note: inputvalues/missing + query: data.z.p = x + modules: + - | + package z + + p if { + data.a[i] = x + input.req1.foo = x + input.req2.bar = x + data.z.q[x] + } + + q contains x if { + input.req1.foo = x + input.req2.bar = x + data.z.r[x] + } + + r contains x if { + __local1__ = input.req2.bar + __local2__ = input.req1.foo + {"bar": [x], "foo": __local1__} = {"bar": [__local2__], "foo": x} + } + + s if { + input.req3.a.b.x[0] = 1 + } + + t if { + input.req4.a.b.x[0] = 1 + } + + u contains x if { + input.req3.a.b[_] = x + x > 1 + } + + w := [[1, 2], [3, 4]] + + gt1 if { + __local3__ = input.req1 + __local3__ > 1 + } + + keys[x] := y if { + data.numbers[_] = x + to_number(x, y) + } + + loopback := __local0__ if { + true + __local0__ = input + } + + sets if { + input.foo[{1}][1] = 1 + } + - | + package topdown_test_partial + + __result__ := _result if { + input.req1.foo = 1 + input.req2.bar = 1 + input.req1.foo = 1 + input.req2.bar = 1 + 1 = input.req2.bar + 1 = input.req1.foo + _result = true + } + + __result__ := _result if { + input.req1.foo = 2 + input.req2.bar = 2 + input.req1.foo = 2 + input.req2.bar = 2 + 2 = input.req2.bar + 2 = input.req1.foo + _result = true + } + + __result__ := _result if { + input.req1.foo = 3 + input.req2.bar = 3 + input.req1.foo = 3 + input.req2.bar = 3 + 3 = input.req2.bar + 3 = input.req1.foo + _result = true + } + + __result__ := _result if { + input.req1.foo = 4 + input.req2.bar = 4 + input.req1.foo = 4 + input.req2.bar = 4 + 4 = input.req2.bar + 4 = input.req1.foo + _result = true + } + data: + a: + - 1 + - 2 + - 3 + - 4 + input_term: '{"req1": {"foo": 4}}' + want_result: [] diff --git a/test/cases/testdata/v1/inputvalues/test-inputvalues-0981.yaml b/test/cases/testdata/v1/inputvalues/test-inputvalues-0981.yaml new file mode 100644 index 0000000000..bbdfd20877 --- /dev/null +++ b/test/cases/testdata/v1/inputvalues/test-inputvalues-0981.yaml @@ -0,0 +1,106 @@ +--- +cases: + - note: inputvalues/namespaced + query: data.z.s = x + modules: + - | + package z + + p if { + data.a[i] = x + input.req1.foo = x + input.req2.bar = x + data.z.q[x] + } + + q contains x if { + input.req1.foo = x + input.req2.bar = x + data.z.r[x] + } + + r contains x if { + __local1__ = input.req2.bar + __local2__ = input.req1.foo + {"bar": [x], "foo": __local1__} = {"bar": [__local2__], "foo": x} + } + + s if { + input.req3.a.b.x[0] = 1 + } + + t if { + input.req4.a.b.x[0] = 1 + } + + u contains x if { + input.req3.a.b[_] = x + x > 1 + } + + w := [[1, 2], [3, 4]] + + gt1 if { + __local3__ = input.req1 + __local3__ > 1 + } + + keys[x] := y if { + data.numbers[_] = x + to_number(x, y) + } + + loopback := __local0__ if { + true + __local0__ = input + } + + sets if { + input.foo[{1}][1] = 1 + } + - | + package topdown_test_partial + + __result__ := _result if { + input.req1.foo = 1 + input.req2.bar = 1 + input.req1.foo = 1 + input.req2.bar = 1 + 1 = input.req2.bar + 1 = input.req1.foo + _result = true + } + + __result__ := _result if { + input.req1.foo = 2 + input.req2.bar = 2 + input.req1.foo = 2 + input.req2.bar = 2 + 2 = input.req2.bar + 2 = input.req1.foo + _result = true + } + + __result__ := _result if { + input.req1.foo = 3 + input.req2.bar = 3 + input.req1.foo = 3 + input.req2.bar = 3 + 3 = input.req2.bar + 3 = input.req1.foo + _result = true + } + + __result__ := _result if { + input.req1.foo = 4 + input.req2.bar = 4 + input.req1.foo = 4 + input.req2.bar = 4 + 4 = input.req2.bar + 4 = input.req1.foo + _result = true + } + data: {} + input_term: '{"req3": {"a": {"b": {"x": [1, 2, 3, 4]}}}}' + want_result: + - x: true diff --git a/test/cases/testdata/v1/inputvalues/test-inputvalues-0982.yaml b/test/cases/testdata/v1/inputvalues/test-inputvalues-0982.yaml new file mode 100644 index 0000000000..983b7cd3f3 --- /dev/null +++ b/test/cases/testdata/v1/inputvalues/test-inputvalues-0982.yaml @@ -0,0 +1,71 @@ +--- +cases: + - note: inputvalues/namespaced with alias + query: data.z.t = x + modules: + - | + package z + + p if { + data.a[i] = x + input.req1.foo = x + input.req2.bar = x + data.z.q[x] + } + + q contains x if { + input.req1.foo = x + input.req2.bar = x + data.z.r[x] + } + + r contains x if { + __local1__ = input.req2.bar + __local2__ = input.req1.foo + {"bar": [x], "foo": __local1__} = {"bar": [__local2__], "foo": x} + } + + s if { + input.req3.a.b.x[0] = 1 + } + + t if { + input.req4.a.b.x[0] = 1 + } + + u contains x if { + input.req3.a.b[_] = x + x > 1 + } + + w := [[1, 2], [3, 4]] + + gt1 if { + __local3__ = input.req1 + __local3__ > 1 + } + + keys[x] := y if { + data.numbers[_] = x + to_number(x, y) + } + + loopback := __local0__ if { + true + __local0__ = input + } + + sets if { + input.foo[{1}][1] = 1 + } + - | + package topdown_test_partial + + __result__ := _result if { + input.req3.a.b.x[0] = 1 + _result = true + } + data: {} + input_term: '{"req4": {"a": {"b": {"x": [1, 2, 3, 4]}}}}' + want_result: + - x: true diff --git a/test/cases/testdata/v1/inputvalues/test-inputvalues-0983.yaml b/test/cases/testdata/v1/inputvalues/test-inputvalues-0983.yaml new file mode 100644 index 0000000000..7ed59cf1c9 --- /dev/null +++ b/test/cases/testdata/v1/inputvalues/test-inputvalues-0983.yaml @@ -0,0 +1,71 @@ +--- +cases: + - note: inputvalues/input set + query: data.z.sets = x + modules: + - | + package z + + p if { + data.a[i] = x + input.req1.foo = x + input.req2.bar = x + data.z.q[x] + } + + q contains x if { + input.req1.foo = x + input.req2.bar = x + data.z.r[x] + } + + r contains x if { + __local1__ = input.req2.bar + __local2__ = input.req1.foo + {"bar": [x], "foo": __local1__} = {"bar": [__local2__], "foo": x} + } + + s if { + input.req3.a.b.x[0] = 1 + } + + t if { + input.req4.a.b.x[0] = 1 + } + + u contains x if { + input.req3.a.b[_] = x + x > 1 + } + + w := [[1, 2], [3, 4]] + + gt1 if { + __local3__ = input.req1 + __local3__ > 1 + } + + keys[x] := y if { + data.numbers[_] = x + to_number(x, y) + } + + loopback := __local0__ if { + true + __local0__ = input + } + + sets if { + input.foo[{1}][1] = 1 + } + - | + package topdown_test_partial + + __result__ := _result if { + input.req4.a.b.x[0] = 1 + _result = true + } + data: {} + input_term: '{"foo": {{1}}}' + want_result: + - x: true diff --git a/test/cases/testdata/v1/intersection/test-intersection-0352.yaml b/test/cases/testdata/v1/intersection/test-intersection-0352.yaml new file mode 100644 index 0000000000..c24a9ae543 --- /dev/null +++ b/test/cases/testdata/v1/intersection/test-intersection-0352.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: intersection/intersection_0_sets + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + intersection(set(), x) + } + data: {} + want_result: + - x: [] diff --git a/test/cases/testdata/v1/intersection/test-intersection-0353.yaml b/test/cases/testdata/v1/intersection/test-intersection-0353.yaml new file mode 100644 index 0000000000..7d3761b8c6 --- /dev/null +++ b/test/cases/testdata/v1/intersection/test-intersection-0353.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: intersection/intersection_2_sets + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + intersection({set(), {1, 2}}, x) + } + data: {} + want_result: + - x: [] diff --git a/test/cases/testdata/v1/intersection/test-intersection-0354.yaml b/test/cases/testdata/v1/intersection/test-intersection-0354.yaml new file mode 100644 index 0000000000..54006c48e4 --- /dev/null +++ b/test/cases/testdata/v1/intersection/test-intersection-0354.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: intersection/intersection_2_sets + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + s1 = {1, 2, 3} + s2 = {2} + intersection({s1, s2}, x) + } + data: {} + want_result: + - x: + - 2 diff --git a/test/cases/testdata/v1/intersection/test-intersection-0355.yaml b/test/cases/testdata/v1/intersection/test-intersection-0355.yaml new file mode 100644 index 0000000000..6917ad885a --- /dev/null +++ b/test/cases/testdata/v1/intersection/test-intersection-0355.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: intersection/intersection_3_sets + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + s1 = {1, 2, 3} + s2 = {2, 3, 4} + s3 = {4, 5, 6} + intersection({s1, s2, s3}, x) + } + data: {} + want_result: + - x: [] diff --git a/test/cases/testdata/v1/intersection/test-intersection-0356.yaml b/test/cases/testdata/v1/intersection/test-intersection-0356.yaml new file mode 100644 index 0000000000..1ccf04753b --- /dev/null +++ b/test/cases/testdata/v1/intersection/test-intersection-0356.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: intersection/intersection_4_sets + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + s1 = {"a", "b", "c", "d"} + s2 = {"b", "c", "d"} + s3 = {"c", "d"} + s4 = {"d"} + intersection({s1, s2, s3, s4}, x) + } + data: {} + want_result: + - x: + - d diff --git a/test/cases/testdata/v1/invalidkeyerror/test-invalidkeyerror-0176.yaml b/test/cases/testdata/v1/invalidkeyerror/test-invalidkeyerror-0176.yaml new file mode 100644 index 0000000000..d6992bf0b6 --- /dev/null +++ b/test/cases/testdata/v1/invalidkeyerror/test-invalidkeyerror-0176.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: invalidkeyerror/invalid keys + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + http.send({"bad_key": "bad_value", "method": "get", "url": "http://127.0.0.1:51113"}, x) + } + want_error_code: eval_type_error + want_error: 'invalid request parameters(s): {"bad_key"}' + strict_error: true diff --git a/test/cases/testdata/v1/invalidkeyerror/test-invalidkeyerror-0177.yaml b/test/cases/testdata/v1/invalidkeyerror/test-invalidkeyerror-0177.yaml new file mode 100644 index 0000000000..40790f32c4 --- /dev/null +++ b/test/cases/testdata/v1/invalidkeyerror/test-invalidkeyerror-0177.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: invalidkeyerror/missing keys + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + http.send({"method": "get"}, x) + } + want_error_code: eval_type_error + want_error: 'missing required request parameters(s): {"url"}' + strict_error: true diff --git a/test/cases/testdata/v1/jsonbuiltins/test-is-valid.yaml b/test/cases/testdata/v1/jsonbuiltins/test-is-valid.yaml new file mode 100644 index 0000000000..ff20809694 --- /dev/null +++ b/test/cases/testdata/v1/jsonbuiltins/test-is-valid.yaml @@ -0,0 +1,72 @@ +--- +cases: + - note: jsonbuiltins/json is_valid + query: data.generated.p = x + modules: + - | + package generated + + documents := [ + `plainstring`, + `{`, + `{"json": "ok"}`, + ] + + p := [x | doc = documents[_]; json.is_valid(doc, x)] + want_result: + - x: + - false + - false + - true + strict_error: true + - note: jsonbuiltins/json is_valid not string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + json.is_valid(input.foo, x) + } + input: + foo: 1 + want_result: + - x: false + strict_error: true + - note: jsonbuiltins/yaml is_valid + query: data.generated.p = x + modules: + - | + package generated + + documents := [ + `foo: + - qux: bar + - baz: 2`, + `foo: + - qux: bar + - baz: {`, + `{"json": "ok"}`, + ] + + p := [x | doc = documents[_]; yaml.is_valid(doc, x)] + want_result: + - x: + - true + - false + - true + strict_error: true + - note: jsonbuiltins/yaml is_valid not string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + yaml.is_valid(input.foo, x) + } + input: + foo: 1 + want_result: + - x: false + strict_error: true diff --git a/test/cases/testdata/v1/jsonbuiltins/test-json-marshal-with-options.yaml b/test/cases/testdata/v1/jsonbuiltins/test-json-marshal-with-options.yaml new file mode 100644 index 0000000000..fe433b72aa --- /dev/null +++ b/test/cases/testdata/v1/jsonbuiltins/test-json-marshal-with-options.yaml @@ -0,0 +1,143 @@ +--- +cases: + - note: jsonbuiltins/marshal_with_options-explicit-indent + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := json.marshal_with_options([1234500000 + 67890, 1e6 * 2, 1e109 / 1e100], {"indent": " "}) + } + data: {} + want_result: + - x: |- + [ + 1234567890, + 2000000, + 1000000000 + ] + - note: jsonbuiltins/marshal_with_options-empty-object + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := json.marshal_with_options([1234500000 + 67890, 1e6 * 2, 1e109 / 1e100], {}) + } + data: {} + want_result: + - x: "[1234567890,2000000,1000000000]" + - note: jsonbuiltins/marshal_with_options-defaults + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := json.marshal_with_options([1234500000 + 67890, 1e6 * 2, 1e109 / 1e100], {"pretty": true}) + } + data: {} + want_result: + - x: |- + [ + 1234567890, + 2000000, + 1000000000 + ] + - note: jsonbuiltins/marshal_with_options-explicit-disable + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := json.marshal_with_options([1234500000 + 67890, 1e6 * 2, 1e109 / 1e100], {"pretty": false, "prefix": "NO!", "indent": "BAD!"}) + } + data: {} + want_result: + - x: "[1234567890,2000000,1000000000]" + - note: jsonbuiltins/marshal_with_options-prefix + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := json.marshal_with_options([1234500000 + 67890, 1e6 * 2, 1e109 / 1e100], {"prefix": "JSON => "}) + } + data: {} + want_result: + - x: |- + JSON => [ + JSON => 1234567890, + JSON => 2000000, + JSON => 1000000000 + JSON => ] + - note: jsonbuiltins/marshal_with_options-object + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := json.marshal_with_options({"foo": "bar", "bar": "baz"}, {"prefix": "JSON => "}) + } + data: {} + want_result: + - x: |- + JSON => { + JSON => "bar": "baz", + JSON => "foo": "bar" + JSON => } + - note: jsonbuiltins/marshal_with_options-empty-array + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := json.marshal_with_options([], {"indent": " ", "prefix": "---"}) + } + data: {} + want_result: + - x: "---[]" + - note: jsonbuiltins/marshal_with_options-deep-array + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := json.marshal_with_options([[[[[[[]]]]]]], {"indent": " "}) + } + data: {} + want_result: + - x: |- + [ + [ + [ + [ + [ + [ + [] + ] + ] + ] + ] + ] + ] + - note: jsonbuiltins/marshal_with_options-invalid-key + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := json.marshal_with_options([], {"indent": " ", "include_winning_lottery_numbers": true}) + } + data: {} + want_error_code: eval_type_error + want_error: object contained unknown key "include_winning_lottery_numbers" + strict_error: true diff --git a/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0924.yaml b/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0924.yaml new file mode 100644 index 0000000000..c667516c86 --- /dev/null +++ b/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0924.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jsonbuiltins/marshal + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + json.marshal([{"foo": {1, 2, 3}}], x) + } + data: {} + want_result: + - x: '[{"foo":[1,2,3]}]' diff --git a/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0925.yaml b/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0925.yaml new file mode 100644 index 0000000000..1295672c83 --- /dev/null +++ b/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0925.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonbuiltins/unmarshal + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + json.unmarshal("[{\"foo\":[1,2,3]}]", x) + } + data: {} + want_result: + - x: + - foo: + - 1 + - 2 + - 3 diff --git a/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0926.yaml b/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0926.yaml new file mode 100644 index 0000000000..8349aee49b --- /dev/null +++ b/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0926.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: jsonbuiltins/unmarshal-non-string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = data.a[0] + json.unmarshal(__local0__, x) + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_error_code: eval_type_error + want_error: operand 1 must be string but got number + strict_error: true diff --git a/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0927.yaml b/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0927.yaml new file mode 100644 index 0000000000..923cecba16 --- /dev/null +++ b/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0927.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jsonbuiltins/yaml round-trip + query: data.generated.p = x + modules: + - | + package generated + + p := y if { + yaml.marshal([{"foo": {1, 2, 3}}], x) + yaml.unmarshal(x, y) + } + data: {} + want_result: + - x: + - foo: + - 1 + - 2 + - 3 diff --git a/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0928.yaml b/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0928.yaml new file mode 100644 index 0000000000..a594a5c7bc --- /dev/null +++ b/test/cases/testdata/v1/jsonbuiltins/test-jsonbuiltins-0928.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jsonbuiltins/yaml unmarshal error + query: data.generated.p = x + modules: + - | + package generated + + p if { + yaml.unmarshal("[1,2,3", _) + } + want_error_code: eval_builtin_error + want_error: "yaml: line 1: did not find" + strict_error: true diff --git a/test/cases/testdata/v1/jsonbuiltins/test-marshal-large-ints.yaml b/test/cases/testdata/v1/jsonbuiltins/test-marshal-large-ints.yaml new file mode 100644 index 0000000000..bdc608cba7 --- /dev/null +++ b/test/cases/testdata/v1/jsonbuiltins/test-marshal-large-ints.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jsonbuiltins/marshal large integers + query: data.test.p = x + modules: + - | + package test + + p := x if { + json.marshal([1234500000 + 67890, 1e6 * 2, 1e109 / 1e100], x) + } + data: {} + want_result: + - x: "[1234567890,2000000,1000000000]" diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0218.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0218.yaml new file mode 100644 index 0000000000..799fc619da --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0218.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonfilter/base + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({"a": {"b": {"c": 7, "d": 8}}, "e": 9}, {"a/b/c"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 7 diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0219.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0219.yaml new file mode 100644 index 0000000000..bb623a83de --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0219.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jsonfilter/multiple roots + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({"a": {"b": {"c": 7, "d": 8}}, "e": 9}, {"a/b/c", "e"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 7 + e: 9 diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0220.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0220.yaml new file mode 100644 index 0000000000..2868060bc0 --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0220.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jsonfilter/multiple roots array + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({"a": {"b": {"c": 7, "d": 8}}, "e": 9}, ["a/b/c", "e"], __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 7 + e: 9 diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0221.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0221.yaml new file mode 100644 index 0000000000..96583556e1 --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0221.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jsonfilter/shared roots + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({"a": {"b": {"c": 7, "d": 8}, "e": 9}}, {"a/b/c", "a/e"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 7 + e: 9 diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0222.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0222.yaml new file mode 100644 index 0000000000..2ee5f94f5e --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0222.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jsonfilter/conflict + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({"a": {"b": 7}}, {"a", "a/b"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: 7 diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0223.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0223.yaml new file mode 100644 index 0000000000..a84c8477eb --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0223.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jsonfilter/empty list + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({"a": 7}, set(), __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0224.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0224.yaml new file mode 100644 index 0000000000..cfc7b3c0f7 --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0224.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jsonfilter/empty object + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({}, {"a/b"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0225.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0225.yaml new file mode 100644 index 0000000000..b309a64fb7 --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0225.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonfilter/arrays + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({"a": [{"b": 7, "c": 8}, {"d": 9}]}, {"a/0/b", "a/1"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + - b: 7 + - d: 9 diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0226.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0226.yaml new file mode 100644 index 0000000000..26ff7700ef --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0226.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonfilter/object with number keys + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({"a": [{"1": ["b", "c", "d"]}, {"x": "y"}]}, {"a/0/1/2"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + - "1": + - d diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0227.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0227.yaml new file mode 100644 index 0000000000..f72035abfa --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0227.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jsonfilter/arrays of roots + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({"a": {"b": {"c": 7, "d": 8}}, "e": 9}, {["a", "b", "c"], ["e"]}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 7 + e: 9 diff --git a/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0228.yaml b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0228.yaml new file mode 100644 index 0000000000..910ab93932 --- /dev/null +++ b/test/cases/testdata/v1/jsonfilter/test-jsonfilter-0228.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jsonfilter/mixed root types + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.filter({"a": {"b": {"c": 7, "d": 8, "x": 0}}, "e": 9}, {"a/b/d", ["a", "b", "c"]}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 7 + d: 8 diff --git a/test/cases/testdata/v1/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml b/test/cases/testdata/v1/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml new file mode 100644 index 0000000000..e86833e7b8 --- /dev/null +++ b/test/cases/testdata/v1/jsonfilteridempotent/test-jsonfilteridempotent-0229.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jsonfilteridempotent/TestBuiltinJSONFilterIdempotent + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = {"a": {"b": 2, "c": 3}} + json.filter(__local0__, {"a/b"}, __local1__) + __local1__ = {"a": {"b": 2}} + json.filter(__local0__, {"a/c"}, __local2__) + __local2__ = {"a": {"c": 3}} + __local0__ = {"a": {"b": 2, "c": 3}} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jsonpatch/coverage.yaml b/test/cases/testdata/v1/jsonpatch/coverage.yaml new file mode 100644 index 0000000000..37ddba4046 --- /dev/null +++ b/test/cases/testdata/v1/jsonpatch/coverage.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jsonpatch/set-failure add-to-bad-path + query: data.main.result = x + modules: + - | + package main + + doc := [1, 2, 3] + + patch := [{"op": "add", "path": "1.2", "value": "foo"}] + + result := r if r = json.patch(doc, patch) + want_result: [] diff --git a/test/cases/testdata/v1/jsonpatch/json-patch-tests.yaml b/test/cases/testdata/v1/jsonpatch/json-patch-tests.yaml new file mode 100644 index 0000000000..5f4893a67b --- /dev/null +++ b/test/cases/testdata/v1/jsonpatch/json-patch-tests.yaml @@ -0,0 +1,794 @@ +--- +cases: + - note: jsonpatch/json_patch_tests + query: data.main.failed_cases = x + modules: + - | + package main + + # Grab all cases from the modules inside `data.json_patch_cases` and + # construct an object with readable index names. + all_cases[k] := t if { + t := data.json_patch_cases[p].cases[i] + k := sprintf("%s/%d", [p, i]) + } + + # Go through `all_cases` and select the ones that pass. + passed_cases[k] := t if { + t := all_cases[k] + t.expected == json.patch(t.doc, [p | p = t.patch[_]]) + } + + passed_cases[k] := t if { + # Some cases ("test" ones in particular) don't have an expected value but + # are still tests that we want to run. + t := all_cases[k] + not t.expected + not t.error + _ = json.patch(t.doc, [p | p = t.patch[_]]) + } + + passed_cases[k] := t if { + # These are cases that are expected to not return a result, for example + # there's an invalid index or a "test" fails. + t := all_cases[k] + _ = t.error + not json.patch(t.doc, [p | p = t.patch[_]]) + } + + passed_cases[k] := t if { + # Some cases are specifically disabled for the OPA implementation. + t := all_cases[k] + t.opa_disabled == true + } + + # `failed_cases` is simply the cases that didn't pass. + failed_cases[k] := t if { + t := all_cases[k] + not passed_cases[k] + } + - | + package json_patch_cases.json_spec_tests + + cases := [ + { + "comment": "4.1. add with missing object", + "doc": {"q": {"bar": 2}}, + "patch": [{"op": "add", "path": "/a/b", "value": 1}], + "error": "path /a does not exist -- missing objects are not created recursively", + }, + { + "comment": "A.1. Adding an Object Member", + "doc": {"foo": "bar"}, + "patch": [{"op": "add", "path": "/baz", "value": "qux"}], + "expected": { + "baz": "qux", + "foo": "bar", + }, + }, + { + "comment": "A.2. Adding an Array Element", + "doc": {"foo": ["bar", "baz"]}, + "patch": [{"op": "add", "path": "/foo/1", "value": "qux"}], + "expected": {"foo": ["bar", "qux", "baz"]}, + }, + { + "comment": "A.3. Removing an Object Member", + "doc": { + "baz": "qux", + "foo": "bar", + }, + "patch": [{"op": "remove", "path": "/baz"}], + "expected": {"foo": "bar"}, + }, + { + "comment": "A.4. Removing an Array Element", + "doc": {"foo": ["bar", "qux", "baz"]}, + "patch": [{"op": "remove", "path": "/foo/1"}], + "expected": {"foo": ["bar", "baz"]}, + }, + { + "comment": "A.5. Replacing a Value", + "doc": { + "baz": "qux", + "foo": "bar", + }, + "patch": [{"op": "replace", "path": "/baz", "value": "boo"}], + "expected": { + "baz": "boo", + "foo": "bar", + }, + }, + { + "comment": "A.6. Moving a Value", + "doc": { + "foo": { + "bar": "baz", + "waldo": "fred", + }, + "qux": {"corge": "grault"}, + }, + "patch": [{"op": "move", "from": "/foo/waldo", "path": "/qux/thud"}], + "expected": { + "foo": {"bar": "baz"}, + "qux": { + "corge": "grault", + "thud": "fred", + }, + }, + }, + { + "comment": "A.7. Moving an Array Element", + "doc": {"foo": ["all", "grass", "cows", "eat"]}, + "patch": [{"op": "move", "from": "/foo/1", "path": "/foo/3"}], + "expected": {"foo": ["all", "cows", "eat", "grass"]}, + }, + { + "comment": "A.8. Testing a Value: Success", + "doc": { + "baz": "qux", + "foo": ["a", 2, "c"], + }, + "patch": [ + {"op": "test", "path": "/baz", "value": "qux"}, + {"op": "test", "path": "/foo/1", "value": 2}, + ], + "expected": { + "baz": "qux", + "foo": ["a", 2, "c"], + }, + }, + { + "comment": "A.9. Testing a Value: Error", + "doc": {"baz": "qux"}, + "patch": [{"op": "test", "path": "/baz", "value": "bar"}], + "error": "string not equivalent", + }, + { + "comment": "A.10. Adding a nested Member Object", + "doc": {"foo": "bar"}, + "patch": [{"op": "add", "path": "/child", "value": {"grandchild": {}}}], + "expected": { + "foo": "bar", + "child": {"grandchild": {}}, + }, + }, + { + "comment": "A.11. Ignoring Unrecognized Elements", + "doc": {"foo": "bar"}, + "patch": [{"op": "add", "path": "/baz", "value": "qux", "xyz": 123}], + "expected": { + "foo": "bar", + "baz": "qux", + }, + }, + { + "comment": "A.12. Adding to a Non-existent Target", + "doc": {"foo": "bar"}, + "patch": [{"op": "add", "path": "/baz/bat", "value": "qux"}], + "error": "add to a non-existent target", + }, + { + "comment": "A.13 Invalid JSON Patch Document", + "doc": {"foo": "bar"}, + "patch": [{"op": "remove", "path": "/baz", "value": "qux"}], + "error": "operation has two 'op' members", + "disabled": true, + }, + { + "comment": "A.14. ~ Escape Ordering", + "doc": { + "/": 9, + "~1": 10, + }, + "patch": [{"op": "test", "path": "/~01", "value": 10}], + "expected": { + "/": 9, + "~1": 10, + }, + }, + { + "comment": "A.15. Comparing Strings and Numbers", + "doc": { + "/": 9, + "~1": 10, + }, + "patch": [{"op": "test", "path": "/~01", "value": "10"}], + "error": "number is not equal to string", + }, + { + "comment": "A.16. Adding an Array Value", + "doc": {"foo": ["bar"]}, + "patch": [{"op": "add", "path": "/foo/-", "value": ["abc", "def"]}], + "expected": {"foo": ["bar", ["abc", "def"]]}, + }, + ] + - | + package json_patch_cases.json_tests + + cases := [ + { + "comment": "empty list, empty docs", + "doc": {}, + "patch": [], + "expected": {}, + }, + { + "comment": "empty patch list", + "doc": {"foo": 1}, + "patch": [], + "expected": {"foo": 1}, + }, + { + "comment": "rearrangements OK?", + "doc": {"foo": 1, "bar": 2}, + "patch": [], + "expected": {"bar": 2, "foo": 1}, + }, + { + "comment": "rearrangements OK? How about one level down ... array", + "doc": [{"foo": 1, "bar": 2}], + "patch": [], + "expected": [{"bar": 2, "foo": 1}], + }, + { + "comment": "rearrangements OK? How about one level down...", + "doc": {"foo": {"foo": 1, "bar": 2}}, + "patch": [], + "expected": {"foo": {"bar": 2, "foo": 1}}, + }, + { + "comment": "add replaces any existing field", + "doc": {"foo": null}, + "patch": [{"op": "add", "path": "/foo", "value": 1}], + "expected": {"foo": 1}, + }, + { + "comment": "toplevel array", + "doc": [], + "patch": [{"op": "add", "path": "/0", "value": "foo"}], + "expected": ["foo"], + }, + { + "comment": "toplevel array, no change", + "doc": ["foo"], + "patch": [], + "expected": ["foo"], + }, + { + "comment": "toplevel object, numeric string", + "doc": {}, + "patch": [{"op": "add", "path": "/foo", "value": "1"}], + "expected": {"foo": "1"}, + }, + { + "comment": "toplevel object, integer", + "doc": {}, + "patch": [{"op": "add", "path": "/foo", "value": 1}], + "expected": {"foo": 1}, + }, + { + "comment": "Toplevel scalar values OK?", + "doc": "foo", + "patch": [{"op": "replace", "path": "", "value": "bar"}], + "expected": "bar", + "disabled": true, + }, + { + "comment": "replace object document with array document?", + "doc": {}, + "patch": [{"op": "add", "path": "", "value": []}], + "expected": [], + }, + { + "comment": "replace array document with object document?", + "doc": [], + "patch": [{"op": "add", "path": "", "value": {}}], + "expected": {}, + }, + { + "comment": "append to root array document?", + "doc": [], + "patch": [{"op": "add", "path": "/-", "value": "hi"}], + "expected": ["hi"], + }, + { + "comment": "Add, / target", + "doc": {}, + "patch": [{"op": "add", "path": "/", "value": 1}], + "expected": {"": 1}, + }, + { + "comment": "Add, /foo/ deep target (trailing slash)", + "doc": {"foo": {}}, + "patch": [{"op": "add", "path": "/foo/", "value": 1}], + "expected": {"foo": {"": 1}}, + }, + { + "comment": "Add composite value at top level", + "doc": {"foo": 1}, + "patch": [{"op": "add", "path": "/bar", "value": [1, 2]}], + "expected": {"foo": 1, "bar": [1, 2]}, + }, + { + "comment": "Add into composite value", + "doc": {"foo": 1, "baz": [{"qux": "hello"}]}, + "patch": [{"op": "add", "path": "/baz/0/foo", "value": "world"}], + "expected": {"foo": 1, "baz": [{"qux": "hello", "foo": "world"}]}, + }, + { + "doc": {"bar": [1, 2]}, + "patch": [{"op": "add", "path": "/bar/8", "value": "5"}], + "error": "Out of bounds (upper)", + }, + { + "doc": {"bar": [1, 2]}, + "patch": [{"op": "add", "path": "/bar/-1", "value": "5"}], + "error": "Out of bounds (lower)", + }, + { + "doc": {"foo": 1}, + "patch": [{"op": "add", "path": "/bar", "value": true}], + "expected": {"foo": 1, "bar": true}, + }, + { + "doc": {"foo": 1}, + "patch": [{"op": "add", "path": "/bar", "value": false}], + "expected": {"foo": 1, "bar": false}, + }, + { + "doc": {"foo": 1}, + "patch": [{"op": "add", "path": "/bar", "value": null}], + "expected": {"foo": 1, "bar": null}, + }, + { + "comment": "0 can be an array index or object element name", + "doc": {"foo": 1}, + "patch": [{"op": "add", "path": "/0", "value": "bar"}], + "expected": {"foo": 1, "0": "bar"}, + }, + { + "doc": ["foo"], + "patch": [{"op": "add", "path": "/1", "value": "bar"}], + "expected": ["foo", "bar"], + }, + { + "doc": ["foo", "sil"], + "patch": [{"op": "add", "path": "/1", "value": "bar"}], + "expected": ["foo", "bar", "sil"], + }, + { + "doc": ["foo", "sil"], + "patch": [{"op": "add", "path": "/0", "value": "bar"}], + "expected": ["bar", "foo", "sil"], + }, + { + "comment": "push item to array via last index + 1", + "doc": ["foo", "sil"], + "patch": [{"op": "add", "path": "/2", "value": "bar"}], + "expected": ["foo", "sil", "bar"], + }, + { + "comment": "add item to array at index > length should fail", + "doc": ["foo", "sil"], + "patch": [{"op": "add", "path": "/3", "value": "bar"}], + "error": "index is greater than number of items in array", + }, + { + "comment": "test against implementation-specific numeric parsing", + "doc": {"1e0": "foo"}, + "patch": [{"op": "test", "path": "/1e0", "value": "foo"}], + "expected": {"1e0": "foo"}, + }, + { + "comment": "test with bad number should fail", + "doc": ["foo", "bar"], + "patch": [{"op": "test", "path": "/1e0", "value": "bar"}], + "error": "test op shouldn't get array element 1", + }, + { + "doc": ["foo", "sil"], + "patch": [{"op": "add", "path": "/bar", "value": 42}], + "error": "Object operation on array target", + }, + { + "doc": ["foo", "sil"], + "patch": [{"op": "add", "path": "/1", "value": ["bar", "baz"]}], + "expected": ["foo", ["bar", "baz"], "sil"], + "comment": "value in array add not flattened", + }, + { + "doc": {"foo": 1, "bar": [1, 2, 3, 4]}, + "patch": [{"op": "remove", "path": "/bar"}], + "expected": {"foo": 1}, + }, + { + "doc": {"foo": 1, "baz": [{"qux": "hello"}]}, + "patch": [{"op": "remove", "path": "/baz/0/qux"}], + "expected": {"foo": 1, "baz": [{}]}, + }, + { + "doc": {"foo": 1, "baz": [{"qux": "hello"}]}, + "patch": [{"op": "replace", "path": "/foo", "value": [1, 2, 3, 4]}], + "expected": {"foo": [1, 2, 3, 4], "baz": [{"qux": "hello"}]}, + }, + { + "doc": {"foo": [1, 2, 3, 4], "baz": [{"qux": "hello"}]}, + "patch": [{"op": "replace", "path": "/baz/0/qux", "value": "world"}], + "expected": {"foo": [1, 2, 3, 4], "baz": [{"qux": "world"}]}, + }, + { + "doc": ["foo"], + "patch": [{"op": "replace", "path": "/0", "value": "bar"}], + "expected": ["bar"], + }, + { + "doc": [""], + "patch": [{"op": "replace", "path": "/0", "value": 0}], + "expected": [0], + }, + { + "doc": [""], + "patch": [{"op": "replace", "path": "/0", "value": true}], + "expected": [true], + }, + { + "doc": [""], + "patch": [{"op": "replace", "path": "/0", "value": false}], + "expected": [false], + }, + { + "doc": [""], + "patch": [{"op": "replace", "path": "/0", "value": null}], + "expected": [null], + }, + { + "doc": ["foo", "sil"], + "patch": [{"op": "replace", "path": "/1", "value": ["bar", "baz"]}], + "expected": ["foo", ["bar", "baz"]], + "comment": "value in array replace not flattened", + }, + { + "comment": "replace whole document", + "doc": {"foo": "bar"}, + "patch": [{"op": "replace", "path": "", "value": {"baz": "qux"}}], + "expected": {"baz": "qux"}, + }, + { + "comment": "test replace with missing parent key should fail", + "doc": {"bar": "baz"}, + "patch": [{"op": "replace", "path": "/foo/bar", "value": false}], + "error": "replace op should fail with missing parent key", + }, + { + "comment": "spurious patch properties", + "doc": {"foo": 1}, + "patch": [{"op": "test", "path": "/foo", "value": 1, "spurious": 1}], + "expected": {"foo": 1}, + }, + { + "doc": {"foo": null}, + "patch": [{"op": "test", "path": "/foo", "value": null}], + "expected": {"foo": null}, + "comment": "null value should be valid obj property", + }, + { + "doc": {"foo": null}, + "patch": [{"op": "replace", "path": "/foo", "value": "truthy"}], + "expected": {"foo": "truthy"}, + "comment": "null value should be valid obj property to be replaced with something truthy", + }, + { + "doc": {"foo": null}, + "patch": [{"op": "move", "from": "/foo", "path": "/bar"}], + "expected": {"bar": null}, + "comment": "null value should be valid obj property to be moved", + }, + { + "doc": {"foo": null}, + "patch": [{"op": "copy", "from": "/foo", "path": "/bar"}], + "expected": {"foo": null, "bar": null}, + "comment": "null value should be valid obj property to be copied", + }, + { + "doc": {"foo": null}, + "patch": [{"op": "remove", "path": "/foo"}], + "expected": {}, + "comment": "null value should be valid obj property to be removed", + }, + { + "doc": {"foo": "bar"}, + "patch": [{"op": "replace", "path": "/foo", "value": null}], + "expected": {"foo": null}, + "comment": "null value should still be valid obj property replace other value", + }, + { + "doc": {"foo": {"foo": 1, "bar": 2}}, + "patch": [{"op": "test", "path": "/foo", "value": {"bar": 2, "foo": 1}}], + "expected": {"foo": {"foo": 1, "bar": 2}}, + "comment": "test should pass despite rearrangement", + }, + { + "doc": {"foo": [{"foo": 1, "bar": 2}]}, + "patch": [{"op": "test", "path": "/foo", "value": [{"bar": 2, "foo": 1}]}], + "expected": {"foo": [{"foo": 1, "bar": 2}]}, + "comment": "test should pass despite (nested) rearrangement", + }, + { + "doc": {"foo": {"bar": [1, 2, 5, 4]}}, + "patch": [{"op": "test", "path": "/foo", "value": {"bar": [1, 2, 5, 4]}}], + "expected": {"foo": {"bar": [1, 2, 5, 4]}}, + "comment": "test should pass - no error", + }, + { + "doc": {"foo": {"bar": [1, 2, 5, 4]}}, + "patch": [{"op": "test", "path": "/foo", "value": [1, 2]}], + "error": "test op should fail", + }, + { + "comment": "Whole document", + "doc": {"foo": 1}, + "patch": [{"op": "test", "path": "", "value": {"foo": 1}}], + "disabled": true, + }, + { + "comment": "Empty-string element", + "doc": {"": 1}, + "patch": [{"op": "test", "path": "/", "value": 1}], + "expected": {"": 1}, + }, + { + "doc": { + "foo": ["bar", "baz"], + "": 0, + "a/b": 1, + "c%d": 2, + "e^f": 3, + "g|h": 4, + "i\\j": 5, + "k\"l": 6, + " ": 7, + "m~n": 8, + }, + "patch": [ + {"op": "test", "path": "/foo", "value": ["bar", "baz"]}, + {"op": "test", "path": "/foo/0", "value": "bar"}, + {"op": "test", "path": "/", "value": 0}, + {"op": "test", "path": "/a~1b", "value": 1}, + {"op": "test", "path": "/c%d", "value": 2}, + {"op": "test", "path": "/e^f", "value": 3}, + {"op": "test", "path": "/g|h", "value": 4}, + {"op": "test", "path": "/i\\j", "value": 5}, + {"op": "test", "path": "/k\"l", "value": 6}, + {"op": "test", "path": "/ ", "value": 7}, + {"op": "test", "path": "/m~0n", "value": 8}, + ], + "expected": { + "": 0, + " ": 7, + "a/b": 1, + "c%d": 2, + "e^f": 3, + "foo": [ + "bar", + "baz", + ], + "g|h": 4, + "i\\j": 5, + "k\"l": 6, + "m~n": 8, + }, + }, + { + "comment": "Move to same location has no effect", + "doc": {"foo": 1}, + "patch": [{"op": "move", "from": "/foo", "path": "/foo"}], + "expected": {"foo": 1}, + }, + { + "doc": {"foo": 1, "baz": [{"qux": "hello"}]}, + "patch": [{"op": "move", "from": "/foo", "path": "/bar"}], + "expected": {"baz": [{"qux": "hello"}], "bar": 1}, + }, + { + "doc": {"baz": [{"qux": "hello"}], "bar": 1}, + "patch": [{"op": "move", "from": "/baz/0/qux", "path": "/baz/1"}], + "expected": {"baz": [{}, "hello"], "bar": 1}, + }, + { + "doc": {"baz": [{"qux": "hello"}], "bar": 1}, + "patch": [{"op": "copy", "from": "/baz/0", "path": "/boo"}], + "expected": {"baz": [{"qux": "hello"}], "bar": 1, "boo": {"qux": "hello"}}, + }, + { + "comment": "replacing the root of the document is possible with add", + "doc": {"foo": "bar"}, + "patch": [{"op": "add", "path": "", "value": {"baz": "qux"}}], + "expected": {"baz": "qux"}, + }, + { + "comment": "Adding to \"/-\" adds to the end of the array", + "doc": [1, 2], + "patch": [{"op": "add", "path": "/-", "value": {"foo": ["bar", "baz"]}}], + "expected": [1, 2, {"foo": ["bar", "baz"]}], + }, + { + "comment": "Adding to \"/-\" adds to the end of the array, even n levels down", + "doc": [1, 2, [3, [4, 5]]], + "patch": [{"op": "add", "path": "/2/1/-", "value": {"foo": ["bar", "baz"]}}], + "expected": [1, 2, [3, [4, 5, {"foo": ["bar", "baz"]}]]], + }, + { + "comment": "test remove with bad number should fail", + "doc": {"foo": 1, "baz": [{"qux": "hello"}]}, + "patch": [{"op": "remove", "path": "/baz/1e0/qux"}], + "error": "remove op shouldn't remove from array with bad number", + }, + { + "comment": "test remove on array", + "doc": [1, 2, 3, 4], + "patch": [{"op": "remove", "path": "/0"}], + "expected": [2, 3, 4], + }, + { + "comment": "test repeated removes", + "doc": [1, 2, 3, 4], + "patch": [ + {"op": "remove", "path": "/1"}, + {"op": "remove", "path": "/2"}, + ], + "expected": [1, 3], + }, + { + "comment": "test remove with bad index should fail", + "doc": [1, 2, 3, 4], + "patch": [{"op": "remove", "path": "/1e0"}], + "error": "remove op shouldn't remove from array with bad number", + }, + { + "comment": "test replace with bad number should fail", + "doc": [""], + "patch": [{"op": "replace", "path": "/1e0", "value": false}], + "error": "replace op shouldn't replace in array with bad number", + }, + { + "comment": "test copy with bad number should fail", + "doc": {"baz": [1, 2, 3], "bar": 1}, + "patch": [{"op": "copy", "from": "/baz/1e0", "path": "/boo"}], + "error": "copy op shouldn't work with bad number", + }, + { + "comment": "test move with bad number should fail", + "doc": {"foo": 1, "baz": [1, 2, 3, 4]}, + "patch": [{"op": "move", "from": "/baz/1e0", "path": "/foo"}], + "error": "move op shouldn't work with bad number", + }, + { + "comment": "test add with bad number should fail", + "doc": ["foo", "sil"], + "patch": [{"op": "add", "path": "/1e0", "value": "bar"}], + "error": "add op shouldn't add to array with bad number", + }, + { + "comment": "missing 'path' parameter", + "doc": {}, + "patch": [{"op": "add", "value": "bar"}], + "error": "missing 'path' parameter", + }, + { + "comment": "'path' parameter with null value", + "doc": {}, + "patch": [{"op": "add", "path": null, "value": "bar"}], + "error": "null is not valid value for 'path'", + }, + { + "comment": "invalid JSON Pointer token", + "opa_disabled": true, + "doc": {}, + "patch": [{"op": "add", "path": "foo", "value": "bar"}], + "error": "JSON Pointer should start with a slash", + }, + { + "comment": "missing 'value' parameter to add", + "doc": [1], + "patch": [{"op": "add", "path": "/-"}], + "error": "missing 'value' parameter", + }, + { + "comment": "missing 'value' parameter to replace", + "doc": [1], + "patch": [{"op": "replace", "path": "/0"}], + "error": "missing 'value' parameter", + }, + { + "comment": "missing 'value' parameter to test", + "doc": [null], + "patch": [{"op": "test", "path": "/0"}], + "error": "missing 'value' parameter", + }, + { + "comment": "missing value parameter to test - where undef is falsy", + "doc": [false], + "patch": [{"op": "test", "path": "/0"}], + "error": "missing 'value' parameter", + }, + { + "comment": "missing from parameter to copy", + "doc": [1], + "patch": [{"op": "copy", "path": "/-"}], + "error": "missing 'from' parameter", + }, + { + "comment": "missing from location to copy", + "doc": {"foo": 1}, + "patch": [{"op": "copy", "from": "/bar", "path": "/foo"}], + "error": "missing 'from' location", + }, + { + "comment": "missing from parameter to move", + "doc": {"foo": 1}, + "patch": [{"op": "move", "path": ""}], + "error": "missing 'from' parameter", + }, + { + "comment": "missing from location to move", + "doc": {"foo": 1}, + "patch": [{"op": "move", "from": "/bar", "path": "/foo"}], + "error": "missing 'from' location", + }, + { + "comment": "duplicate ops", + "opa_disabled": true, + "doc": {"foo": "bar"}, + "patch": [{ + "op": "move", "path": "/baz", "value": "qux", + "from": "/foo", + }], + "error": "patch has two 'op' members", + "disabled": true, + }, + { + "comment": "unrecognized op should fail", + "doc": {"foo": 1}, + "patch": [{"op": "spam", "path": "/foo", "value": 1}], + "error": "Unrecognized op 'spam'", + }, + { + "comment": "test with bad array number that has leading zeros", + "doc": ["foo", "bar"], + "patch": [{"op": "test", "path": "/00", "value": "foo"}], + "error": "test op should reject the array value, it has leading zeros", + }, + { + "comment": "test with bad array number that has leading zeros", + "doc": ["foo", "bar"], + "patch": [{"op": "test", "path": "/01", "value": "bar"}], + "error": "test op should reject the array value, it has leading zeros", + }, + { + "comment": "Removing nonexistent field", + "doc": {"foo": "bar"}, + "patch": [{"op": "remove", "path": "/baz"}], + "error": "removing a nonexistent field should fail", + }, + { + "comment": "Removing deep nonexistent path", + "doc": {"foo": "bar"}, + "patch": [{"op": "remove", "path": "/missing1/missing2"}], + "error": "removing a nonexistent field should fail", + }, + { + "comment": "Removing nonexistent index", + "doc": ["foo", "bar"], + "patch": [{"op": "remove", "path": "/2"}], + "error": "removing a nonexistent index should fail", + }, + { + "comment": "Patch with different capitalisation than doc", + "doc": {"foo": "bar"}, + "patch": [{"op": "add", "path": "/FOO", "value": "BAR"}], + "expected": {"foo": "bar", "FOO": "BAR"}, + }, + ] + want_result: + - x: {} diff --git a/test/cases/testdata/v1/jsonpatch/set.yaml b/test/cases/testdata/v1/jsonpatch/set.yaml new file mode 100644 index 0000000000..fd31a4fc88 --- /dev/null +++ b/test/cases/testdata/v1/jsonpatch/set.yaml @@ -0,0 +1,82 @@ +--- +cases: + - note: jsonpatch/set-success basic-remove + query: data.main.result.foo = x + modules: + - | + package main + + doc := {"foo": {"a", "b", "c"}} + + patch := [{"op": "remove", "path": "foo/b"}] + + result := r if r = json.patch(doc, patch) + want_result: + - x: + - a + - c + sort_bindings: true + - note: jsonpatch/set-success basic-add + query: data.main.result.foo = x + modules: + - | + package main + + doc := {"foo": {"a", "b", "c"}} + + patch := [{"op": "add", "path": "foo/d", "value": "d"}] + + result := r if r = json.patch(doc, patch) + want_result: + - x: + - a + - b + - c + - d + sort_bindings: true + - note: jsonpatch/set-failure add-with-mismatched-key-value + query: data.main.result.foo = x + modules: + - | + package main + + doc := {"foo": {"a", "b", "c"}} + + patch := [{"op": "add", "path": "foo/d", "value": "e"}] + + result := r if r = json.patch(doc, patch) + want_result: [] + - note: jsonpatch/set-success basic-move + query: data.main.result.foo = x; data.main.result.bar = z + modules: + - | + package main + + doc := {"foo": {"a", "b"}, "bar": {"c", "d"}} + + patch := [{"op": "move", "from": "foo/a", "path": "bar/a"}] + + result := r if r = json.patch(doc, patch) + want_result: + - x: + - b + z: + - a + - c + - d + sort_bindings: true + - note: jsonpatch/set-success add-to-nested-array + query: data.main.result = x + modules: + - | + package main + + doc := {[1]} + + patch := [{"op": "add", "path": [[1], 1], "value": 2}] + + result := r if r = json.patch(doc, patch) + want_result: + - x: + - - 1 + - 2 diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0230.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0230.yaml new file mode 100644 index 0000000000..664784a775 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0230.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jsonremove/base + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": {"b": {"c": 7, "d": 8}}, "e": 9}, {"a/b/c"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + d: 8 + e: 9 diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0231.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0231.yaml new file mode 100644 index 0000000000..39659f8975 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0231.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/multiple roots + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": {"b": {"c": 7, "d": 8}}, "e": 9}, {"a/b/c", "e"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + d: 8 diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0232.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0232.yaml new file mode 100644 index 0000000000..2394d26964 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0232.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/multiple roots array + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": {"b": {"c": 7, "d": 8}}, "e": 9}, ["a/b/c", "e"], __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + d: 8 diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0233.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0233.yaml new file mode 100644 index 0000000000..b14c7e5235 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0233.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/shared roots + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": {"b": {"c": 7, "d": 8}, "e": 9}}, {"a/b/c", "a/e"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + d: 8 diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0234.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0234.yaml new file mode 100644 index 0000000000..efe3223872 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0234.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jsonremove/conflict + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": {"b": 7}, "c": 1}, {"a", "a/b"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + c: 1 diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0235.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0235.yaml new file mode 100644 index 0000000000..7cfbbbe05f --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0235.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jsonremove/empty list + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": 7}, set(), __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 7 diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0236.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0236.yaml new file mode 100644 index 0000000000..56fc375a89 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0236.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jsonremove/empty object + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({}, {"a/b"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0237.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0237.yaml new file mode 100644 index 0000000000..5be9f78aa4 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0237.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jsonremove/delete all + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": {"b": 7}, "c": 1}, {"a", "c"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0238.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0238.yaml new file mode 100644 index 0000000000..2c21e04072 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0238.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jsonremove/delete last in object + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": {"b": 7}, "c": 1}, {"a/b", "c"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: {} diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0239.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0239.yaml new file mode 100644 index 0000000000..f976e46f2f --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0239.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jsonremove/arrays + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": [{"b": 7, "c": 8}, {"d": 9}]}, {"a/0/b", "a/1"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + - c: 8 diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0240.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0240.yaml new file mode 100644 index 0000000000..d62ec2855d --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0240.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: jsonremove/object with number keys + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": [{"1": ["b", "c", "d"]}, {"x": "y"}]}, {"a/0/1/2"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + - "1": + - b + - c + - x: "y" diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0241.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0241.yaml new file mode 100644 index 0000000000..0039fab5e1 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0241.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/arrays of roots + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": {"b": {"c": 7, "d": 8}}, "e": 9}, {["a", "b", "c"], ["e"]}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + d: 8 diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0242.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0242.yaml new file mode 100644 index 0000000000..021b817a63 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0242.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jsonremove/mixed root types + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + json.remove({"a": {"b": {"c": 7, "d": 8, "x": 0}}, "e": 9}, {"a/b/d", ["a", "b", "c"]}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + x: 0 + e: 9 diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0243.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0243.yaml new file mode 100644 index 0000000000..9634b64fa9 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0243.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jsonremove/error invalid target type string input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove(__local2__, {"a/b/c"}, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": "foo"}' + want_error_code: eval_type_error + want_error: "json.remove: operand 1 must be object but got string" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0244.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0244.yaml new file mode 100644 index 0000000000..f8dbb53119 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0244.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/error invalid target type number input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove(__local2__, {"a/b/c"}, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": 22}' + want_error_code: eval_type_error + want_error: "json.remove: operand 1 must be object but got number" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0245.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0245.yaml new file mode 100644 index 0000000000..53f6ee0323 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0245.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/error invalid target type boolean input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove(__local2__, {"a/b/c"}, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": true}' + want_error_code: eval_type_error + want_error: "json.remove: operand 1 must be object but got boolean" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0246.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0246.yaml new file mode 100644 index 0000000000..bf89312415 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0246.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/error invalid target type array input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove(__local2__, {"a/b/c"}, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": ["a", "b", "c"]}' + want_error_code: eval_type_error + want_error: "json.remove: operand 1 must be object but got array" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0247.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0247.yaml new file mode 100644 index 0000000000..816fcd6276 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0247.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/error invalid paths type string + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove({"a": {"b": {"c": 123}}}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": "foo"}' + want_error_code: eval_type_error + want_error: "json.remove: operand 2 must be one of {set, array} but got string" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0248.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0248.yaml new file mode 100644 index 0000000000..a3c8d0fd65 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0248.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/error invalid paths type number + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove({"a": {"b": {"c": 123}}}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": 22}' + want_error_code: eval_type_error + want_error: "json.remove: operand 2 must be one of {set, array} but got number" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0249.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0249.yaml new file mode 100644 index 0000000000..7d39e367e7 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0249.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/error invalid paths type boolean + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove({"a": {"b": {"c": 123}}}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": true}' + want_error_code: eval_type_error + want_error: "json.remove: operand 2 must be one of {set, array} but got boolean" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0250.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0250.yaml new file mode 100644 index 0000000000..be6a11d467 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0250.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/error invalid paths type object + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove({"a": {"b": {"c": 123}}}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": {"y": 123}}' + want_error_code: eval_type_error + want_error: "json.remove: operand 2 must be one of {set, array} but got object" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0251.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0251.yaml new file mode 100644 index 0000000000..e4ba83853b --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0251.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/error invalid paths type set with numbers + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove({"a": {"b": {"c": 123}}}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": {1, 2, 3, "a"}}' + want_error_code: eval_type_error + want_error: "json.remove: operand 2 must be one of {set, array} containing string paths or array of path segments but got number" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0252.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0252.yaml new file mode 100644 index 0000000000..1c6a5d89ba --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0252.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/error invalid paths type set with objects + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove({"a": {"b": {"c": 123}}}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": {"a", {"x": 1}, {"y": 2}}}' + want_error_code: eval_type_error + want_error: "json.remove: operand 2 must be one of {set, array} containing string paths or array of path segments but got object" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0253.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0253.yaml new file mode 100644 index 0000000000..1fb25029de --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0253.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jsonremove/error invalid paths type array with numbers + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove({"a": {"b": {"c": 123}}}, __local2__, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": ["a", 1, 2, 3]}' + want_error_code: eval_type_error + want_error: "json.remove: operand 2 must be one of {set, array} containing string paths or array of path segments but got number" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremove/test-jsonremove-0254.yaml b/test/cases/testdata/v1/jsonremove/test-jsonremove-0254.yaml new file mode 100644 index 0000000000..0c95f20f84 --- /dev/null +++ b/test/cases/testdata/v1/jsonremove/test-jsonremove-0254.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jsonremove/error invalid paths type array with objects + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + json.remove({"a": {"b": {"c": 123}}}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": ["a", {"x": 1}, {"y": 2}]}' + want_error_code: eval_type_error + want_error: "json.remove: operand 2 must be one of {set, array} containing string paths or array of path segments but got object" + strict_error: true diff --git a/test/cases/testdata/v1/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml b/test/cases/testdata/v1/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml new file mode 100644 index 0000000000..779cdfd40b --- /dev/null +++ b/test/cases/testdata/v1/jsonremoveidempotent/test-jsonremoveidempotent-0255.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: jsonremoveidempotent/TestBuiltinJSONRemoveIdempotent + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = {"a": {"b": 2, "c": 3}} + json.remove(__local0__, {"a"}, __local1__) + __local1__ = {} + json.remove(__local0__, {"a/b"}, __local2__) + __local2__ = {"a": {"c": 3}} + json.remove(__local0__, {"a/c"}, __local3__) + __local3__ = {"a": {"b": 2}} + __local0__ = {"a": {"b": 2, "c": 3}} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jsonschema/test-json-match_schema.yaml b/test/cases/testdata/v1/jsonschema/test-json-match_schema.yaml new file mode 100644 index 0000000000..b65a4cd786 --- /dev/null +++ b/test/cases/testdata/v1/jsonschema/test-json-match_schema.yaml @@ -0,0 +1,98 @@ +--- +cases: + - note: json_match_schema/success + query: data.test.p = x + modules: + - | + package test + + document := {"id": 5} + + schema := { + "properties": {"id": {"type": "integer"}}, + "required": ["id"], + } + + p := json.match_schema(document, schema) + want_result: + - x: + - true + - [] + - note: json_match_schema/success string document + query: data.test.p = x + modules: + - | + package test + + document := `{"id": 5}` + + schema := { + "properties": {"id": {"type": "integer"}}, + "required": ["id"], + } + + p := json.match_schema(document, schema) + want_result: + - x: + - true + - [] + - note: json_match_schema/success string schema + query: data.test.p = x + modules: + - | + package test + + document := {"id": 5} + + schema := `{ + "properties": { + "id": { + "type": "integer" + } + }, + "required": ["id"] + }` + + p := json.match_schema(document, schema) + want_result: + - x: + - true + - [] + - note: json_match_schema/invalid document + query: data.test.p = x + modules: + - | + package test + + document := {"id": "foo"} + + schema := { + "properties": {"id": {"type": "integer"}}, + "required": ["id"], + } + + p := json.match_schema(document, schema) + want_result: + - x: + - false + - - desc: "Invalid type. Expected: integer, given: string" + error: "id: Invalid type. Expected: integer, given: string" + field: id + type: invalid_type + - note: json_match_schema/invalid schema + query: data.test.p = x + modules: + - | + package test + + document := {"id": "foo"} + + schema := { + "properties": {"id": {"type": "unknown"}}, + "required": ["id"], + } + + p := json.match_schema(document, schema) + want_error_code: eval_builtin_error + want_error: "json.match_schema: has a primitive type that is NOT VALID -- given: /unknown/ Expected valid values are:[array boolean integer number null object string]" + strict_error: true diff --git a/test/cases/testdata/v1/jsonschema/test-json-verify_schema.yaml b/test/cases/testdata/v1/jsonschema/test-json-verify_schema.yaml new file mode 100644 index 0000000000..8729a2d168 --- /dev/null +++ b/test/cases/testdata/v1/jsonschema/test-json-verify_schema.yaml @@ -0,0 +1,54 @@ +--- +cases: + - note: json_verify_schema/valid schema string + query: data.test.p = x + modules: + - | + package test + + schema := `{"type": "boolean"}` + + p := json.verify_schema(schema) + want_result: + - x: + - true + - null + - note: json_verify_schema/valid schema object + query: data.test.p = x + modules: + - | + package test + + schema := {"type": "boolean"} + + p := json.verify_schema(schema) + want_result: + - x: + - true + - null + - note: json_verify_schema/invalid schema string + query: data.test.p = x + modules: + - | + package test + + schema := `{"type": "unknown_type"}` + + p := json.verify_schema(schema) + want_result: + - x: + - false + - "jsonschema: has a primitive type that is NOT VALID -- given: /unknown_type/ Expected valid values are:[array boolean integer number null object string]" + - note: json_verify_schema/invalid schema object + query: data.test.p = x + modules: + - | + package test + + schema := {"type": "unknown_type"} + + p := json.verify_schema(schema) + want_result: + - x: + - false + - "jsonschema: has a primitive type that is NOT VALID -- given: /unknown_type/ Expected valid values are:[array boolean integer number null object string]" diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0389.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0389.yaml new file mode 100644 index 0000000000..b0acdef130 --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0389.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jwtbuiltins/simple + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIwIiwiaXNzIjoib3BhIn0.XmVoLoHI3pxMtMO_WRONMSJzGUDP9pDjy8Jp0_tdRXY", [x, y, z]) + } + data: {} + want_result: + - x: + - alg: HS256 + typ: JWT + - iss: opa + sub: "0" + - 5e65682e81c8de9c4cb4c3bf59138d3122731940cff690e3cbc269d3fb5d4576 diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0390.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0390.yaml new file mode 100644 index 0000000000..21ead7b7f5 --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0390.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jwtbuiltins/simple-non-registered + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuZXciOiJJIGFtIGEgdXNlciBjcmVhdGVkIGZpZWxkIiwiaXNzIjoib3BhIn0.6UmjsclVDGD9jcmX_F8RJzVgHtUZuLu2pxkF_UEQCrE", [x, y, z]) + } + data: {} + want_result: + - x: + - alg: HS256 + typ: JWT + - iss: opa + new: I am a user created field + - e949a3b1c9550c60fd8dc997fc5f112735601ed519b8bbb6a71905fd41100ab1 diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0391.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0391.yaml new file mode 100644 index 0000000000..70e09d009f --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0391.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtbuiltins/no-support-jwe + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImVuYyI6ImJsYWgifQ.eyJuZXciOiJJIGFtIGEgdXNlciBjcmVhdGVkIGZpZWxkIiwiaXNzIjoib3BhIn0.McGUb1e-UviZKy6UyQErNNQzEUgeV25Buwk7OHOa8U8", [x, y, z]) + } + data: {} + want_error_code: eval_builtin_error + want_error: JWT is a JWE object, which is not supported + strict_error: true diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0392.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0392.yaml new file mode 100644 index 0000000000..43701c1564 --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0392.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtbuiltins/no-periods + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJzdWIiOiIwIiwiaXNzIjoib3BhIn0XmVoLoHI3pxMtMO_WRONMSJzGUDP9pDjy8Jp0_tdRXY", [x, y, z]) + } + data: {} + want_error_code: eval_builtin_error + want_error: encoded JWT had no period separators + strict_error: true diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0393.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0393.yaml new file mode 100644 index 0000000000..f902ad1aaf --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0393.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtbuiltins/wrong-period-count + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV.CJ9eyJzdWIiOiIwIiwiaXNzIjoib3BhIn0XmVoLoHI3pxMtMO_WRONMSJzGUDP9pDjy8Jp0_tdRXY", [x, y, z]) + } + data: {} + want_error_code: eval_builtin_error + want_error: encoded JWT must have 3 sections, found 2 + strict_error: true diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0394.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0394.yaml new file mode 100644 index 0000000000..6a410cff6d --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0394.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtbuiltins/bad-header-encoding + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIU^%zI1NiI+sInR5cCI6IkpXVCJ9.eyJzdWIiOiIwIiwiaXNzIjoib3BhIn0.XmVoLoHI3pxMtMO_WRONMSJzGUDP9pDjy8Jp0_tdRXY", [x, y, z]) + } + data: {} + want_error_code: eval_builtin_error + want_error: "JWT header had invalid encoding: illegal base64 data at input byte 13" + strict_error: true diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0395.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0395.yaml new file mode 100644 index 0000000000..738653e32e --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0395.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtbuiltins/bad-payload-encoding + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIwIiwia/XNzIjoib3BhIn0.XmVoLoHI3pxMtMO_WRONMSJzGUDP9pDjy8Jp0_tdRXY", [x, y, z]) + } + data: {} + want_error_code: eval_builtin_error + want_error: "JWT payload had invalid encoding: illegal base64 data at input byte 17" + strict_error: true diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0396.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0396.yaml new file mode 100644 index 0000000000..fcd66300d0 --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0396.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtbuiltins/bad-signature-encoding + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIwIiwiaXNzIjoib3BhIn0.XmVoLoHI3pxMtMO(_WRONMSJzGUDP9pDjy8Jp0_tdRXY", [x, y, z]) + } + data: {} + want_error_code: eval_builtin_error + want_error: "JWT signature had invalid encoding: illegal base64 data at input byte 15" + strict_error: true diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0397.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0397.yaml new file mode 100644 index 0000000000..8f447f12d4 --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0397.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jwtbuiltins/nested + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.ImV5SmhiR2NpT2lKSVV6STFOaUlzSW5SNWNDSTZJa3BYVkNKOS5leUp6ZFdJaU9pSXdJaXdpYVhOeklqb2liM0JoSW4wLlhtVm9Mb0hJM3B4TXRNT19XUk9OTVNKekdVRFA5cERqeThKcDBfdGRSWFki.8W0qx4mLxslmZl7wEMUWBxH7tST3XsEuWXxesXqFnRI", [x, y, z]) + } + data: {} + want_result: + - x: + - alg: HS256 + typ: JWT + - iss: opa + sub: "0" + - 5e65682e81c8de9c4cb4c3bf59138d3122731940cff690e3cbc269d3fb5d4576 diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0398.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0398.yaml new file mode 100644 index 0000000000..331240d610 --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0398.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jwtbuiltins/double-nested + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.ImV5SmhiR2NpT2lKSVV6STFOaUlzSW5SNWNDSTZJa3BYVkNJc0ltTjBlU0k2SWtwWFZDSjkuSW1WNVNtaGlSMk5wVDJsS1NWVjZTVEZPYVVselNXNVNOV05EU1RaSmEzQllWa05LT1M1bGVVcDZaRmRKYVU5cFNYZEphWGRwWVZoT2VrbHFiMmxpTTBKb1NXNHdMbGh0Vm05TWIwaEpNM0I0VFhSTlQxOVhVazlPVFZOS2VrZFZSRkE1Y0VScWVUaEtjREJmZEdSU1dGa2kuOFcwcXg0bUx4c2xtWmw3d0VNVVdCeEg3dFNUM1hzRXVXWHhlc1hxRm5SSSI.U8rwnGAJ-bJoGrAYKEzNtbJQWd3x1eW0Y25nLKHDCgo", [x, y, z]) + } + data: {} + want_result: + - x: + - alg: HS256 + typ: JWT + - iss: opa + sub: "0" + - 5e65682e81c8de9c4cb4c3bf59138d3122731940cff690e3cbc269d3fb5d4576 diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0399.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0399.yaml new file mode 100644 index 0000000000..c9cbc26f90 --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0399.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: jwtbuiltins/complex-values + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIwIiwiaXNzIjoib3BhIiwiZXh0Ijp7ImFiYyI6IjEyMyIsImNiYSI6WzEwLCIxMCJdfX0.IIxF-uJ6i4K5Dj71xNLnUeqB9jmujl6ujTInhii1PxE", [x, y, z]) + } + data: {} + want_result: + - x: + - alg: HS256 + typ: JWT + - ext: + abc: "123" + cba: + - 10 + - "10" + iss: opa + sub: "0" + - 208c45fae27a8b82b90e3ef5c4d2e751ea81f639ae8e5eae8d32278628b53f11 diff --git a/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0400.yaml b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0400.yaml new file mode 100644 index 0000000000..6743760565 --- /dev/null +++ b/test/cases/testdata/v1/jwtbuiltins/test-jwtbuiltins-0400.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: jwtbuiltins/duplicate-keys + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiAiMCIsImlzcyI6ICJub3Qgb3BhIiwgImlzcyI6ICJhbHNvIG5vdCBvcGEiLCAiaXNzIjogIm9wYSJ9.XmVoLoHI3pxMtMO_WRONMSJzGUDP9pDjy8Jp0_tdRXY", [x, y, z]) + } + data: {} + want_result: + - x: + - alg: HS256 + typ: JWT + - iss: opa + sub: "0" + - 5e65682e81c8de9c4cb4c3bf59138d3122731940cff690e3cbc269d3fb5d4576 diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0449.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0449.yaml new file mode 100644 index 0000000000..2d14730c09 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0449.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jwtdecodeverify/ps256-unconstrained + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4In0.iCePYnD1U13oBe_6ylhmojmkY_VZNYXqVszAej8RImMGv51OEqARmYFkRZYTiYCiVFober7vcDq_stOj1uAJCuttygGW_dpHiN-3EWsU2E2vCnXlygWe0ud38pOC-OVyEFbXxO9-m51vnS-3VmBjEO8G1UE8bLFXTeFOGkUIj9dqlefJSWh5wa8XA3g9mj0jqpuJi-7QgEIeVHk-JzhGpoFqI2f-Df_agVvc2x4V-6fJmj7wV2IsaFPRi36mVQmg8S-dkxu4AlaeCILhyNZl8ewjBHHBjJFRwzcy88L00mzdO51ZxEYsBdQav3ux2sc6vjT9PvvjAwzcthQxEoEaNA", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - true + - alg: PS256 + typ: JWT + - iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0450.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0450.yaml new file mode 100644 index 0000000000..afe149f325 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0450.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/ps256-key-wrong + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4In0.iCePYnD1U13oBe_6ylhmojmkY_VZNYXqVszAej8RImMGv51OEqARmYFkRZYTiYCiVFober7vcDq_stOj1uAJCuttygGW_dpHiN-3EWsU2E2vCnXlygWe0ud38pOC-OVyEFbXxO9-m51vnS-3VmBjEO8G1UE8bLFXTeFOGkUIj9dqlefJSWh5wa8XA3g9mj0jqpuJi-7QgEIeVHk-JzhGpoFqI2f-Df_agVvc2x4V-6fJmj7wV2IsaFPRi36mVQmg8S-dkxu4AlaeCILhyNZl8ewjBHHBjJFRwzcy88L00mzdO51ZxEYsBdQav3ux2sc6vjT9PvvjAwzcthQxEoEaNA", {"cert": "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0451.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0451.yaml new file mode 100644 index 0000000000..26d9860347 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0451.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/rs256-key-wrong + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4IiwgImV4cCI6IDMwMDB9.hqDP3AzshNhUZMI02U3nLPrj93QFrgs-74XFrF1Vry2bplrz-NKpdVdfTu8iY_bhmkWf2Om5DdwRZj2ZgpGahtnshnHaRq0RyqF-m3Y7oNj6JL_YMwgxsFIIHtBlagBqDU-gZK99iqSOSGqVhvxqX6gCqFgE7vnEGHeeDedtRM53coAJuwzy8rQV9m3TewoofPdPasGv-dBLQZ3qgmnibkSgb7SmFpjXBy8zL3xJXOZhAHYlgcmcEoFVaWlBguIcWA87WZlpCLYcdYTJzSZweC3QLUhZ4RLJW84-LMKp6xWLLPrp3OgnsduB2G9PYMmYw_qCkuY1KGwfH4PvCQbAzQ", {"cert": "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0452.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0452.yaml new file mode 100644 index 0000000000..684a8f6ad0 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0452.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jwtdecodeverify/ps256-iss-ok + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4In0.iCePYnD1U13oBe_6ylhmojmkY_VZNYXqVszAej8RImMGv51OEqARmYFkRZYTiYCiVFober7vcDq_stOj1uAJCuttygGW_dpHiN-3EWsU2E2vCnXlygWe0ud38pOC-OVyEFbXxO9-m51vnS-3VmBjEO8G1UE8bLFXTeFOGkUIj9dqlefJSWh5wa8XA3g9mj0jqpuJi-7QgEIeVHk-JzhGpoFqI2f-Df_agVvc2x4V-6fJmj7wV2IsaFPRi36mVQmg8S-dkxu4AlaeCILhyNZl8ewjBHHBjJFRwzcy88L00mzdO51ZxEYsBdQav3ux2sc6vjT9PvvjAwzcthQxEoEaNA", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----", "iss": "xxx"}, [x, y, z]) + } + want_result: + - x: + - true + - alg: PS256 + typ: JWT + - iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0453.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0453.yaml new file mode 100644 index 0000000000..bfdbb1b275 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0453.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/ps256-iss-wrong + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4In0.iCePYnD1U13oBe_6ylhmojmkY_VZNYXqVszAej8RImMGv51OEqARmYFkRZYTiYCiVFober7vcDq_stOj1uAJCuttygGW_dpHiN-3EWsU2E2vCnXlygWe0ud38pOC-OVyEFbXxO9-m51vnS-3VmBjEO8G1UE8bLFXTeFOGkUIj9dqlefJSWh5wa8XA3g9mj0jqpuJi-7QgEIeVHk-JzhGpoFqI2f-Df_agVvc2x4V-6fJmj7wV2IsaFPRi36mVQmg8S-dkxu4AlaeCILhyNZl8ewjBHHBjJFRwzcy88L00mzdO51ZxEYsBdQav3ux2sc6vjT9PvvjAwzcthQxEoEaNA", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----", "iss": "yyy"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0454.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0454.yaml new file mode 100644 index 0000000000..47b1916ca6 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0454.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jwtdecodeverify/ps256-alg-ok + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4In0.iCePYnD1U13oBe_6ylhmojmkY_VZNYXqVszAej8RImMGv51OEqARmYFkRZYTiYCiVFober7vcDq_stOj1uAJCuttygGW_dpHiN-3EWsU2E2vCnXlygWe0ud38pOC-OVyEFbXxO9-m51vnS-3VmBjEO8G1UE8bLFXTeFOGkUIj9dqlefJSWh5wa8XA3g9mj0jqpuJi-7QgEIeVHk-JzhGpoFqI2f-Df_agVvc2x4V-6fJmj7wV2IsaFPRi36mVQmg8S-dkxu4AlaeCILhyNZl8ewjBHHBjJFRwzcy88L00mzdO51ZxEYsBdQav3ux2sc6vjT9PvvjAwzcthQxEoEaNA", {"alg": "PS256", "cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - true + - alg: PS256 + typ: JWT + - iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0455.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0455.yaml new file mode 100644 index 0000000000..d9f9b815f0 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0455.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/ps256-alg-wrong + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4In0.iCePYnD1U13oBe_6ylhmojmkY_VZNYXqVszAej8RImMGv51OEqARmYFkRZYTiYCiVFober7vcDq_stOj1uAJCuttygGW_dpHiN-3EWsU2E2vCnXlygWe0ud38pOC-OVyEFbXxO9-m51vnS-3VmBjEO8G1UE8bLFXTeFOGkUIj9dqlefJSWh5wa8XA3g9mj0jqpuJi-7QgEIeVHk-JzhGpoFqI2f-Df_agVvc2x4V-6fJmj7wV2IsaFPRi36mVQmg8S-dkxu4AlaeCILhyNZl8ewjBHHBjJFRwzcy88L00mzdO51ZxEYsBdQav3ux2sc6vjT9PvvjAwzcthQxEoEaNA", {"alg": "RS256", "cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0456.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0456.yaml new file mode 100644 index 0000000000..c44bf505f8 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0456.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/rs256-exp-ok + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4IiwgImV4cCI6IDMwMDB9.hqDP3AzshNhUZMI02U3nLPrj93QFrgs-74XFrF1Vry2bplrz-NKpdVdfTu8iY_bhmkWf2Om5DdwRZj2ZgpGahtnshnHaRq0RyqF-m3Y7oNj6JL_YMwgxsFIIHtBlagBqDU-gZK99iqSOSGqVhvxqX6gCqFgE7vnEGHeeDedtRM53coAJuwzy8rQV9m3TewoofPdPasGv-dBLQZ3qgmnibkSgb7SmFpjXBy8zL3xJXOZhAHYlgcmcEoFVaWlBguIcWA87WZlpCLYcdYTJzSZweC3QLUhZ4RLJW84-LMKp6xWLLPrp3OgnsduB2G9PYMmYw_qCkuY1KGwfH4PvCQbAzQ", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----", "time": 2000000000000}, [x, y, z]) + } + want_result: + - x: + - true + - alg: RS256 + typ: JWT + - exp: 3000 + iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0457.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0457.yaml new file mode 100644 index 0000000000..8b30730547 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0457.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/rs256-exp-expired + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4IiwgImV4cCI6IDMwMDB9.hqDP3AzshNhUZMI02U3nLPrj93QFrgs-74XFrF1Vry2bplrz-NKpdVdfTu8iY_bhmkWf2Om5DdwRZj2ZgpGahtnshnHaRq0RyqF-m3Y7oNj6JL_YMwgxsFIIHtBlagBqDU-gZK99iqSOSGqVhvxqX6gCqFgE7vnEGHeeDedtRM53coAJuwzy8rQV9m3TewoofPdPasGv-dBLQZ3qgmnibkSgb7SmFpjXBy8zL3xJXOZhAHYlgcmcEoFVaWlBguIcWA87WZlpCLYcdYTJzSZweC3QLUhZ4RLJW84-LMKp6xWLLPrp3OgnsduB2G9PYMmYw_qCkuY1KGwfH4PvCQbAzQ", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----", "time": 4000000000000}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0458.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0458.yaml new file mode 100644 index 0000000000..cc7d3711f3 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0458.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/rs256-exp-now-expired + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4IiwgImV4cCI6IDMwMDB9.hqDP3AzshNhUZMI02U3nLPrj93QFrgs-74XFrF1Vry2bplrz-NKpdVdfTu8iY_bhmkWf2Om5DdwRZj2ZgpGahtnshnHaRq0RyqF-m3Y7oNj6JL_YMwgxsFIIHtBlagBqDU-gZK99iqSOSGqVhvxqX6gCqFgE7vnEGHeeDedtRM53coAJuwzy8rQV9m3TewoofPdPasGv-dBLQZ3qgmnibkSgb7SmFpjXBy8zL3xJXOZhAHYlgcmcEoFVaWlBguIcWA87WZlpCLYcdYTJzSZweC3QLUhZ4RLJW84-LMKp6xWLLPrp3OgnsduB2G9PYMmYw_qCkuY1KGwfH4PvCQbAzQ", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0459.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0459.yaml new file mode 100644 index 0000000000..4a6fa9a2b2 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0459.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jwtdecodeverify/rs256-exp-now-explicit-expired + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + now := time.now_ns() + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4IiwgImV4cCI6IDMwMDB9.hqDP3AzshNhUZMI02U3nLPrj93QFrgs-74XFrF1Vry2bplrz-NKpdVdfTu8iY_bhmkWf2Om5DdwRZj2ZgpGahtnshnHaRq0RyqF-m3Y7oNj6JL_YMwgxsFIIHtBlagBqDU-gZK99iqSOSGqVhvxqX6gCqFgE7vnEGHeeDedtRM53coAJuwzy8rQV9m3TewoofPdPasGv-dBLQZ3qgmnibkSgb7SmFpjXBy8zL3xJXOZhAHYlgcmcEoFVaWlBguIcWA87WZlpCLYcdYTJzSZweC3QLUhZ4RLJW84-LMKp6xWLLPrp3OgnsduB2G9PYMmYw_qCkuY1KGwfH4PvCQbAzQ", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----", "time": now}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0460.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0460.yaml new file mode 100644 index 0000000000..613807292c --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0460.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/rs256-nbf-ok + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJuYmYiOiAxMDAwLCAiaXNzIjogInh4eCJ9.cwwYDfJhU_ambPIpwBJwDek05miffoudprr41IAYsl0IKekb1ii2uEgwkNM-LJtVXHe9hsK3gANFyfqoJuCZIBvaNMx_3Z0BUdeBs4k1UwBiZCpuud0ofgHKURwvehNgqDvRfchq_-K_Agi2iRdl0oShgLjN-gVbBl8pRwUbQrvASlcsCpZIKUyOzXNtaIZEFh1z6ISDy8UHHOdoieKpN23swya7QAcEb0wXEEKMkkhiRd5QHgWLk37Lnw2K89mKcq4Om0CtV9nHrxxmpYGSMPojCy16Gjdg5-xKyJWvxCfb3YUBUVM4RWa7ICOPRJWPuHxu9pPYG63hb_qDU6NLsw", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----", "time": 2000000000000}, [x, y, z]) + } + want_result: + - x: + - true + - alg: RS256 + typ: JWT + - iss: xxx + nbf: 1000 diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0461.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0461.yaml new file mode 100644 index 0000000000..00251cc5ea --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0461.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/rs256-nbf-now-ok + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJuYmYiOiAxMDAwLCAiaXNzIjogInh4eCJ9.cwwYDfJhU_ambPIpwBJwDek05miffoudprr41IAYsl0IKekb1ii2uEgwkNM-LJtVXHe9hsK3gANFyfqoJuCZIBvaNMx_3Z0BUdeBs4k1UwBiZCpuud0ofgHKURwvehNgqDvRfchq_-K_Agi2iRdl0oShgLjN-gVbBl8pRwUbQrvASlcsCpZIKUyOzXNtaIZEFh1z6ISDy8UHHOdoieKpN23swya7QAcEb0wXEEKMkkhiRd5QHgWLk37Lnw2K89mKcq4Om0CtV9nHrxxmpYGSMPojCy16Gjdg5-xKyJWvxCfb3YUBUVM4RWa7ICOPRJWPuHxu9pPYG63hb_qDU6NLsw", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - true + - alg: RS256 + typ: JWT + - iss: xxx + nbf: 1000 diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0462.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0462.yaml new file mode 100644 index 0000000000..8ed612c9a2 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0462.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/rs256-nbf-toosoon + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJuYmYiOiAxMDAwLCAiaXNzIjogInh4eCJ9.cwwYDfJhU_ambPIpwBJwDek05miffoudprr41IAYsl0IKekb1ii2uEgwkNM-LJtVXHe9hsK3gANFyfqoJuCZIBvaNMx_3Z0BUdeBs4k1UwBiZCpuud0ofgHKURwvehNgqDvRfchq_-K_Agi2iRdl0oShgLjN-gVbBl8pRwUbQrvASlcsCpZIKUyOzXNtaIZEFh1z6ISDy8UHHOdoieKpN23swya7QAcEb0wXEEKMkkhiRd5QHgWLk37Lnw2K89mKcq4Om0CtV9nHrxxmpYGSMPojCy16Gjdg5-xKyJWvxCfb3YUBUVM4RWa7ICOPRJWPuHxu9pPYG63hb_qDU6NLsw", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----", "time": 500000000000}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0463.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0463.yaml new file mode 100644 index 0000000000..10fa3395f0 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0463.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/rs256-alg-missing + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJ0eXAiOiAiSldUIiwgImtpZCI6ICJrMSJ9.eyJpc3MiOiAieHh4IiwgInN1YiI6ICJmcmVkIn0.J4J4FgUD_P5fviVVjgvQWJDg-5XYTP_tHCwB3kSlYVKv8vmnZRNh4ke68OxfMP96iM-LZswG2fNqe-_piGIMepF5rCe1iIWAuz3qqkxfS9YVF3hvwoXhjJT0yIgrDMl1lfW5_XipNshZoxddWK3B7dnVW74MFazEEFuefiQm3PdMUX8jWGsmfgPnqBIZTizErNhoIMuRvYaVM1wA2nfrpVGONxMTaw8T0NRwYIuZwubbnNQ1yLhI0y3dsZvQ_lrh9Khtk9fS1V3SRh7aa9AvferJ4T-48qn_V1m3sINPgoA-uLGyyu3k_GkXRYW1yGNC-MH4T2cwhj89WITbIhusgQ", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0464.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0464.yaml new file mode 100644 index 0000000000..bb843efc36 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0464.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/rs256-crit-junk + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJjcml0IjogWyJqdW5rIl0sICJraWQiOiAiazEiLCAiYWxnIjogIlJTMjU2IiwgInR5cCI6ICJKV1QiLCAianVuayI6ICJ4eHgifQ.eyJpc3MiOiAieHh4IiwgInN1YiI6ICJmcmVkIn0.YfoUpW5CgDBtxtBuOix3cdYJGT8cX9Mq7wOhIbjDK7eRQUsAmMY_0EQPh7bd7Yi1gLI3e11BKzguf2EHqAa1kbkHWwFniBO-RIi8q42v2uxC4lpEpIjfaaXB5XmsLfAXtYRqh0AObvbSho6VDXBP_Kn81nhIiE2yFbH14_jhRMSxDBs5ToSkXV-XJHw5bONP8NxPqEk9KF3ZJGzN7J_KoD6LjqfYai5K0eLNEIZh4C1WjTdmCKMR4K6ieZRQWZiSsnhSqLSQERir4n22G3QsdY7dOnCp-SS4VYu3V-PfsOSFMvQ-TTAN1geqMZ9A7k1CCLW0wxKBs-KCiYzmRTzwxA", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0465.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0465.yaml new file mode 100644 index 0000000000..47670c7d6c --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0465.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jwtdecodeverify/rsa256-nested + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCIsICJjdHkiOiAiSldUIn0.ZXlKaGJHY2lPaUFpVWxNeU5UWWlMQ0FpZEhsd0lqb2dJa3BYVkNKOS5leUpwYzNNaU9pQWllSGg0SW4wLnJSUnJlUU9DYW9ZLW1Nazcyak5GZVk1YVlFUWhJZ0lFdFZkUTlYblltUUwyTHdfaDdNbkk0U0VPMVBwa0JIVEpyZnljbEplTHpfalJ2UGdJMlcxaDFCNGNaVDhDZ21pVXdxQXI5c0puZHlVQ1FtSWRrbm53WkI5cXAtX3BTdGRHWEo5WnAzeEo4NXotVEJpWlN0QUNUZFdlUklGSUU3VkxPa20tRmxZdzh5OTdnaUN4TmxUdWl3amxlTjMwZDhnWHUxNkZGQzJTSlhtRjZKbXYtNjJHbERhLW1CWFZ0bGJVSTVlWVUwaTdueTNyQjBYUVQxRkt4ZUZ3OF85N09FdV9jY3VLcl82ZHlHZVFHdnQ5Y3JJeEFBMWFZbDdmbVBrNkVhcjllTTNKaGVYMi00Wkx0d1FOY1RDT01YV0dIck1DaG5MWVc4WEFrTHJEbl9yRmxUaVMtZw.Xicc2sWCZ_Nithucsw9XD7YOKrirUdEnH3MyiPM-Ck3vEU2RsTBsfU2JPhfjp3phc0VOgsAXCzwU5PwyNyUo1490q8YSym-liMyO2Lk-hjH5fAxoizg9yD4II_lK6Wz_Tnpc0bBGDLdbuUhvgvO7yqo-leBQlsfRXOvw4VSPSEy8QPtbURtbnLpWY2jGBKz7vGI_o4qDJ3PicG0kyEiWZNh3wjeeCYRCWvXN8qh7Uk5EA-8J5vX651GqV-7gmaX1n-8DXamhaCQcE-p1cjSj04-X-_bJlQtmb-TT3bSyUPxgHVncvxNUby8jkUTzfi5MMbmIzWWkxI5YtJTdtmCkPQ", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - true + - alg: RS256 + typ: JWT + - iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0466.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0466.yaml new file mode 100644 index 0000000000..cacd11e7a6 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0466.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jwtdecodeverify/rsa256-nested2 + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCIsICJjdHkiOiAiSldUIn0.ZXlKaGJHY2lPaUFpVWxNeU5UWWlMQ0FpZEhsd0lqb2dJa3BYVkNJc0lDSmpkSGtpT2lBaVNsZFVJbjAuWlhsS2FHSkhZMmxQYVVGcFZXeE5lVTVVV1dsTVEwRnBaRWhzZDBscWIyZEphM0JZVmtOS09TNWxlVXB3WXpOTmFVOXBRV2xsU0dnMFNXNHdMbkpTVW5KbFVVOURZVzlaTFcxTmF6Y3lhazVHWlZrMVlWbEZVV2hKWjBsRmRGWmtVVGxZYmxsdFVVd3lUSGRmYURkTmJrazBVMFZQTVZCd2EwSklWRXB5Wm5samJFcGxUSHBmYWxKMlVHZEpNbGN4YURGQ05HTmFWRGhEWjIxcFZYZHhRWEk1YzBwdVpIbFZRMUZ0U1dScmJtNTNXa0k1Y1hBdFgzQlRkR1JIV0VvNVduQXplRW80TlhvdFZFSnBXbE4wUVVOVVpGZGxVa2xHU1VVM1ZreFBhMjB0Um14WmR6aDVPVGRuYVVONFRteFVkV2wzYW14bFRqTXdaRGhuV0hVeE5rWkdRekpUU2xodFJqWktiWFl0TmpKSGJFUmhMVzFDV0ZaMGJHSlZTVFZsV1ZVd2FUZHVlVE55UWpCWVVWUXhSa3Q0WlVaM09GODVOMDlGZFY5alkzVkxjbDgyWkhsSFpWRkhkblE1WTNKSmVFRkJNV0ZaYkRkbWJWQnJOa1ZoY2psbFRUTkthR1ZZTWkwMFdreDBkMUZPWTFSRFQwMVlWMGRJY2sxRGFHNU1XVmM0V0VGclRISkVibDl5Um14VWFWTXRady5YaWNjMnNXQ1pfTml0aHVjc3c5WEQ3WU9LcmlyVWRFbkgzTXlpUE0tQ2szdkVVMlJzVEJzZlUySlBoZmpwM3BoYzBWT2dzQVhDendVNVB3eU55VW8xNDkwcThZU3ltLWxpTXlPMkxrLWhqSDVmQXhvaXpnOXlENElJX2xLNld6X1RucGMwYkJHRExkYnVVaHZndk83eXFvLWxlQlFsc2ZSWE92dzRWU1BTRXk4UVB0YlVSdGJuTHBXWTJqR0JLejd2R0lfbzRxREozUGljRzBreUVpV1pOaDN3amVlQ1lSQ1d2WE44cWg3VWs1RUEtOEo1dlg2NTFHcVYtN2dtYVgxbi04RFhhbWhhQ1FjRS1wMWNqU2owNC1YLV9iSmxRdG1iLVRUM2JTeVVQeGdIVm5jdnhOVWJ5OGprVVR6Zmk1TU1ibUl6V1dreEk1WXRKVGR0bUNrUFE.ODBVH_gooCLJxtPVr1MjJC1syG4MnVUFP9LkI9pSaj0QABV4vpfqrBshHn8zOPgUTDeHwbc01Qy96cQlTMQQb94YANmZyL1nzwmdR4piiGXMGSlcCNfDg1o8DK4msMSR-X-j2IkxBDB8rfeFSfLRMgDCjAF0JolW7qWmMD9tBmFNYAjly4vMwToOXosDmFLl5eqyohXDf-3Ohljm5kIjtyMWkt5S9EVuwlIXh2owK5l59c4-TH29gkuaZ3uU4LFPjD7XKUrlOQnEMuu2QD8LAqTyxbnY4JyzUWEvyTM1dVmGnFpLKCg9QBly__y1u2ffhvDsHyuCmEKAbhPE98YvFA", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - true + - alg: RS256 + typ: JWT + - iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0467.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0467.yaml new file mode 100644 index 0000000000..0291e940e4 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0467.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jwtdecodeverify/es256-unconstrained + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiRVMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4In0.JvbTLBF06FR70gb7lCbx_ojhp4bk9--B_aULgNlYM0fYf9OSawaqBQp2lwW6FADFtRJ2WFUk5g0zwVOUlnrlzw", {"cert": "-----BEGIN CERTIFICATE-----\nMIIBcDCCARagAwIBAgIJAMZmuGSIfvgzMAoGCCqGSM49BAMCMBMxETAPBgNVBAMM\nCHdoYXRldmVyMB4XDTE4MDgxMDE0Mjg1NFoXDTE4MDkwOTE0Mjg1NFowEzERMA8G\nA1UEAwwId2hhdGV2ZXIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATPwn3WCEXL\nmjp/bFniDwuwsfu7bASlPae2PyWhqGeWwe23Xlyx+tSqxlkXYe4pZ23BkAAscpGj\nyn5gXHExyDlKo1MwUTAdBgNVHQ4EFgQUElRjSoVgKjUqY5AXz2o74cLzzS8wHwYD\nVR0jBBgwFoAUElRjSoVgKjUqY5AXz2o74cLzzS8wDwYDVR0TAQH/BAUwAwEB/zAK\nBggqhkjOPQQDAgNIADBFAiEA4yQ/88ZrUX68c6kOe9G11u8NUaUzd8pLOtkKhniN\nOHoCIHmNX37JOqTcTzGn2u9+c8NlnvZ0uDvsd1BmKPaUmjmm\n-----END CERTIFICATE-----\n"}, [x, y, z]) + } + want_result: + - x: + - true + - alg: ES256 + typ: JWT + - iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0468.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0468.yaml new file mode 100644 index 0000000000..c8d7281d54 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0468.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: jwtdecodeverify/hs256-unconstrained + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiYWxpY2UiLCJhenAiOiJhbGljZSIsInN1Ym9yZGluYXRlcyI6W10sImhyIjpmYWxzZX0.rz3jTY033z-NrKfwrK89_dcLF7TN4gwCMj-fVBDyLoM", {"secret": "secret"}, [x, y, z]) + } + want_result: + - x: + - true + - alg: HS256 + typ: JWT + - azp: alice + hr: false + subordinates: [] + user: alice diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0469.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0469.yaml new file mode 100644 index 0000000000..b9965b4b01 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0469.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/hs256-key-wrong + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiYWxpY2UiLCJhenAiOiJhbGljZSIsInN1Ym9yZGluYXRlcyI6W10sImhyIjpmYWxzZX0.rz3jTY033z-NrKfwrK89_dcLF7TN4gwCMj-fVBDyLoM", {"secret": "the wrong key"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0470.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0470.yaml new file mode 100644 index 0000000000..89e88327fe --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0470.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/rs256-aud + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4IiwgImF1ZCI6ICJmcmVkIn0.F-9m2Tx8r1tuQFirazsI4FK05bXX3uP4ut8M2FryJ07k3bQhy262fdwNDmuFcGx0NfL-c80agcwGoTzMWXkVEgZ2KTz0QSAdcdGk3ZWtUy-Mj2IilZ1dzkVvW8LsithYFTGcUtkelFDrJwtMQ0Kum7SXJpC_HCBk4PbftY0XD6jRgHLnQdeT9_J11L4sd19vCdpxxxm3_m_yvUV3ZynzB4vhQbS3CET4EClAVhi-m_gMh9mj85gY1ycIz6-FxWv8xM2Igm2SMeIdyJwAvEGnIauRS928P_OqVCZgCH2Pafnxtzy77Llpxy8XS0xu5PtPw3_azhg33GaXDCFsfz6GpA", {"aud": "fred", "cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - true + - alg: RS256 + typ: JWT + - aud: fred + iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0471.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0471.yaml new file mode 100644 index 0000000000..cd39ceb6d4 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0471.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: jwtdecodeverify/rs256-aud-list + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4IiwgImF1ZCI6IFsiZnJlZCIsICJib2IiXX0.k8jW7PUiMkQCKCjnSFBFFKPDO0RXwZgVkLUwUfi8sMdrrcKi12LC8wd5fLBn0YraFtMXWKdMweKf9ZC-K33h5TK7kkTVKOXctF50mleMlUn0Up_XjtdP1v-2WOfivUXcexN1o-hu0kH7sSQnielXIjC2EAleG6A54YUOZFBdzvd1PKHlsxA7x2iiL73uGeFlyxoaMki8E5tx7FY6JGF1RdhWCoIV5A5J8QnwI5EetduJQ505U65Pk7UApWYWu4l2DT7KCCJa5dJaBvCBemVxWaBhCQWtJKU2ZgOEkpiK7b_HsdeRBmpG9Oi1o5mt5ybC09VxSD-lEda_iJO_7i042A", {"aud": "bob", "cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - true + - alg: RS256 + typ: JWT + - aud: + - fred + - bob + iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0472.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0472.yaml new file mode 100644 index 0000000000..b570b936d9 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0472.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/ps256-no-aud + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4In0.iCePYnD1U13oBe_6ylhmojmkY_VZNYXqVszAej8RImMGv51OEqARmYFkRZYTiYCiVFober7vcDq_stOj1uAJCuttygGW_dpHiN-3EWsU2E2vCnXlygWe0ud38pOC-OVyEFbXxO9-m51vnS-3VmBjEO8G1UE8bLFXTeFOGkUIj9dqlefJSWh5wa8XA3g9mj0jqpuJi-7QgEIeVHk-JzhGpoFqI2f-Df_agVvc2x4V-6fJmj7wV2IsaFPRi36mVQmg8S-dkxu4AlaeCILhyNZl8ewjBHHBjJFRwzcy88L00mzdO51ZxEYsBdQav3ux2sc6vjT9PvvjAwzcthQxEoEaNA", {"aud": "cath", "cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0473.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0473.yaml new file mode 100644 index 0000000000..1b859b0e1b --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0473.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/rs256-missing-aud + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4IiwgImF1ZCI6ICJmcmVkIn0.F-9m2Tx8r1tuQFirazsI4FK05bXX3uP4ut8M2FryJ07k3bQhy262fdwNDmuFcGx0NfL-c80agcwGoTzMWXkVEgZ2KTz0QSAdcdGk3ZWtUy-Mj2IilZ1dzkVvW8LsithYFTGcUtkelFDrJwtMQ0Kum7SXJpC_HCBk4PbftY0XD6jRgHLnQdeT9_J11L4sd19vCdpxxxm3_m_yvUV3ZynzB4vhQbS3CET4EClAVhi-m_gMh9mj85gY1ycIz6-FxWv8xM2Igm2SMeIdyJwAvEGnIauRS928P_OqVCZgCH2Pafnxtzy77Llpxy8XS0xu5PtPw3_azhg33GaXDCFsfz6GpA", {"cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0474.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0474.yaml new file mode 100644 index 0000000000..74a55f9613 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0474.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/rs256-wrong-aud + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4IiwgImF1ZCI6ICJmcmVkIn0.F-9m2Tx8r1tuQFirazsI4FK05bXX3uP4ut8M2FryJ07k3bQhy262fdwNDmuFcGx0NfL-c80agcwGoTzMWXkVEgZ2KTz0QSAdcdGk3ZWtUy-Mj2IilZ1dzkVvW8LsithYFTGcUtkelFDrJwtMQ0Kum7SXJpC_HCBk4PbftY0XD6jRgHLnQdeT9_J11L4sd19vCdpxxxm3_m_yvUV3ZynzB4vhQbS3CET4EClAVhi-m_gMh9mj85gY1ycIz6-FxWv8xM2Igm2SMeIdyJwAvEGnIauRS928P_OqVCZgCH2Pafnxtzy77Llpxy8XS0xu5PtPw3_azhg33GaXDCFsfz6GpA", {"aud": "cath", "cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0475.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0475.yaml new file mode 100644 index 0000000000..ab14626980 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0475.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/rs256-wrong-aud-list + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3MiOiAieHh4IiwgImF1ZCI6IFsiZnJlZCIsICJib2IiXX0.k8jW7PUiMkQCKCjnSFBFFKPDO0RXwZgVkLUwUfi8sMdrrcKi12LC8wd5fLBn0YraFtMXWKdMweKf9ZC-K33h5TK7kkTVKOXctF50mleMlUn0Up_XjtdP1v-2WOfivUXcexN1o-hu0kH7sSQnielXIjC2EAleG6A54YUOZFBdzvd1PKHlsxA7x2iiL73uGeFlyxoaMki8E5tx7FY6JGF1RdhWCoIV5A5J8QnwI5EetduJQ505U65Pk7UApWYWu4l2DT7KCCJa5dJaBvCBemVxWaBhCQWtJKU2ZgOEkpiK7b_HsdeRBmpG9Oi1o5mt5ybC09VxSD-lEda_iJO_7i042A", {"aud": "cath", "cert": "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----"}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0476.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0476.yaml new file mode 100644 index 0000000000..7a984f4b5d --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0476.yaml @@ -0,0 +1,46 @@ +--- +cases: + - note: jwtdecodeverify/multiple-keys-one-valid + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify( + "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.ZcLZbBKpPFFz8YGD2jEbXzwHT7DWtqRVk1PTV-cAWUV8jr6f2a--Fw9SFR3vSbrtFif06AQ3aWY7PMM2AuxDjiUVGjItmHRz0sJBEijcE2QVkDN7MNK3Kk1fsM_hbEXzNCzChZpEkTZnLy9ijkJJFD0j6lBat4lO5Zc_LC2lXUftV_hU2aW9mQ7pLSgJjItzRymivnN0g-WUDq5IPK_M8b3yPy_N9iByj8B2FO0sC3TuOrXWbrYrX4ve4bAaSqOFOXiL5Z5BJfmmtT--xKdWDGJxnei8lbv7in7t223fVsUpsH-zmybp529Fya37BsaIlcgLrl38ghvoqy2sHu2wAA", { + "cert": `{ + "keys": [ + { + "kty": "EC", + "use": "sig", + "crv": "P-256", + "kid": "k1", + "x": "9Qq5S5VqMQoH-FOI4atcH6V3bua03C-5ZMZMG1rszwA", + "y": "LLbFxWkGBEBrTm1GMYZJy1OXCH1KLweJMCgIEPIsibU", + "alg": "ES256" + }, + { + "kty": "RSA", + "e": "AQAB", + "use": "enc", + "kid": "k2", + "alg": "RS256", + "n": "sGu-fYVE2nq2dPxJlqAMI0Z8G3FD0XcWDnD8mkfO1ddKRGuUQZmfj4gWeZGyIk3cnuoy7KJCEqa3daXc08QHuFZyfn0rH33t8_AFsvb0q0i7R2FK-Gdqs_E0-sGpYMsRJdZWfCioLkYjIHEuVnRbi3DEsWqe484rEGbKF60jNRgGC4b-8pz-E538ZkssWxcqHrYIj5bjGEU36onjS3M_yrTuNvzv_8wRioK4fbcwmGne9bDxu8LcoSReWpPn0CnUkWnfqroRcMJnC87ZuJagDW1ZWCmU3psdsVanmFFh0DP6z0fsA4h8G2n9-qp-LEKFaWwo3IWlOsIzU3MHdcEiGw" + } + ] + }`, + "time": 1574723450396363500, + }, + [x, y, z], + ) + } + want_result: + - x: + - true + - alg: RS256 + typ: JWT + - admin: true + iat: 1516239022 + name: John Doe + sub: "1234567890" diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0477.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0477.yaml new file mode 100644 index 0000000000..1b9fa99da8 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0477.yaml @@ -0,0 +1,42 @@ +--- +cases: + - note: jwtdecodeverify/multiple-keys-no-valid + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify( + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.G051ZlKno4XdDz4pdPthPKH1cKlFqkREvx_dHhl6kwM", { + "cert": `{ + "keys": [ + { + "kty": "EC", + "use": "sig", + "crv": "P-256", + "kid": "k1", + "x": "9Qq5S5VqMQoH-FOI4atcH6V3bua03C-5ZMZMG1rszwA", + "y": "LLbFxWkGBEBrTm1GMYZJy1OXCH1KLweJMCgIEPIsibU", + "alg": "ES256" + }, + { + "kty": "RSA", + "e": "AQAB", + "use": "enc", + "kid": "k2", + "alg": "RS256", + "n": "sGu-fYVE2nq2dPxJlqAMI0Z8G3FD0XcWDnD8mkfO1ddKRGuUQZmfj4gWeZGyIk3cnuoy7KJCEqa3daXc08QHuFZyfn0rH33t8_AFsvb0q0i7R2FK-Gdqs_E0-sGpYMsRJdZWfCioLkYjIHEuVnRbi3DEsWqe484rEGbKF60jNRgGC4b-8pz-E538ZkssWxcqHrYIj5bjGEU36onjS3M_yrTuNvzv_8wRioK4fbcwmGne9bDxu8LcoSReWpPn0CnUkWnfqroRcMJnC87ZuJagDW1ZWCmU3psdsVanmFFh0DP6z0fsA4h8G2n9-qp-LEKFaWwo3IWlOsIzU3MHdcEiGw" + } + ] + }`, + "time": 1574723450396363500, + }, + [x, y, z], + ) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0478.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0478.yaml new file mode 100644 index 0000000000..85b5b861be --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0478.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-nbf + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ4eHgiLCJuYmYiOjEwMDAuMX0.8ab0xurlRs_glclA3Sm7OMQgwkQvE4HuLsfMOc4nVO8", {"secret": "secret", "time": 2000000000000.1}, [x, y, z]) + } + want_result: + - x: + - true + - alg: HS256 + typ: JWT + - iss: xxx + nbf: 1000.1 diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0479.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0479.yaml new file mode 100644 index 0000000000..c70e54fbd7 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0479.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-nbf-not-valid + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ4eHgiLCJuYmYiOjMwMDAuMX0.khHsSae91zHwuaTIvszln3kyrOdPyUYiGSvCI0j2ie8", {"secret": "secret", "time": 2000000000000.1}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0480.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0480.yaml new file mode 100644 index 0000000000..63cddc9f56 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0480.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-exp-valid + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjMwMDAuMiwiaXNzIjoieHh4In0.XUen7GtDmICV3O1ngsoO-tQrjrXtOgJI06oGW0nQSIM", {"secret": "secret", "time": 2000000000000.1}, [x, y, z]) + } + want_result: + - x: + - true + - alg: HS256 + typ: JWT + - exp: 3000.2 + iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0481.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0481.yaml new file mode 100644 index 0000000000..c82eba813e --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0481.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-exp-expired + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjMwMDAuMiwiaXNzIjoieHh4In0.XUen7GtDmICV3O1ngsoO-tQrjrXtOgJI06oGW0nQSIM", {"secret": "secret", "time": 4000000000000.1}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0482.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0482.yaml new file mode 100644 index 0000000000..7e15d3928e --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0482.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-nbf-one-tenth-second-before + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ4eHgiLCJuYmYiOjEuNTg5Mzg1NzcwMTIzNGUrMDl9.lvrsV1nam-BZr0SomWwsr4dBfu6BDrR2FzQ1iS_Xnrw", {"secret": "secret", "time": 1589385770023400000}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0483.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0483.yaml new file mode 100644 index 0000000000..756cfd44ae --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0483.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-nbf-equal + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ4eHgiLCJuYmYiOjEuNTg5Mzg1NzcwMTIzNGUrMDl9.lvrsV1nam-BZr0SomWwsr4dBfu6BDrR2FzQ1iS_Xnrw", {"secret": "secret", "time": 1589385770123400000}, [x, y, z]) + } + want_result: + - x: + - true + - alg: HS256 + typ: JWT + - iss: xxx + nbf: 1589385770.1234 diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0484.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0484.yaml new file mode 100644 index 0000000000..78a70a8383 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0484.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-one-millisecond-after-nbf + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ4eHgiLCJuYmYiOjEuNTg5Mzg1NzcwMTIzNGUrMDl9.lvrsV1nam-BZr0SomWwsr4dBfu6BDrR2FzQ1iS_Xnrw", {"secret": "secret", "time": 1589385770124400000}, [x, y, z]) + } + want_result: + - x: + - true + - alg: HS256 + typ: JWT + - iss: xxx + nbf: 1589385770.1234 diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0485.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0485.yaml new file mode 100644 index 0000000000..db4c3b3a59 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0485.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-one-tenth-second-after-nbf + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ4eHgiLCJuYmYiOjEuNTg5Mzg1NzcwMTIzNGUrMDl9.lvrsV1nam-BZr0SomWwsr4dBfu6BDrR2FzQ1iS_Xnrw", {"secret": "secret", "time": 1589385770223400000}, [x, y, z]) + } + want_result: + - x: + - true + - alg: HS256 + typ: JWT + - iss: xxx + nbf: 1589385770.1234 diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0486.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0486.yaml new file mode 100644 index 0000000000..74fa244c2c --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0486.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-one-second-after-nbf + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ4eHgiLCJuYmYiOjEuNTg5Mzg1NzcwMTIzNGUrMDl9.lvrsV1nam-BZr0SomWwsr4dBfu6BDrR2FzQ1iS_Xnrw", {"secret": "secret", "time": 1589385771123400000}, [x, y, z]) + } + want_result: + - x: + - true + - alg: HS256 + typ: JWT + - iss: xxx + nbf: 1589385770.1234 diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0487.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0487.yaml new file mode 100644 index 0000000000..e7774c7dcd --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0487.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-one-second-before-exp + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuNTg5Mzg1NzcxMTIzNGUrMDksImlzcyI6Inh4eCJ9.PZ2z6VfHt9YdvHHUbilkTnw4R9TK3_V0LV1h-q0k9xg", {"secret": "secret", "time": 1589385770123400000}, [x, y, z]) + } + want_result: + - x: + - true + - alg: HS256 + typ: JWT + - exp: 1589385771.1234 + iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0488.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0488.yaml new file mode 100644 index 0000000000..69c47501f9 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0488.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-one-tenth-second-before-exp + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuNTg5Mzg1NzcxMTIzNGUrMDksImlzcyI6Inh4eCJ9.PZ2z6VfHt9YdvHHUbilkTnw4R9TK3_V0LV1h-q0k9xg", {"secret": "secret", "time": 1589385771023400000}, [x, y, z]) + } + want_result: + - x: + - true + - alg: HS256 + typ: JWT + - exp: 1589385771.1234 + iss: xxx diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0489.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0489.yaml new file mode 100644 index 0000000000..80a417f9c3 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0489.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-equal-exp + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuNTg5Mzg1NzcxMTIzNGUrMDksImlzcyI6Inh4eCJ9.PZ2z6VfHt9YdvHHUbilkTnw4R9TK3_V0LV1h-q0k9xg", {"secret": "secret", "time": 1589385771123400000}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0490.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0490.yaml new file mode 100644 index 0000000000..9a750281d8 --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0490.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-one-tenth-second-after-exp + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuNTg5Mzg1NzcxMTIzNGUrMDksImlzcyI6Inh4eCJ9.PZ2z6VfHt9YdvHHUbilkTnw4R9TK3_V0LV1h-q0k9xg", {"secret": "secret", "time": 1589385771223400000}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0491.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0491.yaml new file mode 100644 index 0000000000..17ca6c824d --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-0491.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/hs256-float-one-second-after-exp + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + io.jwt.decode_verify("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEuNTg5Mzg1NzcxMTIzNGUrMDksImlzcyI6Inh4eCJ9.PZ2z6VfHt9YdvHHUbilkTnw4R9TK3_V0LV1h-q0k9xg", {"secret": "secret", "time": 1589385772123400000}, [x, y, z]) + } + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml new file mode 100644 index 0000000000..2e1421383a --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-invalid-exp-type.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtdecodeverify/invalid-exp + query: data.generated.decoded = x + modules: + - | + package generated + + token := io.jwt.encode_sign({"alg": "HS256"}, {"exp": null}, {"kty": "oct", "k": base64url.encode_no_pad("42")}) + + decoded := io.jwt.decode_verify(token, {"secret": "42"}) + want_error_code: eval_builtin_error + want_error: exp value must be a number + strict_error: true diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml new file mode 100644 index 0000000000..4fdc5c0d3a --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-invalid-nbf-type.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtdecodeverify/invalid-nbf + query: data.generated.decoded = x + modules: + - | + package generated + + token := io.jwt.encode_sign({"alg": "HS256"}, {"nbf": "string is not valid here"}, {"kty": "oct", "k": base64url.encode_no_pad("42")}) + + decoded := io.jwt.decode_verify(token, {"secret": "42"}) + want_error_code: eval_builtin_error + want_error: nbf value must be a number + strict_error: true diff --git a/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml new file mode 100644 index 0000000000..8be54fa55e --- /dev/null +++ b/test/cases/testdata/v1/jwtdecodeverify/test-jwtdecodeverify-missing-iss-while-required.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: jwtdecodeverify/missing-iss-while-required + query: data.generated.decoded = x + modules: + - | + package generated + + token := io.jwt.encode_sign({"alg": "HS256"}, {}, {"kty": "oct", "k": base64url.encode_no_pad("42")}) + + decoded := io.jwt.decode_verify(token, {"secret": "42", "iss": "xxx"}) + want_result: + - x: + - false + - {} + - {} diff --git a/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-0492.yaml b/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-0492.yaml new file mode 100644 index 0000000000..66d7f64256 --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-0492.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtencodesign/https://tools.ietf.org/html/rfc7515#appendix-A.1 + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign({"alg": "HS256", "typ": "JWT"}, {"aud": ["bob", "saul"], "exp": 1300819380, "http://example.com/is_root": true, "iss": "joe", "privateParams": {"private_one": "one", "private_two": "two"}}, {"k": "AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow", "kty": "oct"}, x) + } + data: {} + want_result: + - x: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiYm9iIiwic2F1bCJdLCJleHAiOjEzMDA4MTkzODAsImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlLCJpc3MiOiJqb2UiLCJwcml2YXRlUGFyYW1zIjp7InByaXZhdGVfb25lIjoib25lIiwicHJpdmF0ZV90d28iOiJ0d28ifX0.-Or2eol8bzly-Ztb0v7_7UkcKBkN_aNNpK33HK0MeOY diff --git a/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-0493.yaml b/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-0493.yaml new file mode 100644 index 0000000000..984d95d465 --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-0493.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtencodesign/Empty JSON payload + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign({"alg": "HS256", "typ": "JWT"}, {}, {"k": "AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow", "kty": "oct"}, x) + } + data: {} + want_result: + - x: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.6cvao8lnOu6FAdK68jQFcDMXOmaWNwWiYhCgijd-AD8 diff --git a/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-0494.yaml b/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-0494.yaml new file mode 100644 index 0000000000..1522aebb35 --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-0494.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtencodesign/https://tools.ietf.org/html/rfc7515#appendix-A.2 + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign({"alg": "RS256"}, {"aud": ["bob", "saul"], "exp": 1300819380, "http://example.com/is_root": true, "iss": "joe", "privateParams": {"private_one": "one", "private_two": "two"}}, {"d": "Eq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88vLNO97IjlA7_GQ5sLKMgvfTeXZx9SE-7YwVol2NXOoAJe46sui395IW_GO-pWJ1O0BkTGoVEn2bKVRUCgu-GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn439X0M_V51gfpRLI9JYanrC4D4qAdGcopV_0ZHHzQlBjudU2QvXt4ehNYTCBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl_x_jTj3ccPDVZFD9pIuhLhBOneufuBiB4cS98l2SR_RQyGWSeWjnczT0QU91p1DhOVRuOopznQ", "dp": "BwKfV3Akq5_MFZDFZCnW-wzl-CCo83WoZvnLQwCTeDv8uzluRSnm71I3QCLdhrqE2e9YkxvuxdBfpT_PI7Yz-FOKnu1R6HsJeDCjn12Sk3vmAktV2zb34MCdy7cpdTh_YVr7tss2u6vneTwrA86rZtu5Mbr1C1XsmvkxHQAdYo0", "dq": "h_96-mK1R_7glhsum81dZxjTnYynPbZpHziZjeeHcXYsXaaMwkOlODsWa7I9xXDoRwbKgB719rrmI2oKr6N3Do9U0ajaHF-NKJnwgjMd2w9cjz3_-kyNlxAr2v4IKhGNpmM5iIgOS1VZnOZ68m6_pbLBSp3nssTdlqvd0tIiTHU", "e": "AQAB", "kty": "RSA", "n": "ofgWCuLjybRlzo0tZWJjNiuSfb4p4fAkd_wWJcyQoTbji9k0l8W26mPddxHmfHQp-Vaw-4qPCJrcS2mJPMEzP1Pt0Bm4d4QlL-yRT-SFd2lZS-pCgNMsD1W_YpRPEwOWvG6b32690r2jZ47soMZo9wGzjb_7OMg0LOL-bSf63kpaSHSXndS5z5rexMdbBYUsLA9e-KXBdQOS-UTo7WTBEMa2R2CapHg665xsmtdVMTBQY4uDZlxvb3qCo5ZwKh9kG4LT6_I5IhlJH7aGhyxXFvUK-DWNmoudF8NAco9_h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXpoQ", "p": "4BzEEOtIpmVdVEZNCqS7baC4crd0pqnRH_5IB3jw3bcxGn6QLvnEtfdUdiYrqBdss1l58BQ3KhooKeQTa9AB0Hw_Py5PJdTJNPY8cQn7ouZ2KKDcmnPGBY5t7yLc1QlQ5xHdwW1VhvKn-nXqhJTBgIPgtldC-KDV5z-y2XDwGUc", "q": "uQPEfgmVtjL0Uyyx88GZFF1fOunH3-7cepKmtH4pxhtCoHqpWmT8YAmZxaewHgHAjLYsp1ZSe7zFYHj7C6ul7TjeLQeZD_YwD66t62wDmpe_HlB-TnBA-njbglfIsRLtXlnDzQkv5dTltRJ11BKBBypeeF6689rjcJIDEz9RWdc", "qi": "IYd7DHOhrWvxkwPQsRM2tOgrjbcrfvtQJipd-DlcxyVuuM9sQLdgjVk2oy26F0EmpScGLq2MowX7fhd_QJQ3ydy5cY7YIBi87w93IKLEdfnbJtoOPLUW0ITrJReOgo1cq9SbsxYawBgfp_gh6A5603k2-ZQwVK0JKSHuLFkuQ3U"}, x) + } + data: {} + want_result: + - x: eyJhbGciOiJSUzI1NiJ9.eyJhdWQiOlsiYm9iIiwic2F1bCJdLCJleHAiOjEzMDA4MTkzODAsImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlLCJpc3MiOiJqb2UiLCJwcml2YXRlUGFyYW1zIjp7InByaXZhdGVfb25lIjoib25lIiwicHJpdmF0ZV90d28iOiJ0d28ifX0.kvCjo2z80h4YO3umCn3iayUXEnBGgw-Nk4-cYNPWagW4SAg34nZSonUt9Kpnc5h0s6LpJAnam1xuEezk-2VRPnu05foQdWTDKJAze-9vZ0wr0L_KyXLZaW0vVfehdGpPgJj_FqVfgnc-hXdL0RADfrKjApsrO7oHpv-Ii3u7oKwauzq5oQ2AXt4cp6ahu8VhOBGQiPXtV98Yw3U3NBetMX-I_qR6-UGsN6Z0pRO0bsdk1ANvMiHT6Y04x8nh4kzk5pfv71ACgnxrs1zxwg7YfYzm2tQXGceu7fwI9sqO_jz2c8RvMsg4u8q0js58F-gR1SVjmTyipnXv0tAGzpZnhg diff --git a/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml b/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml new file mode 100644 index 0000000000..3532106e7d --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-integer-timestamps.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: jwtencodesign/plain integer timestamps + query: data.test.p = x + modules: + - | + package test + + p := x if { + now_ns := 1.678e15 + iat := now_ns / 1e6 + exp := iat + 300 + io.jwt.encode_sign({"alg": "HS256", "typ": "JWT"}, {"iat": iat, "exp": exp}, {"k": "AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow", "kty": "oct"}, x) + } + data: {} + want_result: + - x: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NzgwMDAzMDAsImlhdCI6MTY3ODAwMDAwMH0.ZNCOrxE5MNdrqzHmiQ7c3so0IvGqHddBZFWe3kBaQHg diff --git a/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-set-data.yaml b/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-set-data.yaml new file mode 100644 index 0000000000..16a1bb860c --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesign/test-jwtencodesign-set-data.yaml @@ -0,0 +1,17 @@ +--- +cases: + - data: {} + modules: + - | + package test + + p := io.jwt.encode_sign( + {"alg": "HS256", "typ": "JWT"}, + # aud is a set and should be converted to a list + {"aud": {"bob", "saul"}, "exp": 1300819380, "http://example.com/is_root": true, "iss": "joe", "privateParams": {"private_one": "one", "private_two": "two"}}, + {"k": "AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow", "kty": "oct"} + ) + query: data.test.p = x + note: set data + want_result: + - x: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiYm9iIiwic2F1bCJdLCJleHAiOjEzMDA4MTkzODAsImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlLCJpc3MiOiJqb2UiLCJwcml2YXRlUGFyYW1zIjp7InByaXZhdGVfb25lIjoib25lIiwicHJpdmF0ZV90d28iOiJ0d28ifX0.-Or2eol8bzly-Ztb0v7_7UkcKBkN_aNNpK33HK0MeOY diff --git a/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml b/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml new file mode 100644 index 0000000000..7ca1b1a95a --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0379.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtencodesignheadererrors/Unknown signature algorithm + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign_raw("{\"typ:\"JWT\",\r\n \"alg\":\"HS256\"}", "{\"iss\":\"joe\",\r\n \"exp\":1300819380,\r\n \"http://example.com/is_root\":true}", "{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: invalid character + strict_error: true diff --git a/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml b/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml new file mode 100644 index 0000000000..a791126e8e --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0380.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtencodesignheadererrors/unknown signature algorithm + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign_raw("{\"alg\":\"dummy\"}", "{\"iss\":\"joe\",\r\n \"exp\":1300819380,\r\n \"http://example.com/is_root\":true}", "{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: unknown signature algorithm + strict_error: true diff --git a/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml b/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml new file mode 100644 index 0000000000..a72212ee83 --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0381.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtencodesignheadererrors/Empty JSON header Error + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign_raw("{}", "{\"iss\":\"joe\",\r\n \"exp\":1300819380,\r\n \"http://example.com/is_root\":true}", "{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: unsupported signature algorithm + strict_error: true diff --git a/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml b/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml new file mode 100644 index 0000000000..623d0d2496 --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0382.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtencodesignheadererrors/Empty headers input error + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign_raw("", "{\"iss\":\"joe\",\r\n \"exp\":1300819380,\r\n \"http://example.com/is_root\":true}", "{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: unexpected end of JSON input + strict_error: true diff --git a/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml b/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml new file mode 100644 index 0000000000..5f6d9aa6ac --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignheadererrors/test-jwtencodesignheadererrors-0383.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtencodesignheadererrors/No JSON Error + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign_raw("e", "{\"iss\":\"joe\",\r\n \"exp\":1300819380,\r\n \"http://example.com/is_root\":true}", "{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: invalid character + strict_error: true diff --git a/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml b/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml new file mode 100644 index 0000000000..b6c3ef9ce4 --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0376.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtencodesignpayloaderrors/No Payload + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign_raw("{\"typ\":\"JWT\",\r\n \"alg\":\"HS256\"}", "", "{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: type is JWT but payload is not JSON + strict_error: true diff --git a/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml b/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml new file mode 100644 index 0000000000..b496bfb0c3 --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0377.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtencodesignpayloaderrors/Payload JSON Error + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign_raw("{\"typ\":\"JWT\",\r\n \"alg\":\"HS256\"}", "{\"iss:\"joe\",\r\n \"exp\":1300819380,\r\n \"http://example.com/is_root\":true}", "{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: type is JWT but payload is not JSON + strict_error: true diff --git a/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml b/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml new file mode 100644 index 0000000000..8232fef329 --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignpayloaderrors/test-jwtencodesignpayloaderrors-0378.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtencodesignpayloaderrors/Non JSON Error + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.encode_sign_raw("{\"typ\":\"JWT\",\r\n \"alg\":\"HS256\"}", "e", "{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: type is JWT but payload is not JSON + strict_error: true diff --git a/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0384.yaml b/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0384.yaml new file mode 100644 index 0000000000..2d6aa72bbb --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0384.yaml @@ -0,0 +1,9 @@ +--- +cases: + - note: jwtencodesignraw/https://tools.ietf.org/html/rfc7515#appendix-A.1 + query: data.generated.p = x + modules: + - "package generated\n\np := x if {\n\tio.jwt.encode_sign_raw(\n\t\t`{\"typ\":\"JWT\",\r\n \"alg\":\"HS256\"}`,\n\t\t`{\"iss\":\"joe\",\r\n \"exp\":1300819380,\r\n \"http://example.com/is_root\":true}`,\n\t\t`{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}`,\n\t\tx,\n\t)\n}\n" + data: {} + want_result: + - x: eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk diff --git a/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0385.yaml b/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0385.yaml new file mode 100644 index 0000000000..ccbad926a5 --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0385.yaml @@ -0,0 +1,9 @@ +--- +cases: + - note: jwtencodesignraw/No Payload but Media Type is Plain + query: data.generated.p = x + modules: + - "package generated\n\np := x if {\n\tio.jwt.encode_sign_raw(\n\t\t`{\"typ\":\"text/plain\",\r\n \"alg\":\"HS256\"}`,\n\t\t``, `{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}`,\n\t\tx,\n\t)\n}\n" + data: {} + want_result: + - x: eyJ0eXAiOiJ0ZXh0L3BsYWluIiwNCiAiYWxnIjoiSFMyNTYifQ..sXoGQMWwM-SmX495-htA7kndgbkwz1PnqsDeY275gnI diff --git a/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0386.yaml b/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0386.yaml new file mode 100644 index 0000000000..5de5a453bc --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0386.yaml @@ -0,0 +1,9 @@ +--- +cases: + - note: jwtencodesignraw/text/plain media type + query: data.generated.p = x + modules: + - "package generated\n\np := x if {\n\tio.jwt.encode_sign_raw(\n\t\t`{\"typ\":\"text/plain\",\r\n \"alg\":\"HS256\"}`,\n\t\t`e`, `{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}`,\n\t\tx,\n\t)\n}\n" + data: {} + want_result: + - x: eyJ0eXAiOiJ0ZXh0L3BsYWluIiwNCiAiYWxnIjoiSFMyNTYifQ.ZQ.oO8Vnc4Jv7-J231a1bEcQrgXfKbNW-kEvVY7BP1v5rM diff --git a/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0387.yaml b/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0387.yaml new file mode 100644 index 0000000000..d2382fe542 --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0387.yaml @@ -0,0 +1,9 @@ +--- +cases: + - note: jwtencodesignraw/Empty JSON payload + query: data.generated.p = x + modules: + - "package generated\n\np := x if {\n\tio.jwt.encode_sign_raw(\n\t\t`{\"typ\":\"JWT\",\r\n \"alg\":\"HS256\"}`,\n\t\t`{}`, `{\n\"kty\":\"oct\",\n\"k\":\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\"\n}`,\n\t\tx,\n\t)\n}\n" + data: {} + want_result: + - x: eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.e30.KAml6HRetE0sq22SYNh_CQExhf-X31ChYTfGwUBIWu8 diff --git a/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0388.yaml b/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0388.yaml new file mode 100644 index 0000000000..53e4a902be --- /dev/null +++ b/test/cases/testdata/v1/jwtencodesignraw/test-jwtencodesignraw-0388.yaml @@ -0,0 +1,9 @@ +--- +cases: + - note: jwtencodesignraw/https://tools.ietf.org/html/rfc7515#appendix-A.2 + query: data.generated.p = x + modules: + - "package generated\n\np := x if {\n\tio.jwt.encode_sign_raw(\n\t\t`{\"alg\":\"RS256\"}`, `{\"iss\":\"joe\",\r\n \"exp\":1300819380,\r\n \"http://example.com/is_root\":true}`,\n\t\t`{\n \"kty\":\"RSA\",\n \"n\":\"ofgWCuLjybRlzo0tZWJjNiuSfb4p4fAkd_wWJcyQoTbji9k0l8W26mPddxHmfHQp-Vaw-4qPCJrcS2mJPMEzP1Pt0Bm4d4QlL-yRT-SFd2lZS-pCgNMsD1W_YpRPEwOWvG6b32690r2jZ47soMZo9wGzjb_7OMg0LOL-bSf63kpaSHSXndS5z5rexMdbBYUsLA9e-KXBdQOS-UTo7WTBEMa2R2CapHg665xsmtdVMTBQY4uDZlxvb3qCo5ZwKh9kG4LT6_I5IhlJH7aGhyxXFvUK-DWNmoudF8NAco9_h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXpoQ\",\n \"e\":\"AQAB\",\n \"d\":\"Eq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88vLNO97IjlA7_GQ5sLKMgvfTeXZx9SE-7YwVol2NXOoAJe46sui395IW_GO-pWJ1O0BkTGoVEn2bKVRUCgu-GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn439X0M_V51gfpRLI9JYanrC4D4qAdGcopV_0ZHHzQlBjudU2QvXt4ehNYTCBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl_x_jTj3ccPDVZFD9pIuhLhBOneufuBiB4cS98l2SR_RQyGWSeWjnczT0QU91p1DhOVRuOopznQ\",\n \"p\":\"4BzEEOtIpmVdVEZNCqS7baC4crd0pqnRH_5IB3jw3bcxGn6QLvnEtfdUdiYrqBdss1l58BQ3KhooKeQTa9AB0Hw_Py5PJdTJNPY8cQn7ouZ2KKDcmnPGBY5t7yLc1QlQ5xHdwW1VhvKn-nXqhJTBgIPgtldC-KDV5z-y2XDwGUc\",\n \"q\":\"uQPEfgmVtjL0Uyyx88GZFF1fOunH3-7cepKmtH4pxhtCoHqpWmT8YAmZxaewHgHAjLYsp1ZSe7zFYHj7C6ul7TjeLQeZD_YwD66t62wDmpe_HlB-TnBA-njbglfIsRLtXlnDzQkv5dTltRJ11BKBBypeeF6689rjcJIDEz9RWdc\",\n \"dp\":\"BwKfV3Akq5_MFZDFZCnW-wzl-CCo83WoZvnLQwCTeDv8uzluRSnm71I3QCLdhrqE2e9YkxvuxdBfpT_PI7Yz-FOKnu1R6HsJeDCjn12Sk3vmAktV2zb34MCdy7cpdTh_YVr7tss2u6vneTwrA86rZtu5Mbr1C1XsmvkxHQAdYo0\",\n \"dq\":\"h_96-mK1R_7glhsum81dZxjTnYynPbZpHziZjeeHcXYsXaaMwkOlODsWa7I9xXDoRwbKgB719rrmI2oKr6N3Do9U0ajaHF-NKJnwgjMd2w9cjz3_-kyNlxAr2v4IKhGNpmM5iIgOS1VZnOZ68m6_pbLBSp3nssTdlqvd0tIiTHU\",\n \"qi\":\"IYd7DHOhrWvxkwPQsRM2tOgrjbcrfvtQJipd-DlcxyVuuM9sQLdgjVk2oy26F0EmpScGLq2MowX7fhd_QJQ3ydy5cY7YIBi87w93IKLEdfnbJtoOPLUW0ITrJReOgo1cq9SbsxYawBgfp_gh6A5603k2-ZQwVK0JKSHuLFkuQ3U\"\n }`,\n\t\tx,\n\t)\n}\n" + data: {} + want_result: + - x: eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77Rw diff --git a/test/cases/testdata/v1/jwtverifyhs256/test-jwtverifyhs256-0440.yaml b/test/cases/testdata/v1/jwtverifyhs256/test-jwtverifyhs256-0440.yaml new file mode 100644 index 0000000000..fec96f2afd --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyhs256/test-jwtverifyhs256-0440.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyhs256/success + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_hs256("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiYWxpY2UiLCJhenAiOiJhbGljZSIsInN1Ym9yZGluYXRlcyI6W10sImhyIjpmYWxzZX0.rz3jTY033z-NrKfwrK89_dcLF7TN4gwCMj-fVBDyLoM", "secret", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyhs256/test-jwtverifyhs256-0441.yaml b/test/cases/testdata/v1/jwtverifyhs256/test-jwtverifyhs256-0441.yaml new file mode 100644 index 0000000000..44bce3ad90 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyhs256/test-jwtverifyhs256-0441.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyhs256/failure-bad token + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_hs256("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiYWxpY2UiLCJhenAiOiJhbGljZSIsInN1Ym9yZGluYXRlcyI6W10sImhyIjpmYWxzZX0.R0NDxM1gHTucWQKwayMDre2PbMNR9K9efmOfygDZWcE", "secret", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyhs256/test-jwtverifyhs256-0442.yaml b/test/cases/testdata/v1/jwtverifyhs256/test-jwtverifyhs256-0442.yaml new file mode 100644 index 0000000000..2964ea3ec6 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyhs256/test-jwtverifyhs256-0442.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtverifyhs256/failure-invalid token + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_hs256("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoiYWxpY2UiLCJhenAiOiJhbGljZSIsInN1Ym9yZGluYXRlcyI6W10sImhyIjpmYWxzZX0", "secret", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: encoded JWT must have 3 sections, found 2 + strict_error: true diff --git a/test/cases/testdata/v1/jwtverifyhs384/test-jwtverifyhs384-0443.yaml b/test/cases/testdata/v1/jwtverifyhs384/test-jwtverifyhs384-0443.yaml new file mode 100644 index 0000000000..99adbbf53d --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyhs384/test-jwtverifyhs384-0443.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyhs384/success + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_hs384("eyJhbGciOiJIUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.g98lHYzuqINVppLMoEZT7jlpX0IBSo9zKGoN9DhQg7Ua3YjLXbJMjzESjIHXOGLB", "secret", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyhs384/test-jwtverifyhs384-0444.yaml b/test/cases/testdata/v1/jwtverifyhs384/test-jwtverifyhs384-0444.yaml new file mode 100644 index 0000000000..e81c933101 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyhs384/test-jwtverifyhs384-0444.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyhs384/failure-bad token + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_hs384("eyJhbGciOiJIUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.g98lHYzuqINVppLMoEZT7jlpX0IBSo9zKGoN9DhQg7Ua3YjLXbJMjzESjIHXOBAD", "secret", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyhs384/test-jwtverifyhs384-0445.yaml b/test/cases/testdata/v1/jwtverifyhs384/test-jwtverifyhs384-0445.yaml new file mode 100644 index 0000000000..f4e65dd5ce --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyhs384/test-jwtverifyhs384-0445.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtverifyhs384/failure-invalid token + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_hs384("eyJhbGciOiJIUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0", "secret", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: encoded JWT must have 3 sections, found 2 + strict_error: true diff --git a/test/cases/testdata/v1/jwtverifyhs512/test-jwtverifyhs512-0446.yaml b/test/cases/testdata/v1/jwtverifyhs512/test-jwtverifyhs512-0446.yaml new file mode 100644 index 0000000000..2cc7d069ea --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyhs512/test-jwtverifyhs512-0446.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyhs512/success + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_hs512("eyJhbGciOiJIUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.F6-xviRhK2OLcJJHFivhQqMN_dgX5boDrwbVKkdo9flQQNk-AaKpH3uYycFvBEd_erVefcsri_PkL4fjLSZ7ZA", "secret", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyhs512/test-jwtverifyhs512-0447.yaml b/test/cases/testdata/v1/jwtverifyhs512/test-jwtverifyhs512-0447.yaml new file mode 100644 index 0000000000..5cd7528db1 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyhs512/test-jwtverifyhs512-0447.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyhs512/failure-bad token + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_hs512("eyJhbGciOiJIUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.F6-xviRhK2OLcJJHFivhQqMN_dgX5boDrwbVKkdo9flQQNk-AaKpH3uYycFvBEd_erVefcsri_PkL4fjLSZBAD", "secret", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyhs512/test-jwtverifyhs512-0448.yaml b/test/cases/testdata/v1/jwtverifyhs512/test-jwtverifyhs512-0448.yaml new file mode 100644 index 0000000000..f401a49d10 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyhs512/test-jwtverifyhs512-0448.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtverifyhs512/failure-invalid token + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_hs512("eyJhbGciOiJIUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0", "secret", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: encoded JWT must have 3 sections, found 2 + strict_error: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0401.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0401.yaml new file mode 100644 index 0000000000..4e6de79c4f --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0401.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-cert + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs256("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.N0-EVdv5pvUfZYFRzMGnsWpNLHgwMEgViPwpuLBEtt32682OgnOK-N4X-2gpQEjQIbUr0IFym8YsRQU9GZvqQP72Sd6yOQNGSNeE74DpUZCAjBa9SBIb1UlD2MxZB-e7YJiEyo7pZhimaqorXrgorlaXYGMvsCFWDYmBLzGaGYaGJyEpkZHzHb7ujsDrJJjdEtDV3kh13gTHzLPvqnoXuuxelXye_8LPIhvgDy52gT4shUEso71pJCMv_IqAR19ljVE17lJzoi6VhRn6ReNUE-yg4KfCO4Ypnuu-mcQr7XtmSYoWkX72L5UQ-EyWkoz-w0SYKoJTPzHkTL2thYStksVpeNkGuck25aUdtrQgmPbao0QOWBFlkg03e6mPCD2-aXOt1ofth9mZGjxWMHX-mUqHaNmaWM3WhRztJ73hWrmB1YOdYQtOEHejfvR_td5tqIw4W6ufRy2ScOypGQe7kNaUZxpgxZ1927ZGNiQgawIOAQwXOcFx1JNSEIeg55-cYJrHPxsXGOB9ZxW-qnswmFJp474iUVXjzGhLexJDXBwvKGs_O3JFjMsvyV9_hm7bnQU0vG_HgPYs5i9VOHRMujq1vFBcm52TFVOBGdWaGfb9RRdLLYvVkJLk0Poh19rsCWb7-Vc3mAaGGpvuk4Wv-PnGGNC-V-FQqIbijHDrn_g", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0402.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0402.yaml new file mode 100644 index 0000000000..467626dbac --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0402.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-cert + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs256("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.N0-EVdv5pvUfZYFRzMGnsWpNLHgwMEgViPwpuLBEtt32682OgnOK-N4X-2gpQEjQIbUr0IFym8YsRQU9GZvqQP72Sd6yOQNGSNeE74DpUZCAjBa9SBIb1UlD2MxZB-e7YJiEyo7pZhimaqorXrgorlaXYGMvsCFWDYmBLzGaGYaGJyEpkZHzHb7ujsDrJJjdEtDV3kh13gTHzLPvqnoXuuxelXye_8LPIhvgDy52gT4shUEso71pJCMv_IqAR19ljVE17lJzoi6VhRn6ReNUE-yg4KfCO4Ypnuu-mcQr7XtmSYoWkX72L5UQ-EyWkoz-w0SYKoJTPzHkTL2thYStksVpeNkGuck25aUdtrQgmPbao0QOWBFlkg03e6mPCD2-aXOt1ofth9mZGjxWMHX-mUqHaNmaWM3WhRztJ73hWrmB1YOdYQtOEHejfvR_td5tqIw4W6ufRy2ScOypGQe7kNaUZxpgxZ1927ZGNiQgawIOAQwXOcFx1JNSEIeg55-cYJrHPxsXGOB9ZxW-qnswmFJp474iUVXjzGhLexJDXBwvKGs_O3JFjMsvyV9_hm7bnQU0vG_HgPYs5i9VOHRMujq1vFBcm52TFVOBGdWaGfb9RRdLLYvVkJLk0Poh19rsCWb7-Vc3mAaGGpvuk4Wv-PnGGNC-V-FQqIbijHDrn_g", "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA7nJwME0QNM6g0Ou9SyljlcIY4cnBcs8oWVHe74bJ7JTgYmDOk2CA14RE3wJNkUKERP/cRdesKDA/BToJXJUroYvhjXxUYn+i3wK5vOGRY9WUtTF9paIIpIV4USUOwDh3ufhA9K3tyh+ZVsqn80em0Lj2ME0EgScuk6u0/UYjjNvcmnQl+uDmghG8xBZh7TZW2+aceMwlb4LJIP36VRhgjKQGIxg2rW8ROXgJaFbNRCbiOUUqlq9SUZuhHo8TNOARXXxp9R4Fq7Cl7ZbwWtNPwAtM1y+Z+iyu/i91m0YLlU2XBOGLu9IA8IZjPlbCnk/SygpV9NNwTY9DSQ0QfXcPTGlsbFwzRzTlhH25wEl3j+2Ub9w/NX7Yo+j/Ei9eGZ8cq0bcvEwDeIo98HeNZWrLUUArayRYvh8zutOlzqehw8waFk9AxpfEp9oWekSz8gZw9OL773EhnglYxxjkPHNzk66CufLuTEf6uE9NLE5HnlQMbiqBFirIyAWGKyU3v2tphKvcogxmzzWA51p0GY0lGZvlLNt2NrJv2oGecyl3BLqHnBi+rGAosa/8XgfQT8RIk7YR/tDPDmPfaqSIc0po+NcHYEH82Yv+gfKSK++1fyssGCsSRJs8PFMuPGgv62fFrE/EHSsHJaNWojSYce/Trxm2RaHhw/8O4oKcfrbaRf8CAwEAAQ==\n-----END PUBLIC KEY-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0403.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0403.yaml new file mode 100644 index 0000000000..69b837fb6c --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0403.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-jwk + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs256("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.N0-EVdv5pvUfZYFRzMGnsWpNLHgwMEgViPwpuLBEtt32682OgnOK-N4X-2gpQEjQIbUr0IFym8YsRQU9GZvqQP72Sd6yOQNGSNeE74DpUZCAjBa9SBIb1UlD2MxZB-e7YJiEyo7pZhimaqorXrgorlaXYGMvsCFWDYmBLzGaGYaGJyEpkZHzHb7ujsDrJJjdEtDV3kh13gTHzLPvqnoXuuxelXye_8LPIhvgDy52gT4shUEso71pJCMv_IqAR19ljVE17lJzoi6VhRn6ReNUE-yg4KfCO4Ypnuu-mcQr7XtmSYoWkX72L5UQ-EyWkoz-w0SYKoJTPzHkTL2thYStksVpeNkGuck25aUdtrQgmPbao0QOWBFlkg03e6mPCD2-aXOt1ofth9mZGjxWMHX-mUqHaNmaWM3WhRztJ73hWrmB1YOdYQtOEHejfvR_td5tqIw4W6ufRy2ScOypGQe7kNaUZxpgxZ1927ZGNiQgawIOAQwXOcFx1JNSEIeg55-cYJrHPxsXGOB9ZxW-qnswmFJp474iUVXjzGhLexJDXBwvKGs_O3JFjMsvyV9_hm7bnQU0vG_HgPYs5i9VOHRMujq1vFBcm52TFVOBGdWaGfb9RRdLLYvVkJLk0Poh19rsCWb7-Vc3mAaGGpvuk4Wv-PnGGNC-V-FQqIbijHDrn_g", `{"kty":"RSA","e":"AQAB","kid":"4db88b6b-cda9-4242-b79e-51346edc313c","n":"7nJwME0QNM6g0Ou9SyljlcIY4cnBcs8oWVHe74bJ7JTgYmDOk2CA14RE3wJNkUKERP_cRdesKDA_BToJXJUroYvhjXxUYn-i3wK5vOGRY9WUtTF9paIIpIV4USUOwDh3ufhA9K3tyh-ZVsqn80em0Lj2ME0EgScuk6u0_UYjjNvcmnQl-uDmghG8xBZh7TZW2-aceMwlb4LJIP36VRhgjKQGIxg2rW8ROXgJaFbNRCbiOUUqlq9SUZuhHo8TNOARXXxp9R4Fq7Cl7ZbwWtNPwAtM1y-Z-iyu_i91m0YLlU2XBOGLu9IA8IZjPlbCnk_SygpV9NNwTY9DSQ0QfXcPTGlsbFwzRzTlhH25wEl3j-2Ub9w_NX7Yo-j_Ei9eGZ8cq0bcvEwDeIo98HeNZWrLUUArayRYvh8zutOlzqehw8waFk9AxpfEp9oWekSz8gZw9OL773EhnglYxxjkPHNzk66CufLuTEf6uE9NLE5HnlQMbiqBFirIyAWGKyU3v2tphKvcogxmzzWA51p0GY0lGZvlLNt2NrJv2oGecyl3BLqHnBi-rGAosa_8XgfQT8RIk7YR_tDPDmPfaqSIc0po-NcHYEH82Yv-gfKSK--1fyssGCsSRJs8PFMuPGgv62fFrE_EHSsHJaNWojSYce_Trxm2RaHhw_8O4oKcfrbaRf8"}`, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0404.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0404.yaml new file mode 100644 index 0000000000..873d6f1f9e --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0404.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-ps256-cert + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps256("eyJ0eXAiOiAiSldUIiwgImFsZyI6ICJQUzI1NiJ9.eyJuYmYiOiAxNDQ0NDc4NDAwLCAiZm9vIjogImJhciJ9.i0F3MHWzOsBNLqjQzK1UVeQid9xPMowCoUsoM-C2BDxUY-FMKmCeJ1NJ4TGnS9HzFK1ftEvRnPT7EOxOkHPoCk1rz3feTFgtHtNzQqLM1IBTnz6aHHOrda_bKPHH9ZIYCRQUPXhpC90ivW_IJR-f7Z1WLrMXaJ71i1XteruENHrJJJDn0HedHG6N0VHugBHrak5k57cbE31utAdx83TEd8v2Y8wAkCJXKrdmTa-8419LNxW_yjkvoDD53n3X5CHhYkSymU77p0v6yWO38qDWeKJ-Fm_PrMAo72_rizDBj_yPa5LA3bT_EnsgZtC-sp8_SCDIH41bjiCGpRHhqgZmyw", "-----BEGIN CERTIFICATE-----\nMIIC/DCCAeSgAwIBAgIJAJRvYDU3ei3EMA0GCSqGSIb3DQEBCwUAMBMxETAPBgNV\nBAMMCHdoYXRldmVyMB4XDTE4MDgxMDEwMzgxNloXDTE4MDkwOTEwMzgxNlowEzER\nMA8GA1UEAwwId2hhdGV2ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC4kCmzLMW/5jzkzkmN7Me8wPD+ymBUIjsGqliGfMrfFfDV2eTPVtZcYD3IXoB4\nAOUT7XJzWjOsBRFOcVKKEiCPjXiLcwLb/QWQ1x0Budft32r3+N0KQd1rgcRHTPNc\nJoeWCfOgDPp51RTzTT6HQuV4ud+CDhRJP7QMVMIgal9Nuzs49LLZaBPW8/rFsHjk\nJQ4kDujSrpcT6F2FZY3SmWsOJgP7RjVKk5BheYeFKav5ZV4p6iHn/TN4RVpvpNBh\n5z/XoHITJ6lpkHSDpbIaQUTpobU2um8N3biz+HsEAmD9Laa27WUpYSpiM6DDMSXl\ndBDJdumerVRJvXYCtfXqtl17AgMBAAGjUzBRMB0GA1UdDgQWBBRz74MkVzT2K52/\nFJC4mTa9coM/DTAfBgNVHSMEGDAWgBRz74MkVzT2K52/FJC4mTa9coM/DTAPBgNV\nHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAD1ZE4IaIAetqGG+vt9oz1\nIx0j4EPok0ONyhhmiSsF6rSv8zlNWweVf5y6Z+AoTNY1Fym0T7dbpbqIox0EdKV3\nFLzniWOjznupbnqfXwHX/g1UAZSyt3akSatVhvNpGlnd7efTIAiNinX/TkzIjhZ7\nihMIZCGykT1P0ys1OaeEf57wAzviatD4pEMTIW0OOqY8bdRGhuJR1kKUZ/2Nm8Ln\ny7E0y8uODVbH9cAwGyzWB/QFc+bffNgi9uJaPQQc5Zxwpu9utlqyzFvXgV7MBYUK\nEYSLyxp4g4e5aujtLugaC8H6n9vP1mEBr/+T8HGynBZHNTKlDhhL9qDbpkkNB6/w\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0405.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0405.yaml new file mode 100644 index 0000000000..9b3f841322 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0405.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-ps256-jwk + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps256("eyJ0eXAiOiAiSldUIiwgImFsZyI6ICJQUzI1NiJ9.eyJuYmYiOiAxNDQ0NDc4NDAwLCAiZm9vIjogImJhciJ9.i0F3MHWzOsBNLqjQzK1UVeQid9xPMowCoUsoM-C2BDxUY-FMKmCeJ1NJ4TGnS9HzFK1ftEvRnPT7EOxOkHPoCk1rz3feTFgtHtNzQqLM1IBTnz6aHHOrda_bKPHH9ZIYCRQUPXhpC90ivW_IJR-f7Z1WLrMXaJ71i1XteruENHrJJJDn0HedHG6N0VHugBHrak5k57cbE31utAdx83TEd8v2Y8wAkCJXKrdmTa-8419LNxW_yjkvoDD53n3X5CHhYkSymU77p0v6yWO38qDWeKJ-Fm_PrMAo72_rizDBj_yPa5LA3bT_EnsgZtC-sp8_SCDIH41bjiCGpRHhqgZmyw", `{"kty":"RSA","e":"AQAB","kid":"bf688c97-bf51-49ba-b9d3-115195bb0eb8","n":"uJApsyzFv-Y85M5JjezHvMDw_spgVCI7BqpYhnzK3xXw1dnkz1bWXGA9yF6AeADlE-1yc1ozrAURTnFSihIgj414i3MC2_0FkNcdAbnX7d9q9_jdCkHda4HER0zzXCaHlgnzoAz6edUU800-h0LleLnfgg4UST-0DFTCIGpfTbs7OPSy2WgT1vP6xbB45CUOJA7o0q6XE-hdhWWN0plrDiYD-0Y1SpOQYXmHhSmr-WVeKeoh5_0zeEVab6TQYec_16ByEyepaZB0g6WyGkFE6aG1NrpvDd24s_h7BAJg_S2mtu1lKWEqYjOgwzEl5XQQyXbpnq1USb12ArX16rZdew"}`, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0406.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0406.yaml new file mode 100644 index 0000000000..192feb2698 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0406.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-es256-cert + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_es256("eyJ0eXAiOiAiSldUIiwgImFsZyI6ICJFUzI1NiJ9.eyJuYmYiOiAxNDQ0NDc4NDAwLCAiaXNzIjogInh4eCJ9.lArczfN-pIL8oUU-7PU83u-zfXougXBZj6drFeKFsPEoVhy9WAyiZlRshYqjTSXdaw8yw2L-ovt4zTUZb2PWMg", "-----BEGIN CERTIFICATE-----\nMIIBcDCCARagAwIBAgIJAMZmuGSIfvgzMAoGCCqGSM49BAMCMBMxETAPBgNVBAMM\nCHdoYXRldmVyMB4XDTE4MDgxMDE0Mjg1NFoXDTE4MDkwOTE0Mjg1NFowEzERMA8G\nA1UEAwwId2hhdGV2ZXIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATPwn3WCEXL\nmjp/bFniDwuwsfu7bASlPae2PyWhqGeWwe23Xlyx+tSqxlkXYe4pZ23BkAAscpGj\nyn5gXHExyDlKo1MwUTAdBgNVHQ4EFgQUElRjSoVgKjUqY5AXz2o74cLzzS8wHwYD\nVR0jBBgwFoAUElRjSoVgKjUqY5AXz2o74cLzzS8wDwYDVR0TAQH/BAUwAwEB/zAK\nBggqhkjOPQQDAgNIADBFAiEA4yQ/88ZrUX68c6kOe9G11u8NUaUzd8pLOtkKhniN\nOHoCIHmNX37JOqTcTzGn2u9+c8NlnvZ0uDvsd1BmKPaUmjmm\n-----END CERTIFICATE-----\n", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0407.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0407.yaml new file mode 100644 index 0000000000..62c6a129c8 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0407.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-es256-jwk + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_es256("eyJ0eXAiOiAiSldUIiwgImFsZyI6ICJFUzI1NiJ9.eyJuYmYiOiAxNDQ0NDc4NDAwLCAiaXNzIjogInh4eCJ9.lArczfN-pIL8oUU-7PU83u-zfXougXBZj6drFeKFsPEoVhy9WAyiZlRshYqjTSXdaw8yw2L-ovt4zTUZb2PWMg", `{"kty":"EC","crv":"P-256","x":"z8J91ghFy5o6f2xZ4g8LsLH7u2wEpT2ntj8loahnlsE","y":"7bdeXLH61KrGWRdh7ilnbcGQACxykaPKfmBccTHIOUo"}`, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0408.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0408.yaml new file mode 100644 index 0000000000..abc2c411e4 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0408.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/failure-bad token + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs256("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.Yt89BjaPCNgol478rYyH66-XgkHos02TsVwxLH3ZlvOoIVjbhYW8q1_MHehct1-yBf1UOX3g-lUrIjpoDtX1TfAESuaWTjYPixRvjfJ-Nn75JF8QuAl5PD27C6aJ4PjUPNfj0kwYBnNQ_oX-ZFb781xRi7qRDB6swE4eBUxzHqKUJBLaMM2r8k1-9iE3ERNeqTJUhV__p0aSyRj-i62rdZ4TC5nhxtWodiGP4e4GrYlXkdaKduK63cfdJF-kfZfTsoDs_xy84pZOkzlflxuNv9bNqd-3ISAdWe4gsEvWWJ8v70-QWkydnH8rhj95DaqoXrjfzbOgDpKtdxJC4daVPKvntykzrxKhZ9UtWzm3OvJSKeyWujFZlldiTfBLqNDgdi-Boj_VxO5Pdh-67lC3L-pBMm4BgUqf6rakBQvoH7AV6zD5CbFixh7DuqJ4eJHHItWzJwDctMrV3asm-uOE1E2B7GErGo3iX6S9Iun_kvRUp6kyvOaDq5VvXzQOKyLQIQyHGGs0aIV5cFI2IuO5Rt0uUj5mzPQrQWHgI4r6Mc5bzmq2QLxBQE8OJ1RFhRpsuoWQyDM8aRiMQIJe1g3x4dnxbJK4dYheYblKHFepScYqT1hllDp3oUNn89sIjQIhJTe8KFATu4K8ppluys7vhpE2a_tq8i5O0MFxWmsxN4Q", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0409.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0409.yaml new file mode 100644 index 0000000000..1d39eb187d --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0409.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/failure-wrong key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps256("eyJ0eXAiOiAiSldUIiwgImFsZyI6ICJQUzI1NiJ9.eyJuYmYiOiAxNDQ0NDc4NDAwLCAiZm9vIjogImJhciJ9.i0F3MHWzOsBNLqjQzK1UVeQid9xPMowCoUsoM-C2BDxUY-FMKmCeJ1NJ4TGnS9HzFK1ftEvRnPT7EOxOkHPoCk1rz3feTFgtHtNzQqLM1IBTnz6aHHOrda_bKPHH9ZIYCRQUPXhpC90ivW_IJR-f7Z1WLrMXaJ71i1XteruENHrJJJDn0HedHG6N0VHugBHrak5k57cbE31utAdx83TEd8v2Y8wAkCJXKrdmTa-8419LNxW_yjkvoDD53n3X5CHhYkSymU77p0v6yWO38qDWeKJ-Fm_PrMAo72_rizDBj_yPa5LA3bT_EnsgZtC-sp8_SCDIH41bjiCGpRHhqgZmyw", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0410.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0410.yaml new file mode 100644 index 0000000000..8f4a047c00 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0410.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/failure-wrong alg + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps256("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.N0-EVdv5pvUfZYFRzMGnsWpNLHgwMEgViPwpuLBEtt32682OgnOK-N4X-2gpQEjQIbUr0IFym8YsRQU9GZvqQP72Sd6yOQNGSNeE74DpUZCAjBa9SBIb1UlD2MxZB-e7YJiEyo7pZhimaqorXrgorlaXYGMvsCFWDYmBLzGaGYaGJyEpkZHzHb7ujsDrJJjdEtDV3kh13gTHzLPvqnoXuuxelXye_8LPIhvgDy52gT4shUEso71pJCMv_IqAR19ljVE17lJzoi6VhRn6ReNUE-yg4KfCO4Ypnuu-mcQr7XtmSYoWkX72L5UQ-EyWkoz-w0SYKoJTPzHkTL2thYStksVpeNkGuck25aUdtrQgmPbao0QOWBFlkg03e6mPCD2-aXOt1ofth9mZGjxWMHX-mUqHaNmaWM3WhRztJ73hWrmB1YOdYQtOEHejfvR_td5tqIw4W6ufRy2ScOypGQe7kNaUZxpgxZ1927ZGNiQgawIOAQwXOcFx1JNSEIeg55-cYJrHPxsXGOB9ZxW-qnswmFJp474iUVXjzGhLexJDXBwvKGs_O3JFjMsvyV9_hm7bnQU0vG_HgPYs5i9VOHRMujq1vFBcm52TFVOBGdWaGfb9RRdLLYvVkJLk0Poh19rsCWb7-Vc3mAaGGpvuk4Wv-PnGGNC-V-FQqIbijHDrn_g", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0411.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0411.yaml new file mode 100644 index 0000000000..db0c1e6f1b --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0411.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtverifyrsa/failure-invalid token + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs256("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: encoded JWT must have 3 sections, found 2 + strict_error: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0412.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0412.yaml new file mode 100644 index 0000000000..bedd20f0e8 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0412.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtverifyrsa/failure-bad pem certificate block + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs256("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.N0-EVdv5pvUfZYFRzMGnsWpNLHgwMEgViPwpuLBEtt32682OgnOK-N4X-2gpQEjQIbUr0IFym8YsRQU9GZvqQP72Sd6yOQNGSNeE74DpUZCAjBa9SBIb1UlD2MxZB-e7YJiEyo7pZhimaqorXrgorlaXYGMvsCFWDYmBLzGaGYaGJyEpkZHzHb7ujsDrJJjdEtDV3kh13gTHzLPvqnoXuuxelXye_8LPIhvgDy52gT4shUEso71pJCMv_IqAR19ljVE17lJzoi6VhRn6ReNUE-yg4KfCO4Ypnuu-mcQr7XtmSYoWkX72L5UQ-EyWkoz-w0SYKoJTPzHkTL2thYStksVpeNkGuck25aUdtrQgmPbao0QOWBFlkg03e6mPCD2-aXOt1ofth9mZGjxWMHX-mUqHaNmaWM3WhRztJ73hWrmB1YOdYQtOEHejfvR_td5tqIw4W6ufRy2ScOypGQe7kNaUZxpgxZ1927ZGNiQgawIOAQwXOcFx1JNSEIeg55-cYJrHPxsXGOB9ZxW-qnswmFJp474iUVXjzGhLexJDXBwvKGs_O3JFjMsvyV9_hm7bnQU0vG_HgPYs5i9VOHRMujq1vFBcm52TFVOBGdWaGfb9RRdLLYvVkJLk0Poh19rsCWb7-Vc3mAaGGpvuk4Wv-PnGGNC-V-FQqIbijHDrn_g", "-----BEGIN CERT-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERT-----", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: failed to extract a Key from the PEM certificate + strict_error: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0413.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0413.yaml new file mode 100644 index 0000000000..c26543d77a --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0413.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtverifyrsa/failure-extra data after pem certificate block + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs256("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.N0-EVdv5pvUfZYFRzMGnsWpNLHgwMEgViPwpuLBEtt32682OgnOK-N4X-2gpQEjQIbUr0IFym8YsRQU9GZvqQP72Sd6yOQNGSNeE74DpUZCAjBa9SBIb1UlD2MxZB-e7YJiEyo7pZhimaqorXrgorlaXYGMvsCFWDYmBLzGaGYaGJyEpkZHzHb7ujsDrJJjdEtDV3kh13gTHzLPvqnoXuuxelXye_8LPIhvgDy52gT4shUEso71pJCMv_IqAR19ljVE17lJzoi6VhRn6ReNUE-yg4KfCO4Ypnuu-mcQr7XtmSYoWkX72L5UQ-EyWkoz-w0SYKoJTPzHkTL2thYStksVpeNkGuck25aUdtrQgmPbao0QOWBFlkg03e6mPCD2-aXOt1ofth9mZGjxWMHX-mUqHaNmaWM3WhRztJ73hWrmB1YOdYQtOEHejfvR_td5tqIw4W6ufRy2ScOypGQe7kNaUZxpgxZ1927ZGNiQgawIOAQwXOcFx1JNSEIeg55-cYJrHPxsXGOB9ZxW-qnswmFJp474iUVXjzGhLexJDXBwvKGs_O3JFjMsvyV9_hm7bnQU0vG_HgPYs5i9VOHRMujq1vFBcm52TFVOBGdWaGfb9RRdLLYvVkJLk0Poh19rsCWb7-Vc3mAaGGpvuk4Wv-PnGGNC-V-FQqIbijHDrn_g", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----\nEXTRA", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: extra data after a PEM certificate block + strict_error: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0414.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0414.yaml new file mode 100644 index 0000000000..e04f9f94c4 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0414.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtverifyrsa/failure-bad pem certificate + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs256("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.N0-EVdv5pvUfZYFRzMGnsWpNLHgwMEgViPwpuLBEtt32682OgnOK-N4X-2gpQEjQIbUr0IFym8YsRQU9GZvqQP72Sd6yOQNGSNeE74DpUZCAjBa9SBIb1UlD2MxZB-e7YJiEyo7pZhimaqorXrgorlaXYGMvsCFWDYmBLzGaGYaGJyEpkZHzHb7ujsDrJJjdEtDV3kh13gTHzLPvqnoXuuxelXye_8LPIhvgDy52gT4shUEso71pJCMv_IqAR19ljVE17lJzoi6VhRn6ReNUE-yg4KfCO4Ypnuu-mcQr7XtmSYoWkX72L5UQ-EyWkoz-w0SYKoJTPzHkTL2thYStksVpeNkGuck25aUdtrQgmPbao0QOWBFlkg03e6mPCD2-aXOt1ofth9mZGjxWMHX-mUqHaNmaWM3WhRztJ73hWrmB1YOdYQtOEHejfvR_td5tqIw4W6ufRy2ScOypGQe7kNaUZxpgxZ1927ZGNiQgawIOAQwXOcFx1JNSEIeg55-cYJrHPxsXGOB9ZxW-qnswmFJp474iUVXjzGhLexJDXBwvKGs_O3JFjMsvyV9_hm7bnQU0vG_HgPYs5i9VOHRMujq1vFBcm52TFVOBGdWaGfb9RRdLLYvVkJLk0Poh19rsCWb7-Vc3mAaGGpvuk4Wv-PnGGNC-V-FQqIbijHDrn_g", "-----BEGIN CERTIFICATE-----\ndeadiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_error_code: eval_builtin_error + want_error: failed to parse a PEM certificate + strict_error: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0415.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0415.yaml new file mode 100644 index 0000000000..198ea070de --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0415.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: jwtverifyrsa/failure-bad jwk key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs256("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJmb28iOiJiYXIiLCJuYmYiOjE0NDQ0Nzg0MDB9.N0-EVdv5pvUfZYFRzMGnsWpNLHgwMEgViPwpuLBEtt32682OgnOK-N4X-2gpQEjQIbUr0IFym8YsRQU9GZvqQP72Sd6yOQNGSNeE74DpUZCAjBa9SBIb1UlD2MxZB-e7YJiEyo7pZhimaqorXrgorlaXYGMvsCFWDYmBLzGaGYaGJyEpkZHzHb7ujsDrJJjdEtDV3kh13gTHzLPvqnoXuuxelXye_8LPIhvgDy52gT4shUEso71pJCMv_IqAR19ljVE17lJzoi6VhRn6ReNUE-yg4KfCO4Ypnuu-mcQr7XtmSYoWkX72L5UQ-EyWkoz-w0SYKoJTPzHkTL2thYStksVpeNkGuck25aUdtrQgmPbao0QOWBFlkg03e6mPCD2-aXOt1ofth9mZGjxWMHX-mUqHaNmaWM3WhRztJ73hWrmB1YOdYQtOEHejfvR_td5tqIw4W6ufRy2ScOypGQe7kNaUZxpgxZ1927ZGNiQgawIOAQwXOcFx1JNSEIeg55-cYJrHPxsXGOB9ZxW-qnswmFJp474iUVXjzGhLexJDXBwvKGs_O3JFjMsvyV9_hm7bnQU0vG_HgPYs5i9VOHRMujq1vFBcm52TFVOBGdWaGfb9RRdLLYvVkJLk0Poh19rsCWb7-Vc3mAaGGpvuk4Wv-PnGGNC-V-FQqIbijHDrn_g", `{"kty":"bogus key type","e":"AQAB","kid":"4db88b6b-cda9-4242-b79e-51346edc313c","n":"7nJwME0QNM6g0Ou9SyljlcIY4cnBcs8oWVHe74bJ7JTgYmDOk2CA14RE3wJNkUKERP_cRdesKDA_BToJXJUroYvhjXxUYn-i3wK5vOGRY9WUtTF9paIIpIV4USUOwDh3ufhA9K3tyh-ZVsqn80em0Lj2ME0EgScuk6u0_UYjjNvcmnQl-uDmghG8xBZh7TZW2-aceMwlb4LJIP36VRhgjKQGIxg2rW8ROXgJaFbNRCbiOUUqlq9SUZuhHo8TNOARXXxp9R4Fq7Cl7ZbwWtNPwAtM1y-Z-iyu_i91m0YLlU2XBOGLu9IA8IZjPlbCnk_SygpV9NNwTY9DSQ0QfXcPTGlsbFwzRzTlhH25wEl3j-2Ub9w_NX7Yo-j_Ei9eGZ8cq0bcvEwDeIo98HeNZWrLUUArayRYvh8zutOlzqehw8waFk9AxpfEp9oWekSz8gZw9OL773EhnglYxxjkPHNzk66CufLuTEf6uE9NLE5HnlQMbiqBFirIyAWGKyU3v2tphKvcogxmzzWA51p0GY0lGZvlLNt2NrJv2oGecyl3BLqHnBi-rGAosa_8XgfQT8RIk7YR_tDPDmPfaqSIc0po-NcHYEH82Yv-gfKSK--1fyssGCsSRJs8PFMuPGgv62fFrE_EHSsHJaNWojSYce_Trxm2RaHhw_8O4oKcfrbaRf8"}`, x) + } + data: {} + want_error_code: eval_builtin_error + want_error: failed to parse a JWK key (set) + strict_error: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0416.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0416.yaml new file mode 100644 index 0000000000..e5cce64393 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0416.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-cert + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs384("eyJhbGciOiJSUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.b__y2zjqMoD7iWbHeQ0lNpnche3ph5-AwrIQICLMQQGtEz9WMBteHydkC5g01bm3TBX1d04Z5IEOsuK6btAtWma04c5NYqaUyNEUJKYCFoY02uH0jGdGfL6R5Kkv0lkNvN0s3Nex9jMaVVgqx8bcrOU0uRBFT67sXcm11LHaB9BwKFslolzHClxgXy5RIZb4OFk_7Yk7xTC6PcvEWkkGR9uXBhfDEig5WqdwOWPeulimvARDw14U35rzeh9xpGAPjBKeE-y20fXAk0cSF1H69C-Qa1jDQheYIrAJ6XMYGNZWuay5-smmeefe67eweEt1q-AD1NFepqkmZX382DGuYQ", "-----BEGIN CERTIFICATE-----\nMIIDXDCCAkSgAwIBAgIBLjANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJVUzEV\nMBMGA1UEBxMMUmVkd29vZCBDaXR5MQ4wDAYDVQQKEwVTdHlyYTEMMAoGA1UECxMD\nRGV2MRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMjAwNTA3MDg1MTAzWhcNMjAwNTA3\nMTA1MTAzWjBWMQswCQYDVQQGEwJVUzEVMBMGA1UEBxMMUmVkd29vZCBDaXR5MQ4w\nDAYDVQQKEwVTdHlyYTEMMAoGA1UECxMDRGV2MRIwEAYDVQQDEwlsb2NhbGhvc3Qw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDeRmygX/fOOUu5Wm91PFNo\nsHDG1CzG9a1iKBjUeMgi9bXXScUfatPmsNlxb56uSi0RXUsvJmY/yxkIIhRyapxW\n49j2idAM3SGGL1nOZf/XdpDHYsAFFZ237HGb8DOEk/p3xCFv0tH/iQ+kLP36EM1+\ntn6BfUXdJnVyvkSK2iMNeRY7A4DMX7sGX39LXsVJiCokIC8E0QUFrSjvrAm9ejKE\ntPojydo4c3VUxLfmFuyMXoD3bfk1Jv5i2J5RjtomjgK6zNCvgYzpspiodHChkzlU\nX8yk2YqlAHX3XdJA94LaDE2kNXiOQnFkUb8GsP7hmEbwGtMUEQie+jfgKplxJ49B\nAgMBAAGjNTAzMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAM\nBgNVHRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQC9f2/kxT7DnQ94ownhHvd6\nrzk1WirI90rFM2MxhfkaDrOHhSGZL9nDf6TIZ4qeFKZXthpKxpiZm2Oxmn+vUsik\nW6bYjq1nX0GCchQLaaFf9Jh1IOLwkfoBdX55tV8xUGHRWgDlCuGbqiixz+Bm0Kap\nkmbyJynVcoiKhdLyYm/YTn/pC32SJW666reQ+0qCAoxzLQowBetHjwDam9RsDEf4\n+JRDjYPutNXyJ5X8BaBA6PzHanzMG/7RFYcx/2YhXwVxdfPHku4ALJcddIGAGNx2\n5yte+HY0aEu+06J67eD9+4fU7NixRMKigk9KbjqpeWD+0be+VgX8Dot4jaISgI/3\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0417.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0417.yaml new file mode 100644 index 0000000000..778517bdaa --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0417.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs384("eyJhbGciOiJSUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.b__y2zjqMoD7iWbHeQ0lNpnche3ph5-AwrIQICLMQQGtEz9WMBteHydkC5g01bm3TBX1d04Z5IEOsuK6btAtWma04c5NYqaUyNEUJKYCFoY02uH0jGdGfL6R5Kkv0lkNvN0s3Nex9jMaVVgqx8bcrOU0uRBFT67sXcm11LHaB9BwKFslolzHClxgXy5RIZb4OFk_7Yk7xTC6PcvEWkkGR9uXBhfDEig5WqdwOWPeulimvARDw14U35rzeh9xpGAPjBKeE-y20fXAk0cSF1H69C-Qa1jDQheYIrAJ6XMYGNZWuay5-smmeefe67eweEt1q-AD1NFepqkmZX382DGuYQ", "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3kZsoF/3zjlLuVpvdTxT\naLBwxtQsxvWtYigY1HjIIvW110nFH2rT5rDZcW+erkotEV1LLyZmP8sZCCIUcmqc\nVuPY9onQDN0hhi9ZzmX/13aQx2LABRWdt+xxm/AzhJP6d8Qhb9LR/4kPpCz9+hDN\nfrZ+gX1F3SZ1cr5EitojDXkWOwOAzF+7Bl9/S17FSYgqJCAvBNEFBa0o76wJvXoy\nhLT6I8naOHN1VMS35hbsjF6A9235NSb+YtieUY7aJo4CuszQr4GM6bKYqHRwoZM5\nVF/MpNmKpQB1913SQPeC2gxNpDV4jkJxZFG/BrD+4ZhG8BrTFBEInvo34CqZcSeP\nQQIDAQAB\n-----END PUBLIC KEY-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0418.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0418.yaml new file mode 100644 index 0000000000..6107dadda5 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0418.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-jwk + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs384("eyJhbGciOiJSUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.b__y2zjqMoD7iWbHeQ0lNpnche3ph5-AwrIQICLMQQGtEz9WMBteHydkC5g01bm3TBX1d04Z5IEOsuK6btAtWma04c5NYqaUyNEUJKYCFoY02uH0jGdGfL6R5Kkv0lkNvN0s3Nex9jMaVVgqx8bcrOU0uRBFT67sXcm11LHaB9BwKFslolzHClxgXy5RIZb4OFk_7Yk7xTC6PcvEWkkGR9uXBhfDEig5WqdwOWPeulimvARDw14U35rzeh9xpGAPjBKeE-y20fXAk0cSF1H69C-Qa1jDQheYIrAJ6XMYGNZWuay5-smmeefe67eweEt1q-AD1NFepqkmZX382DGuYQ", `{"kty":"RSA","n":"3kZsoF_3zjlLuVpvdTxTaLBwxtQsxvWtYigY1HjIIvW110nFH2rT5rDZcW-erkotEV1LLyZmP8sZCCIUcmqcVuPY9onQDN0hhi9ZzmX_13aQx2LABRWdt-xxm_AzhJP6d8Qhb9LR_4kPpCz9-hDNfrZ-gX1F3SZ1cr5EitojDXkWOwOAzF-7Bl9_S17FSYgqJCAvBNEFBa0o76wJvXoyhLT6I8naOHN1VMS35hbsjF6A9235NSb-YtieUY7aJo4CuszQr4GM6bKYqHRwoZM5VF_MpNmKpQB1913SQPeC2gxNpDV4jkJxZFG_BrD-4ZhG8BrTFBEInvo34CqZcSePQQ","e":"AQAB"}`, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0419.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0419.yaml new file mode 100644 index 0000000000..801ca3e441 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0419.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/failure-wrong key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs384("eyJhbGciOiJSUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.b__y2zjqMoD7iWbHeQ0lNpnche3ph5-AwrIQICLMQQGtEz9WMBteHydkC5g01bm3TBX1d04Z5IEOsuK6btAtWma04c5NYqaUyNEUJKYCFoY02uH0jGdGfL6R5Kkv0lkNvN0s3Nex9jMaVVgqx8bcrOU0uRBFT67sXcm11LHaB9BwKFslolzHClxgXy5RIZb4OFk_7Yk7xTC6PcvEWkkGR9uXBhfDEig5WqdwOWPeulimvARDw14U35rzeh9xpGAPjBKeE-y20fXAk0cSF1H69C-Qa1jDQheYIrAJ6XMYGNZWuay5-smmeefe67eweEt1q-AD1NFepqkmZX382DGuYQ", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0420.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0420.yaml new file mode 100644 index 0000000000..1c1dc3fc5f --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0420.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-cert + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs512("eyJhbGciOiJSUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.VSe3qK5Gp0Q0_5nRgMFu25yw74FIgX-kXPOemSi62l-AxeVdUw8rOpEFrSTCaVjd3mPfKb-B056a-gtrbpXK9sUQnFdqdsyt8gHK-umz5lVyWfoAgj51Ontv-9K_pRORD9wqKqdTLZjCxJ5tyKoO0gY3SwwqSqGrp85vUjvEcK3jbMKINGRUNnOokeSm7byUEJsfKVUbPboSX1TGyvjDOZxxSITj8-bzZZ3F21DJ23N2IiJN7FW8Xj-SYyphXo-ML50o5bjW9YlQ5BDk-RW1I4eE-KpsxhApPv_xIgE8d89PVtXFuoJtv0yLRaZ1q04Fl9KNoMyZrmr349yppn0JlQ", "-----BEGIN CERTIFICATE-----\nMIIDXDCCAkSgAwIBAgIBLjANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJVUzEV\nMBMGA1UEBxMMUmVkd29vZCBDaXR5MQ4wDAYDVQQKEwVTdHlyYTEMMAoGA1UECxMD\nRGV2MRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMjAwNTA3MDg1MTAzWhcNMjAwNTA3\nMTA1MTAzWjBWMQswCQYDVQQGEwJVUzEVMBMGA1UEBxMMUmVkd29vZCBDaXR5MQ4w\nDAYDVQQKEwVTdHlyYTEMMAoGA1UECxMDRGV2MRIwEAYDVQQDEwlsb2NhbGhvc3Qw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDeRmygX/fOOUu5Wm91PFNo\nsHDG1CzG9a1iKBjUeMgi9bXXScUfatPmsNlxb56uSi0RXUsvJmY/yxkIIhRyapxW\n49j2idAM3SGGL1nOZf/XdpDHYsAFFZ237HGb8DOEk/p3xCFv0tH/iQ+kLP36EM1+\ntn6BfUXdJnVyvkSK2iMNeRY7A4DMX7sGX39LXsVJiCokIC8E0QUFrSjvrAm9ejKE\ntPojydo4c3VUxLfmFuyMXoD3bfk1Jv5i2J5RjtomjgK6zNCvgYzpspiodHChkzlU\nX8yk2YqlAHX3XdJA94LaDE2kNXiOQnFkUb8GsP7hmEbwGtMUEQie+jfgKplxJ49B\nAgMBAAGjNTAzMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAM\nBgNVHRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQC9f2/kxT7DnQ94ownhHvd6\nrzk1WirI90rFM2MxhfkaDrOHhSGZL9nDf6TIZ4qeFKZXthpKxpiZm2Oxmn+vUsik\nW6bYjq1nX0GCchQLaaFf9Jh1IOLwkfoBdX55tV8xUGHRWgDlCuGbqiixz+Bm0Kap\nkmbyJynVcoiKhdLyYm/YTn/pC32SJW666reQ+0qCAoxzLQowBetHjwDam9RsDEf4\n+JRDjYPutNXyJ5X8BaBA6PzHanzMG/7RFYcx/2YhXwVxdfPHku4ALJcddIGAGNx2\n5yte+HY0aEu+06J67eD9+4fU7NixRMKigk9KbjqpeWD+0be+VgX8Dot4jaISgI/3\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0421.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0421.yaml new file mode 100644 index 0000000000..322e64c233 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0421.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs512("eyJhbGciOiJSUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.VSe3qK5Gp0Q0_5nRgMFu25yw74FIgX-kXPOemSi62l-AxeVdUw8rOpEFrSTCaVjd3mPfKb-B056a-gtrbpXK9sUQnFdqdsyt8gHK-umz5lVyWfoAgj51Ontv-9K_pRORD9wqKqdTLZjCxJ5tyKoO0gY3SwwqSqGrp85vUjvEcK3jbMKINGRUNnOokeSm7byUEJsfKVUbPboSX1TGyvjDOZxxSITj8-bzZZ3F21DJ23N2IiJN7FW8Xj-SYyphXo-ML50o5bjW9YlQ5BDk-RW1I4eE-KpsxhApPv_xIgE8d89PVtXFuoJtv0yLRaZ1q04Fl9KNoMyZrmr349yppn0JlQ", "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3kZsoF/3zjlLuVpvdTxT\naLBwxtQsxvWtYigY1HjIIvW110nFH2rT5rDZcW+erkotEV1LLyZmP8sZCCIUcmqc\nVuPY9onQDN0hhi9ZzmX/13aQx2LABRWdt+xxm/AzhJP6d8Qhb9LR/4kPpCz9+hDN\nfrZ+gX1F3SZ1cr5EitojDXkWOwOAzF+7Bl9/S17FSYgqJCAvBNEFBa0o76wJvXoy\nhLT6I8naOHN1VMS35hbsjF6A9235NSb+YtieUY7aJo4CuszQr4GM6bKYqHRwoZM5\nVF/MpNmKpQB1913SQPeC2gxNpDV4jkJxZFG/BrD+4ZhG8BrTFBEInvo34CqZcSeP\nQQIDAQAB\n-----END PUBLIC KEY-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0422.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0422.yaml new file mode 100644 index 0000000000..f400680207 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0422.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-jwk + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs512("eyJhbGciOiJSUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.VSe3qK5Gp0Q0_5nRgMFu25yw74FIgX-kXPOemSi62l-AxeVdUw8rOpEFrSTCaVjd3mPfKb-B056a-gtrbpXK9sUQnFdqdsyt8gHK-umz5lVyWfoAgj51Ontv-9K_pRORD9wqKqdTLZjCxJ5tyKoO0gY3SwwqSqGrp85vUjvEcK3jbMKINGRUNnOokeSm7byUEJsfKVUbPboSX1TGyvjDOZxxSITj8-bzZZ3F21DJ23N2IiJN7FW8Xj-SYyphXo-ML50o5bjW9YlQ5BDk-RW1I4eE-KpsxhApPv_xIgE8d89PVtXFuoJtv0yLRaZ1q04Fl9KNoMyZrmr349yppn0JlQ", `{"kty":"RSA","n":"3kZsoF_3zjlLuVpvdTxTaLBwxtQsxvWtYigY1HjIIvW110nFH2rT5rDZcW-erkotEV1LLyZmP8sZCCIUcmqcVuPY9onQDN0hhi9ZzmX_13aQx2LABRWdt-xxm_AzhJP6d8Qhb9LR_4kPpCz9-hDNfrZ-gX1F3SZ1cr5EitojDXkWOwOAzF-7Bl9_S17FSYgqJCAvBNEFBa0o76wJvXoyhLT6I8naOHN1VMS35hbsjF6A9235NSb-YtieUY7aJo4CuszQr4GM6bKYqHRwoZM5VF_MpNmKpQB1913SQPeC2gxNpDV4jkJxZFG_BrD-4ZhG8BrTFBEInvo34CqZcSePQQ","e":"AQAB"}`, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0423.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0423.yaml new file mode 100644 index 0000000000..1d9659f645 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0423.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/failure-wrong key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_rs512("eyJhbGciOiJSUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.VSe3qK5Gp0Q0_5nRgMFu25yw74FIgX-kXPOemSi62l-AxeVdUw8rOpEFrSTCaVjd3mPfKb-B056a-gtrbpXK9sUQnFdqdsyt8gHK-umz5lVyWfoAgj51Ontv-9K_pRORD9wqKqdTLZjCxJ5tyKoO0gY3SwwqSqGrp85vUjvEcK3jbMKINGRUNnOokeSm7byUEJsfKVUbPboSX1TGyvjDOZxxSITj8-bzZZ3F21DJ23N2IiJN7FW8Xj-SYyphXo-ML50o5bjW9YlQ5BDk-RW1I4eE-KpsxhApPv_xIgE8d89PVtXFuoJtv0yLRaZ1q04Fl9KNoMyZrmr349yppn0JlQ", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0424.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0424.yaml new file mode 100644 index 0000000000..01c2830c5f --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0424.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-ps384-cert + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps384("eyJhbGciOiJQUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.EHPUvPr6uJOYqdza95WbM1SYD8atZHJEVRggpwOWnHGsjQBoEarJb8QgW7TY22OXwGw2HWluTiyT_MAz02NaHRzZv6AgrmxCLChMWkCHLwPxqjs0xSvVAMLzHHq2X2Bcujo9KORGudR7zKz8pOX5Mfnm7Z6OGtqPCPLaIdVJlddNsG6a571NOuVuDWbcg0omeRDANZpCZMJeAQN2M-4Q61ef6zcQHK1R-QqzBhw6HzMgqR1LRJ0xbrmD-L5o53JM3pV1e1juKNXVK3vWkDQRCQORFn1lyH5isfSsiiHW-x90sUC7TrU_cOji4MMmOCME6kkwxe57ZgpeXtdVTvldpw", "-----BEGIN CERTIFICATE-----\nMIIDXDCCAkSgAwIBAgIBKjANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJVUzEV\nMBMGA1UEBxMMUmVkd29vZCBDaXR5MQ4wDAYDVQQKEwVTdHlyYTEMMAoGA1UECxMD\nRGV2MRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMjAwNTA3MDkxMjU2WhcNMjAwNTA3\nMTExMjU2WjBWMQswCQYDVQQGEwJVUzEVMBMGA1UEBxMMUmVkd29vZCBDaXR5MQ4w\nDAYDVQQKEwVTdHlyYTEMMAoGA1UECxMDRGV2MRIwEAYDVQQDEwlsb2NhbGhvc3Qw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDtyVWH2FE8cU8LRcArH4Tw\nDhBOFcmJF28LrvRObcbDYsae6rEwby0aRgSxjTEMgyGBjroBSl22wOSA93kwx4pu\npfXEqbwywn9FhyKBb/OXQSglPmwrpmzQtPJGzBHncL+PPjRhPfqimwf7ZIPKAAgI\nz9O6ppGhE/x4Ct444jthUIBZuG5cUXhgiPBQdIQ3K88QhgVwcufTZkNHj4iSDfhl\nVFDHVjXjd2B/yGODjyv0TyChV0YBNGjMv7YFLWmIFUFzK+6qNSxu4czPtRkyfwaV\n2GW/PBT5f8fc6fKgQZ6k6BLK6+pi0iPh5TUizyHtqtueWDbrJ+wfdJilQS8D+EGr\nAgMBAAGjNTAzMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAM\nBgNVHRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQBgVAM50/0aBTBxESYKIKN4\nE+qbV6aE0C+wYJLet0EWPTxwmFZamq5LNEO/D6xyoY5WHY60EyHRMs0agSB/ATBX\n5ULdEwh9G0NjxqivCcoddQ1fuVS2PrrqNL7VlRnYbTpd8/Dh4qnyl5FltlyZ/29L\ny7BWOwlcBlZdhsfH8svNX4PUxjRD+jmnczCDi7XSOKT8htKUV2ih1c9JrWpIhCi/\nHzEXkaAxNdhBNdIsLQMo3qq9fkSgNZQk9/ecJNPeuJ/UYyr5Xa4PxIWl4U+P7yuI\n+Q3FSPmUbiVsSGqMhh6V/DN8M+T5/KiSB47gFOfxc2/RR5aw4HkSp3WxwbT9njbE\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0425.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0425.yaml new file mode 100644 index 0000000000..ebb6907cf0 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0425.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-ps384-key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps384("eyJhbGciOiJQUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.EHPUvPr6uJOYqdza95WbM1SYD8atZHJEVRggpwOWnHGsjQBoEarJb8QgW7TY22OXwGw2HWluTiyT_MAz02NaHRzZv6AgrmxCLChMWkCHLwPxqjs0xSvVAMLzHHq2X2Bcujo9KORGudR7zKz8pOX5Mfnm7Z6OGtqPCPLaIdVJlddNsG6a571NOuVuDWbcg0omeRDANZpCZMJeAQN2M-4Q61ef6zcQHK1R-QqzBhw6HzMgqR1LRJ0xbrmD-L5o53JM3pV1e1juKNXVK3vWkDQRCQORFn1lyH5isfSsiiHW-x90sUC7TrU_cOji4MMmOCME6kkwxe57ZgpeXtdVTvldpw", "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7clVh9hRPHFPC0XAKx+E\n8A4QThXJiRdvC670Tm3Gw2LGnuqxMG8tGkYEsY0xDIMhgY66AUpdtsDkgPd5MMeK\nbqX1xKm8MsJ/RYcigW/zl0EoJT5sK6Zs0LTyRswR53C/jz40YT36opsH+2SDygAI\nCM/TuqaRoRP8eAreOOI7YVCAWbhuXFF4YIjwUHSENyvPEIYFcHLn02ZDR4+Ikg34\nZVRQx1Y143dgf8hjg48r9E8goVdGATRozL+2BS1piBVBcyvuqjUsbuHMz7UZMn8G\nldhlvzwU+X/H3OnyoEGepOgSyuvqYtIj4eU1Is8h7arbnlg26yfsH3SYpUEvA/hB\nqwIDAQAB\n-----END PUBLIC KEY-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0426.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0426.yaml new file mode 100644 index 0000000000..34d6057a9d --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0426.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-ps384-jwk + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps384("eyJhbGciOiJQUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.EHPUvPr6uJOYqdza95WbM1SYD8atZHJEVRggpwOWnHGsjQBoEarJb8QgW7TY22OXwGw2HWluTiyT_MAz02NaHRzZv6AgrmxCLChMWkCHLwPxqjs0xSvVAMLzHHq2X2Bcujo9KORGudR7zKz8pOX5Mfnm7Z6OGtqPCPLaIdVJlddNsG6a571NOuVuDWbcg0omeRDANZpCZMJeAQN2M-4Q61ef6zcQHK1R-QqzBhw6HzMgqR1LRJ0xbrmD-L5o53JM3pV1e1juKNXVK3vWkDQRCQORFn1lyH5isfSsiiHW-x90sUC7TrU_cOji4MMmOCME6kkwxe57ZgpeXtdVTvldpw", `{"kty":"RSA","n":"7clVh9hRPHFPC0XAKx-E8A4QThXJiRdvC670Tm3Gw2LGnuqxMG8tGkYEsY0xDIMhgY66AUpdtsDkgPd5MMeKbqX1xKm8MsJ_RYcigW_zl0EoJT5sK6Zs0LTyRswR53C_jz40YT36opsH-2SDygAICM_TuqaRoRP8eAreOOI7YVCAWbhuXFF4YIjwUHSENyvPEIYFcHLn02ZDR4-Ikg34ZVRQx1Y143dgf8hjg48r9E8goVdGATRozL-2BS1piBVBcyvuqjUsbuHMz7UZMn8GldhlvzwU-X_H3OnyoEGepOgSyuvqYtIj4eU1Is8h7arbnlg26yfsH3SYpUEvA_hBqw","e":"AQAB"}`, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0427.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0427.yaml new file mode 100644 index 0000000000..16ebe52403 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0427.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/failure-ps384-wrong key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps384("eyJhbGciOiJQUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.EHPUvPr6uJOYqdza95WbM1SYD8atZHJEVRggpwOWnHGsjQBoEarJb8QgW7TY22OXwGw2HWluTiyT_MAz02NaHRzZv6AgrmxCLChMWkCHLwPxqjs0xSvVAMLzHHq2X2Bcujo9KORGudR7zKz8pOX5Mfnm7Z6OGtqPCPLaIdVJlddNsG6a571NOuVuDWbcg0omeRDANZpCZMJeAQN2M-4Q61ef6zcQHK1R-QqzBhw6HzMgqR1LRJ0xbrmD-L5o53JM3pV1e1juKNXVK3vWkDQRCQORFn1lyH5isfSsiiHW-x90sUC7TrU_cOji4MMmOCME6kkwxe57ZgpeXtdVTvldpw", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0428.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0428.yaml new file mode 100644 index 0000000000..11f7c6b80e --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0428.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-ps512-cert + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps512("eyJhbGciOiJQUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.VRlkPtiUq5MmBNgyuBqxv2_aX40STrWrBB2sSmGbxI78jVG_3hVoh7Mk-wUmFL389qpf05xNdn-gpMe-MSDUux7U7EuFspFZdYTUBo9wRvEBe4e1rHUCG00lVdYCG7eEgbAxM3cUhrHRwExBte30qBrFFUY9FgG-kJdYhgyh7VquMGuKgiS8CP_H0Gp1mIvTw6eEnSFAoKiryw9edUZ78pHELNn4y18YZvEndeNZh7f19LCtrB0G2bJUHGM4vPcwo2D-UAhEFBpSlnnqXDLSWOhUgLNLu0kZACXhT808KT6fdF6eFihdThmWN7_HUz2znjrjs71CqqDJgLhkGs8UvQ", "-----BEGIN CERTIFICATE-----\nMIIDXDCCAkSgAwIBAgIBKjANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJVUzEV\nMBMGA1UEBxMMUmVkd29vZCBDaXR5MQ4wDAYDVQQKEwVTdHlyYTEMMAoGA1UECxMD\nRGV2MRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMjAwNTA3MDkxMjU2WhcNMjAwNTA3\nMTExMjU2WjBWMQswCQYDVQQGEwJVUzEVMBMGA1UEBxMMUmVkd29vZCBDaXR5MQ4w\nDAYDVQQKEwVTdHlyYTEMMAoGA1UECxMDRGV2MRIwEAYDVQQDEwlsb2NhbGhvc3Qw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDtyVWH2FE8cU8LRcArH4Tw\nDhBOFcmJF28LrvRObcbDYsae6rEwby0aRgSxjTEMgyGBjroBSl22wOSA93kwx4pu\npfXEqbwywn9FhyKBb/OXQSglPmwrpmzQtPJGzBHncL+PPjRhPfqimwf7ZIPKAAgI\nz9O6ppGhE/x4Ct444jthUIBZuG5cUXhgiPBQdIQ3K88QhgVwcufTZkNHj4iSDfhl\nVFDHVjXjd2B/yGODjyv0TyChV0YBNGjMv7YFLWmIFUFzK+6qNSxu4czPtRkyfwaV\n2GW/PBT5f8fc6fKgQZ6k6BLK6+pi0iPh5TUizyHtqtueWDbrJ+wfdJilQS8D+EGr\nAgMBAAGjNTAzMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAM\nBgNVHRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQBgVAM50/0aBTBxESYKIKN4\nE+qbV6aE0C+wYJLet0EWPTxwmFZamq5LNEO/D6xyoY5WHY60EyHRMs0agSB/ATBX\n5ULdEwh9G0NjxqivCcoddQ1fuVS2PrrqNL7VlRnYbTpd8/Dh4qnyl5FltlyZ/29L\ny7BWOwlcBlZdhsfH8svNX4PUxjRD+jmnczCDi7XSOKT8htKUV2ih1c9JrWpIhCi/\nHzEXkaAxNdhBNdIsLQMo3qq9fkSgNZQk9/ecJNPeuJ/UYyr5Xa4PxIWl4U+P7yuI\n+Q3FSPmUbiVsSGqMhh6V/DN8M+T5/KiSB47gFOfxc2/RR5aw4HkSp3WxwbT9njbE\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0429.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0429.yaml new file mode 100644 index 0000000000..8b4cee3a6d --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0429.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-ps512-key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps512("eyJhbGciOiJQUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.VRlkPtiUq5MmBNgyuBqxv2_aX40STrWrBB2sSmGbxI78jVG_3hVoh7Mk-wUmFL389qpf05xNdn-gpMe-MSDUux7U7EuFspFZdYTUBo9wRvEBe4e1rHUCG00lVdYCG7eEgbAxM3cUhrHRwExBte30qBrFFUY9FgG-kJdYhgyh7VquMGuKgiS8CP_H0Gp1mIvTw6eEnSFAoKiryw9edUZ78pHELNn4y18YZvEndeNZh7f19LCtrB0G2bJUHGM4vPcwo2D-UAhEFBpSlnnqXDLSWOhUgLNLu0kZACXhT808KT6fdF6eFihdThmWN7_HUz2znjrjs71CqqDJgLhkGs8UvQ", "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7clVh9hRPHFPC0XAKx+E\n8A4QThXJiRdvC670Tm3Gw2LGnuqxMG8tGkYEsY0xDIMhgY66AUpdtsDkgPd5MMeK\nbqX1xKm8MsJ/RYcigW/zl0EoJT5sK6Zs0LTyRswR53C/jz40YT36opsH+2SDygAI\nCM/TuqaRoRP8eAreOOI7YVCAWbhuXFF4YIjwUHSENyvPEIYFcHLn02ZDR4+Ikg34\nZVRQx1Y143dgf8hjg48r9E8goVdGATRozL+2BS1piBVBcyvuqjUsbuHMz7UZMn8G\nldhlvzwU+X/H3OnyoEGepOgSyuvqYtIj4eU1Is8h7arbnlg26yfsH3SYpUEvA/hB\nqwIDAQAB\n-----END PUBLIC KEY-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0430.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0430.yaml new file mode 100644 index 0000000000..c1e471f525 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0430.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-ps512-jwk + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps512("eyJhbGciOiJQUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.VRlkPtiUq5MmBNgyuBqxv2_aX40STrWrBB2sSmGbxI78jVG_3hVoh7Mk-wUmFL389qpf05xNdn-gpMe-MSDUux7U7EuFspFZdYTUBo9wRvEBe4e1rHUCG00lVdYCG7eEgbAxM3cUhrHRwExBte30qBrFFUY9FgG-kJdYhgyh7VquMGuKgiS8CP_H0Gp1mIvTw6eEnSFAoKiryw9edUZ78pHELNn4y18YZvEndeNZh7f19LCtrB0G2bJUHGM4vPcwo2D-UAhEFBpSlnnqXDLSWOhUgLNLu0kZACXhT808KT6fdF6eFihdThmWN7_HUz2znjrjs71CqqDJgLhkGs8UvQ", `{"kty":"RSA","n":"7clVh9hRPHFPC0XAKx-E8A4QThXJiRdvC670Tm3Gw2LGnuqxMG8tGkYEsY0xDIMhgY66AUpdtsDkgPd5MMeKbqX1xKm8MsJ_RYcigW_zl0EoJT5sK6Zs0LTyRswR53C_jz40YT36opsH-2SDygAICM_TuqaRoRP8eAreOOI7YVCAWbhuXFF4YIjwUHSENyvPEIYFcHLn02ZDR4-Ikg34ZVRQx1Y143dgf8hjg48r9E8goVdGATRozL-2BS1piBVBcyvuqjUsbuHMz7UZMn8GldhlvzwU-X_H3OnyoEGepOgSyuvqYtIj4eU1Is8h7arbnlg26yfsH3SYpUEvA_hBqw","e":"AQAB"}`, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0431.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0431.yaml new file mode 100644 index 0000000000..41bd41484b --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0431.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/failure-wrong key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_ps512("eyJhbGciOiJQUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.VRlkPtiUq5MmBNgyuBqxv2_aX40STrWrBB2sSmGbxI78jVG_3hVoh7Mk-wUmFL389qpf05xNdn-gpMe-MSDUux7U7EuFspFZdYTUBo9wRvEBe4e1rHUCG00lVdYCG7eEgbAxM3cUhrHRwExBte30qBrFFUY9FgG-kJdYhgyh7VquMGuKgiS8CP_H0Gp1mIvTw6eEnSFAoKiryw9edUZ78pHELNn4y18YZvEndeNZh7f19LCtrB0G2bJUHGM4vPcwo2D-UAhEFBpSlnnqXDLSWOhUgLNLu0kZACXhT808KT6fdF6eFihdThmWN7_HUz2znjrjs71CqqDJgLhkGs8UvQ", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0432.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0432.yaml new file mode 100644 index 0000000000..729991d0a1 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0432.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-es384-cert + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_es384("eyJhbGciOiJFUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.w85PzWrIQbJBOROnah0pa8or2LsXWnj88bwG1R-zf5Mm20CaYGPKPTQEsU_y-dzaWyDV1Na7nfaGaH3Khcvj8yS-bidZ0OZVVFDk9oabX7ZYvAHo2pTAOfxc11TeOYSF", "-----BEGIN CERTIFICATE-----\nMIICDDCCAZOgAwIBAgIBIzAKBggqhkjOPQQDAzBWMQswCQYDVQQGEwJVUzEVMBMG\nA1UEBxMMUmVkd29vZCBDaXR5MQ4wDAYDVQQKEwVTdHlyYTEMMAoGA1UECxMDRGV2\nMRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMjAwNTA3MDk0MzU1WhcNMjAwNTA3MTE0\nMzU1WjBWMQswCQYDVQQGEwJVUzEVMBMGA1UEBxMMUmVkd29vZCBDaXR5MQ4wDAYD\nVQQKEwVTdHlyYTEMMAoGA1UECxMDRGV2MRIwEAYDVQQDEwlsb2NhbGhvc3QwdjAQ\nBgcqhkjOPQIBBgUrgQQAIgNiAARjcwW7g9wx4ePsuwcVzDJCVo4f8I1C1X5US4B1\nrWN+5zFSJoGCKaPTXMDhAdS08D1G20AIRmA0AlVVXRxrZYZ+Y282O6s+EGsB5T1W\nMCnUFk2Sa+xZiGPApYz4zSGbNEqjNTAzMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUE\nDDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMAoGCCqGSM49BAMDA2cAMGQCMGSG\nVjx3DZP71ZGNDBw+AVdhNU3pgJW8kNpqjta3HFLb6pzqNOsfOn1ZeIWciEcyEgIw\nTGxli48W1AJ2s7Pw+3wOA6f9HAmczJPaiZ9CY038UiT8mk+pND5FEdqLhT/5lMEz\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0433.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0433.yaml new file mode 100644 index 0000000000..d0ab506488 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0433.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-es384-key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_es384("eyJhbGciOiJFUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.w85PzWrIQbJBOROnah0pa8or2LsXWnj88bwG1R-zf5Mm20CaYGPKPTQEsU_y-dzaWyDV1Na7nfaGaH3Khcvj8yS-bidZ0OZVVFDk9oabX7ZYvAHo2pTAOfxc11TeOYSF", "-----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEY3MFu4PcMeHj7LsHFcwyQlaOH/CNQtV+\nVEuAda1jfucxUiaBgimj01zA4QHUtPA9RttACEZgNAJVVV0ca2WGfmNvNjurPhBr\nAeU9VjAp1BZNkmvsWYhjwKWM+M0hmzRK\n-----END PUBLIC KEY-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0434.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0434.yaml new file mode 100644 index 0000000000..1ad15ce54a --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0434.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-es384-jwk + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_es384("eyJhbGciOiJFUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.w85PzWrIQbJBOROnah0pa8or2LsXWnj88bwG1R-zf5Mm20CaYGPKPTQEsU_y-dzaWyDV1Na7nfaGaH3Khcvj8yS-bidZ0OZVVFDk9oabX7ZYvAHo2pTAOfxc11TeOYSF", `{"kty":"EC","crv":"P-384","x":"Y3MFu4PcMeHj7LsHFcwyQlaOH_CNQtV-VEuAda1jfucxUiaBgimj01zA4QHUtPA9","y":"RttACEZgNAJVVV0ca2WGfmNvNjurPhBrAeU9VjAp1BZNkmvsWYhjwKWM-M0hmzRK"}`, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0435.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0435.yaml new file mode 100644 index 0000000000..9b999b66e5 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0435.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/failure-wrong key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_es384("eyJhbGciOiJFUzM4NCJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.w85PzWrIQbJBOROnah0pa8or2LsXWnj88bwG1R-zf5Mm20CaYGPKPTQEsU_y-dzaWyDV1Na7nfaGaH3Khcvj8yS-bidZ0OZVVFDk9oabX7ZYvAHo2pTAOfxc11TeOYSF", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0436.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0436.yaml new file mode 100644 index 0000000000..7b5422d54f --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0436.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-es512-cert + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_es512("eyJhbGciOiJFUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.AYpssEoEqq9We9aKsnRykpECAVEOBRJJu8UgDzoL-F8fmB2LPxpS4Gl7D-9wAO5AJt4-9YSsgOb5FLc20MrZN30AAFYopZf75T1pEJQFrdDmOKT45abbrorcR7G_AHDbhBdDNM_R6GojYFg_HPxHndof745Yq5Tfw9PpJc-9kSyk6kqO", "-----BEGIN CERTIFICATE-----\nMIICWDCCAbmgAwIBAgIBAjAKBggqhkjOPQQDBDBWMQswCQYDVQQGEwJVUzEVMBMG\nA1UEBxMMUmVkd29vZCBDaXR5MQ4wDAYDVQQKEwVTdHlyYTEMMAoGA1UECxMDRGV2\nMRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMjAwNTA3MTA1NDM3WhcNMjAwNTA3MTI1\nNDM3WjBWMQswCQYDVQQGEwJVUzEVMBMGA1UEBxMMUmVkd29vZCBDaXR5MQ4wDAYD\nVQQKEwVTdHlyYTEMMAoGA1UECxMDRGV2MRIwEAYDVQQDEwlsb2NhbGhvc3QwgZsw\nEAYHKoZIzj0CAQYFK4EEACMDgYYABAHLm3IMD/88vC/S1cCTyjrCjwHIGsjibFBw\nPBXt36YKCjUdS7jiJJR5YQVPypSv7gPaKKn1E8CqkfVdd3rrp1TocAEms4XvigtW\nZBZzffw9xyZCgmtQ2dTHsufi/5W/Yx8N3Uw+D2wl1LKcJraouo+qgamGfuou6WbA\noPEtdOg0+B4jF6M1MDMwDgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUF\nBwMBMAwGA1UdEwEB/wQCMAAwCgYIKoZIzj0EAwQDgYwAMIGIAkIAzAAYDqMghX3S\n8UbS8s5TPAztJy9oNXFra5V8pPlUdNFc2ov2LN++scW46wCb/cJUyEc58sY7xFuK\nI5sCOkv95N8CQgFXmu354LZJ31zIovuUA8druOPe3TDnxMGwEEm2Lt43JNuhzNyP\nhJYh9/QKfe2AiwrLXEG4VVOIXdjq7vexl87evg==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0437.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0437.yaml new file mode 100644 index 0000000000..a17f618216 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0437.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-es512-key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_es512("eyJhbGciOiJFUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.AYpssEoEqq9We9aKsnRykpECAVEOBRJJu8UgDzoL-F8fmB2LPxpS4Gl7D-9wAO5AJt4-9YSsgOb5FLc20MrZN30AAFYopZf75T1pEJQFrdDmOKT45abbrorcR7G_AHDbhBdDNM_R6GojYFg_HPxHndof745Yq5Tfw9PpJc-9kSyk6kqO", "-----BEGIN PUBLIC KEY-----\nMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBy5tyDA//PLwv0tXAk8o6wo8ByBrI\n4mxQcDwV7d+mCgo1HUu44iSUeWEFT8qUr+4D2iip9RPAqpH1XXd666dU6HABJrOF\n74oLVmQWc338PccmQoJrUNnUx7Ln4v+Vv2MfDd1MPg9sJdSynCa2qLqPqoGphn7q\nLulmwKDxLXToNPgeIxc=\n-----END PUBLIC KEY-----", x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0438.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0438.yaml new file mode 100644 index 0000000000..1dd652b744 --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0438.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/success-es512-jwk + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_es512("eyJhbGciOiJFUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.AYpssEoEqq9We9aKsnRykpECAVEOBRJJu8UgDzoL-F8fmB2LPxpS4Gl7D-9wAO5AJt4-9YSsgOb5FLc20MrZN30AAFYopZf75T1pEJQFrdDmOKT45abbrorcR7G_AHDbhBdDNM_R6GojYFg_HPxHndof745Yq5Tfw9PpJc-9kSyk6kqO", `{"kty":"EC","crv":"P-521","x":"AcubcgwP_zy8L9LVwJPKOsKPAcgayOJsUHA8Fe3fpgoKNR1LuOIklHlhBU_KlK_uA9ooqfUTwKqR9V13euunVOhw","y":"ASazhe-KC1ZkFnN9_D3HJkKCa1DZ1Mey5-L_lb9jHw3dTD4PbCXUspwmtqi6j6qBqYZ-6i7pZsCg8S106DT4HiMX"}`, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0439.yaml b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0439.yaml new file mode 100644 index 0000000000..1a0250372b --- /dev/null +++ b/test/cases/testdata/v1/jwtverifyrsa/test-jwtverifyrsa-0439.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: jwtverifyrsa/failure-wrong key + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + io.jwt.verify_es512("eyJhbGciOiJFUzUxMiJ9.eyJTY29wZXMiOlsiZm9vIiwiYmFyIl0sIm5iZiI6MTQ1MTYwNjQwMH0.AYpssEoEqq9We9aKsnRykpECAVEOBRJJu8UgDzoL-F8fmB2LPxpS4Gl7D-9wAO5AJt4-9YSsgOb5FLc20MrZN30AAFYopZf75T1pEJQFrdDmOKT45abbrorcR7G_AHDbhBdDNM_R6GojYFg_HPxHndof745Yq5Tfw9PpJc-9kSyk6kqO", "-----BEGIN CERTIFICATE-----\nMIIFiDCCA3ACCQCGV6XsfG/oRTANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMC\nVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEO\nMAwGA1UECgwFU3R5cmExDDAKBgNVBAsMA0RldjESMBAGA1UEAwwJbG9jYWxob3N0\nMRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5cmEwHhcNMTgwMzA2MDAxNTU5WhcNMTkw\nMzA2MDAxNTU5WjCBhTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx\nFTATBgNVBAcMDFJlZHdvb2QgQ2l0eTEOMAwGA1UECgwFU3R5cmExDDAKBgNVBAsM\nA0RldjESMBAGA1UEAwwJbG9jYWxob3N0MRgwFgYJKoZIhvcNAQkBFglhc2hAc3R5\ncmEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDucnAwTRA0zqDQ671L\nKWOVwhjhycFyzyhZUd7vhsnslOBiYM6TYIDXhETfAk2RQoRE/9xF16woMD8FOglc\nlSuhi+GNfFRif6LfArm84ZFj1ZS1MX2logikhXhRJQ7AOHe5+ED0re3KH5lWyqfz\nR6bQuPYwTQSBJy6Tq7T9RiOM29yadCX64OaCEbzEFmHtNlbb5px4zCVvgskg/fpV\nGGCMpAYjGDatbxE5eAloVs1EJuI5RSqWr1JRm6EejxM04BFdfGn1HgWrsKXtlvBa\n00/AC0zXL5n6LK7+L3WbRguVTZcE4Yu70gDwhmM+VsKeT9LKClX003BNj0NJDRB9\ndw9MaWxsXDNHNOWEfbnASXeP7ZRv3D81ftij6P8SL14ZnxyrRty8TAN4ij3wd41l\nastRQCtrJFi+HzO606XOp6HDzBoWT0DGl8Sn2hZ6RLPyBnD04vvvcSGeCVjHGOQ8\nc3OTroK58u5MR/q4T00sTkeeVAxuKoEWKsjIBYYrJTe/a2mEq9yiDGbPNYDnWnQZ\njSUZm+Us23Y2sm/agZ5zKXcEuoecGL6sYCixr/xeB9BPxEiTthH+0M8OY99qpIhz\nSmj41wdgQfzZi/6B8pIr77V/KywYKxJEmzw8Uy48aC/rZ8WsT8QdKwclo1aiNJhx\n79OvGbZFoeHD/w7igpx+ttpF/wIDAQABMA0GCSqGSIb3DQEBBQUAA4ICAQC3wWUs\nfXz+aSfFVz+O3mLFkr65NIgazbGAySgMgMNVuadheIkPL4k21atyflfpx4pg9FGv\n40vWCLMajpvynfz4oqah0BACnpqzQ8Dx6HYkmlXK8fLB+WtPrZBeUEsGPKuJYt4M\nd5TeY3VpNgWOPXmnE4lvxHZqh/8OwmOpjBfC9E3e2eqgwiwOkXnMaZEPgKP6JiWk\nEFaQ9jgMQqJZnNcv6NmiqqsZeI0/NNjBpkmEWQl+wLegVusHiQ0FMBMQ0taEo21r\nzUwHoNJR3h3wgGQiKxKOH1FUKHBV7hEqObLraD/hfG5xYucJfvvAAP1iH0ycPs+9\nhSccrn5/HY1c9AZnW8Kh7atp/wFP+sHjtECWK/lUmXfhASS293hprCpJk2n9pkmR\nziXKJhjwkxlC8NcHuiVfaxdfDa4+1Qta2gK7GEypbvLoEmIt/dsYUsxUg84lwJJ9\nnyC/pfZ5a8wFSf186JeVH4kHd3bnkzlQz460HndOMSJ/Xi1wSfuZlOVupFf8TVKl\np4j28MTLH2Wqx50NssKThdaX6hoCiMqreYa+EVaN1f/cIGQxZSCzdzMCKqdB8lKB\n3Eax+5zsIa/UyPwGxZcyXBRHAlz5ZnkjuRxInyiMkBWWz3IZXjTe6Fq8BNd2UWNc\nw35+2nO5n1LKXgR2+nzhZUOk8TPsi9WUywRluQ==\n-----END CERTIFICATE-----", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/negation/test-negation-0777.yaml b/test/cases/testdata/v1/negation/test-negation-0777.yaml new file mode 100644 index 0000000000..9718a919dc --- /dev/null +++ b/test/cases/testdata/v1/negation/test-negation-0777.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "negation/neg: constants" + query: data.generated.p = x + modules: + - | + package generated + + p if { + not true = false + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/negation/test-negation-0778.yaml b/test/cases/testdata/v1/negation/test-negation-0778.yaml new file mode 100644 index 0000000000..8d11640258 --- /dev/null +++ b/test/cases/testdata/v1/negation/test-negation-0778.yaml @@ -0,0 +1,12 @@ +--- +cases: + - note: "negation/neg: constants" + query: data.generated.p = x + modules: + - | + package generated + + p if { + not true = true + } + want_result: [] diff --git a/test/cases/testdata/v1/negation/test-negation-0779.yaml b/test/cases/testdata/v1/negation/test-negation-0779.yaml new file mode 100644 index 0000000000..b0b9ac1de1 --- /dev/null +++ b/test/cases/testdata/v1/negation/test-negation-0779.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "negation/neg: set contains" + query: data.generated.p = x + modules: + - | + package generated + + p if { + not data.generated.q.v0 + } + + q contains x if { + data.b[x] = v + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/negation/test-negation-0780.yaml b/test/cases/testdata/v1/negation/test-negation-0780.yaml new file mode 100644 index 0000000000..8a95c5a31a --- /dev/null +++ b/test/cases/testdata/v1/negation/test-negation-0780.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "negation/neg: set contains undefined" + query: data.generated.p = x + modules: + - | + package generated + + p if { + not data.generated.q.v2 + } + + q contains x if { + data.b[x] = v + } + data: + b: + v1: hello + v2: goodbye + want_result: [] diff --git a/test/cases/testdata/v1/negation/test-negation-data-ref-with-var.yaml b/test/cases/testdata/v1/negation/test-negation-data-ref-with-var.yaml new file mode 100644 index 0000000000..6d8b84134f --- /dev/null +++ b/test/cases/testdata/v1/negation/test-negation-data-ref-with-var.yaml @@ -0,0 +1,77 @@ +--- +cases: + - note: "negation/pos: ref with variable" + query: data.test.p = x + modules: + - | + package test + + p := y if { + y := "v0" + not data.test.q[y] + } + + q contains x if { + data.b[x] = v + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: v0 + - note: "negation/neg: ref with variable" + query: data.test.p = x + modules: + - | + package test + + p := y if { + y := "v1" + not data.test.q[y] + } + + q contains x if { + data.b[x] = v + } + data: + b: + v1: hello + v2: goodbye + want_result: [] + - note: "negation/neg: ref with variable (hit) and virtual doc (miss))" + query: data.foo.p = x + modules: + - | + package foo + + p if { + k := "p" + not data.bar[k] + } + - | + package bar + + p := 7 + data: + bar: + q: "8" + want_result: [] + - note: "negation/neg: ref with variable (miss) and virtual doc (hit)" + query: data.foo.p = x + modules: + - | + package foo + + p if { + k := "q" + not data.bar[k] + } + - | + package bar + + p := 7 + data: + bar: + q: "8" + want_result: [] diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0709.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0709.yaml new file mode 100644 index 0000000000..66d01f66f2 --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0709.yaml @@ -0,0 +1,27 @@ +--- +cases: + - note: nestedreferences/ground ref + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.h[0][0] + data.a[__local0__] = 2 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + h: + - - 1 + - 2 + - 3 + - - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0710.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0710.yaml new file mode 100644 index 0000000000..a3d457ca13 --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0710.yaml @@ -0,0 +1,31 @@ +--- +cases: + - note: nestedreferences/non-ground ref + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.h[i][j] + x = data.a[__local0__] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + h: + - - 1 + - 2 + - 3 + - - 2 + - 3 + - 4 + want_result: + - x: + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0711.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0711.yaml new file mode 100644 index 0000000000..cad3979a45 --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0711.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: nestedreferences/two deep + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.a[i] + __local1__ = data.a[__local0__] + x = data.a[__local1__] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0712.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0712.yaml new file mode 100644 index 0000000000..ca8b63d35e --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0712.yaml @@ -0,0 +1,31 @@ +--- +cases: + - note: nestedreferences/two deep + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.a[j] + __local1__ = data.h[i][__local0__] + x = data.a[__local1__] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + h: + - - 1 + - 2 + - 3 + - - 2 + - 3 + - 4 + want_result: + - x: + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0713.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0713.yaml new file mode 100644 index 0000000000..39f3beeec8 --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0713.yaml @@ -0,0 +1,30 @@ +--- +cases: + - note: nestedreferences/two deep repeated var + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.a[i] + __local1__ = data.h[i][__local0__] + x = data.a[__local1__] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + h: + - - 1 + - 2 + - 3 + - - 2 + - 3 + - 4 + want_result: + - x: + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0714.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0714.yaml new file mode 100644 index 0000000000..6e524be18c --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0714.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: nestedreferences/no suffix + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.three + 4 = data.a[__local0__] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + three: 3 + want_result: + - x: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0715.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0715.yaml new file mode 100644 index 0000000000..add7b14d8c --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0715.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: nestedreferences/var ref + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + x = [1, 2, 3] + __local0__ = x[_] + y = data.a[__local0__] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0716.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0716.yaml new file mode 100644 index 0000000000..dcbf0a5d9e --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0716.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: nestedreferences/undefined + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.three.deadbeef + data.a[__local0__] = x + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0717.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0717.yaml new file mode 100644 index 0000000000..a2ce744cdb --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0717.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "nestedreferences/vdoc ref: complete" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.generated.q[_] + x = data.a[__local0__] + } + + q := [2, 3] + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0718.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0718.yaml new file mode 100644 index 0000000000..7ece8347b8 --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0718.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: "nestedreferences/vdoc ref: complete: ground" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.generated.q[1] + x = data.a[__local0__] + } + + q := [2, 3] + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0719.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0719.yaml new file mode 100644 index 0000000000..0b2978180f --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0719.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "nestedreferences/vdoc ref: complete: no suffix" + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.generated.q + 2 = data.a[__local0__] + } + + q := 1 + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0720.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0720.yaml new file mode 100644 index 0000000000..edb60b1065 --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0720.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: "nestedreferences/vdoc ref: partial object" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.generated.q[_] + x = data.a[__local0__] + } + + q[k] := v if { + o = {"a": 2, "b": 3, "c": 100} + o[k] = v + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0721.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0721.yaml new file mode 100644 index 0000000000..065b553fc1 --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0721.yaml @@ -0,0 +1,27 @@ +--- +cases: + - note: "nestedreferences/vdoc ref: partial object: ground" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.generated.q.b + x = data.a[__local0__] + } + + q[k] := v if { + o = {"a": 2, "b": 3, "c": 100} + o[k] = v + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0722.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0722.yaml new file mode 100644 index 0000000000..46786baecb --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0722.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: "nestedreferences/vdoc ref: complete: nested bdoc ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.b[_] + __local1__ = data.generated.q[__local0__] + x = data.a[__local1__] + } + + q := {"hello": 1, "goodbye": 3, "deadbeef": 1000} + data: + a: + - 1 + - 2 + - 3 + - 4 + b: + v1: hello + v2: goodbye + want_result: + - x: + - 2 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0723.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0723.yaml new file mode 100644 index 0000000000..94faec7301 --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0723.yaml @@ -0,0 +1,32 @@ +--- +cases: + - note: "nestedreferences/vdoc ref: partial object: nested bdoc ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.b[_] + __local1__ = data.generated.q[__local0__] + x = data.a[__local1__] + } + + q[k] := v if { + o = {"deadbeef": 1000, "goodbye": 3, "hello": 1} + o[k] = v + } + data: + a: + - 1 + - 2 + - 3 + - 4 + b: + v1: hello + v2: goodbye + want_result: + - x: + - 2 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0724.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0724.yaml new file mode 100644 index 0000000000..8902267730 --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0724.yaml @@ -0,0 +1,36 @@ +--- +cases: + - note: "nestedreferences/vdoc ref: partial object: nested bdoc ref-2" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.d.e[_] + __local1__ = data.generated.q[__local0__] + x = data.a[__local1__] + } + + q[k] := v if { + data.strings[k] = v + } + data: + a: + - 1 + - 2 + - 3 + - 4 + d: + e: + - bar + - baz + strings: + bar: 2 + baz: 3 + foo: 1 + want_result: + - x: + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0725.yaml b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0725.yaml new file mode 100644 index 0000000000..1ed42b35e4 --- /dev/null +++ b/test/cases/testdata/v1/nestedreferences/test-nestedreferences-0725.yaml @@ -0,0 +1,31 @@ +--- +cases: + - note: "nestedreferences/vdoc ref: multiple" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.a[_] + __local1__ = data.a[_] + __local2__ = data.generated.r[__local1__] + x = data.generated.q[__local0__].v[__local2__] + } + + q := [{"v": {}}, {"v": [0, 0, 1, 2]}, {"v": [0, 0, 3, 4]}, {"v": [0, 0]}, {}] + + r := [1, 2, 3, 4] + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0092.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0092.yaml new file mode 100644 index 0000000000..c521f7cb07 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0092.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrcontains/cidr contains subnet + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_contains("10.0.0.0/8", "10.1.0.0/24", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0093.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0093.yaml new file mode 100644 index 0000000000..3f42c897cc --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0093.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrcontains/cidr does not contain subnet partial + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_contains("172.17.0.0/24", "172.17.0.0/16", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0094.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0094.yaml new file mode 100644 index 0000000000..5c0a89531f --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0094.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrcontains/cidr does not contain subnet + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_contains("10.0.0.0/8", "192.168.1.0/24", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0095.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0095.yaml new file mode 100644 index 0000000000..b553db4c86 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0095.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrcontains/cidr contains single ip subnet + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_contains("10.0.0.0/8", "10.1.1.1/32", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0096.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0096.yaml new file mode 100644 index 0000000000..d16fe69b98 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0096.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrcontains/cidr contains subnet ipv6 + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_contains("2001:4860:4860::8888/32", "2001:4860:4860:1234::8888/40", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0097.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0097.yaml new file mode 100644 index 0000000000..b51e8753e2 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0097.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrcontains/cidr contains single ip subnet ipv6 + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_contains("2001:4860:4860::8888/32", "2001:4860:4860:1234:5678:1234:5678:8888/128", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0098.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0098.yaml new file mode 100644 index 0000000000..9e9fe3cd05 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0098.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrcontains/cidr does not contain subnet partial ipv6 + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_contains("2001:4860::/96", "2001:4860::/32", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0099.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0099.yaml new file mode 100644 index 0000000000..e8a8027ee0 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0099.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrcontains/cidr does not contain subnet ipv6 + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_contains("2001:4860::/32", "fd1e:5bfe:8af3:9ddc::/64", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0100.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0100.yaml new file mode 100644 index 0000000000..9ccbdd232d --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0100.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: netcidrcontains/cidr subnet overlap malformed cidr a + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_contains("not-a-cidr", "192.168.1.67", x) + } + want_error_code: eval_builtin_error + want_error: "" + strict_error: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0101.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0101.yaml new file mode 100644 index 0000000000..6ae4fa23ec --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0101.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: netcidrcontains/cidr subnet overlap malformed cidr b + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_contains("192.168.1.0/28", "not-a-cidr", x) + } + want_error_code: eval_builtin_error + want_error: "" + strict_error: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0102.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0102.yaml new file mode 100644 index 0000000000..2639026197 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0102.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrcontains/cidr contains ip + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_contains("10.0.0.0/8", "10.1.2.3", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0103.yaml b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0103.yaml new file mode 100644 index 0000000000..401e225a4d --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontains/test-netcidrcontains-0103.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrcontains/cidr does not contain ip + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_contains("10.0.0.0/8", "192.168.1.1", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml new file mode 100644 index 0000000000..bc827762a3 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0104.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: netcidrcontainsmatches/strings + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + net.cidr_contains_matches("1.1.1.0/24", "1.1.1.1", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - - 1.1.1.0/24 + - 1.1.1.1 diff --git a/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml new file mode 100644 index 0000000000..d0c8b91ff9 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0105.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: netcidrcontainsmatches/arrays + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + net.cidr_contains_matches(["1.1.2.0/24", "1.1.1.0/24"], ["1.1.1.1", "1.1.2.1"], __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - - 0 + - 1 + - - 1 + - 0 diff --git a/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml new file mode 100644 index 0000000000..82ab4012bd --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0106.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: netcidrcontainsmatches/arrays of tuples + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + net.cidr_contains_matches([["1.1.2.0/24", 1], "1.1.1.0/24"], ["1.1.1.1", "1.1.2.1"], __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - - 0 + - 1 + - - 1 + - 0 diff --git a/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml new file mode 100644 index 0000000000..ed6e534fda --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0107.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: netcidrcontainsmatches/bad array + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = data.a[0] + net.cidr_contains_matches(["1.1.2.0/24", "1.1.1.0/24"], ["1.1.1.1", __local2__], __local1__) + __local0__ = __local1__ + } + data: + a: + - 1 + want_error_code: eval_builtin_error + want_error: "net.cidr_contains_matches: operand 2: element must be string or non-empty array" + strict_error: true diff --git a/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml new file mode 100644 index 0000000000..de6268460c --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0108.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: netcidrcontainsmatches/sets of strings + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + net.cidr_contains_matches({"1.1.1.0/24", "1.1.2.0/24"}, {"1.1.1.1", "1.1.2.1"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - - 1.1.1.0/24 + - 1.1.1.1 + - - 1.1.2.0/24 + - 1.1.2.1 + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml new file mode 100644 index 0000000000..e2b994bd94 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0109.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: netcidrcontainsmatches/sets of tuples + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + net.cidr_contains_matches({["1.1.1.0/24", "bar"], ["1.1.2.0/24", "foo"]}, {["1.1.1.1", "baz"], ["1.1.2.1", "qux"]}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - - - 1.1.1.0/24 + - bar + - - 1.1.1.1 + - baz + - - - 1.1.2.0/24 + - foo + - - 1.1.2.1 + - qux diff --git a/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml new file mode 100644 index 0000000000..0a2201c3ce --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0110.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: netcidrcontainsmatches/bad set + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = data.a[0] + net.cidr_contains_matches({["1.1.1.0/24", "bar"], ["1.1.2.0/24", "foo"]}, {__local2__, ["1.1.2.1", "qux"]}, __local1__) + __local0__ = __local1__ + } + data: + a: + - 1 + want_error_code: eval_builtin_error + want_error: "net.cidr_contains_matches: operand 2: element must be string or non-empty array" + strict_error: true diff --git a/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml new file mode 100644 index 0000000000..ecd685db23 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0111.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: netcidrcontainsmatches/bad set tuple element + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + net.cidr_contains_matches({["1.1.1.0/24", "bar"], ["1.1.2.0/24", "foo"]}, {[], ["1.1.2.1", "qux"]}, __local1__) + __local0__ = __local1__ + } + want_error_code: eval_builtin_error + want_error: "net.cidr_contains_matches: operand 2: element must be string or non-empty array" + strict_error: true diff --git a/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml new file mode 100644 index 0000000000..ad01b43c95 --- /dev/null +++ b/test/cases/testdata/v1/netcidrcontainsmatches/test-netcidrcontainsmatches-0112.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: netcidrcontainsmatches/objects + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + net.cidr_contains_matches({"k1": "1.1.1.1/24", "k2": ["1.1.1.2/24", 1]}, "1.1.1.128", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - - k1 + - 1.1.1.128 + - - k2 + - 1.1.1.128 diff --git a/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0113.yaml b/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0113.yaml new file mode 100644 index 0000000000..9c2850078c --- /dev/null +++ b/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0113.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: netcidrexpand/cidr includes host and broadcast + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_expand("192.168.1.1/30", x) + } + want_result: + - x: + - 192.168.1.0 + - 192.168.1.1 + - 192.168.1.2 + - 192.168.1.3 + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0114.yaml b/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0114.yaml new file mode 100644 index 0000000000..b24e633299 --- /dev/null +++ b/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0114.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: netcidrexpand/cidr last octet all 1s + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_expand("172.16.100.255/30", x) + } + data: {} + want_result: + - x: + - 172.16.100.252 + - 172.16.100.253 + - 172.16.100.254 + - 172.16.100.255 diff --git a/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0115.yaml b/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0115.yaml new file mode 100644 index 0000000000..d9a953bff4 --- /dev/null +++ b/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0115.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: netcidrexpand/cidr all bits + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_expand("192.168.1.1/32", x) + } + data: {} + want_result: + - x: + - 192.168.1.1 diff --git a/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0116.yaml b/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0116.yaml new file mode 100644 index 0000000000..7ce6047731 --- /dev/null +++ b/test/cases/testdata/v1/netcidrexpand/test-netcidrexpand-0116.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: netcidrexpand/cidr invalid mask + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_expand("192.168.1.1/33", x) + } + want_error_code: eval_builtin_error + want_error: "net.cidr_expand: invalid CIDR address: 192.168.1.1/33" + strict_error: true diff --git a/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0086.yaml b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0086.yaml new file mode 100644 index 0000000000..c9f2fe76ea --- /dev/null +++ b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0086.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrintersects/cidr subnet overlaps + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_intersects("192.168.1.0/25", "192.168.1.64/25", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0087.yaml b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0087.yaml new file mode 100644 index 0000000000..be0a2c7a7e --- /dev/null +++ b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0087.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrintersects/cidr subnet does not overlap + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_intersects("192.168.1.0/24", "192.168.2.0/24", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0088.yaml b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0088.yaml new file mode 100644 index 0000000000..70d3345caf --- /dev/null +++ b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0088.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrintersects/cidr ipv6 subnet overlaps + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_intersects("fd1e:5bfe:8af3:9ddc::/64", "fd1e:5bfe:8af3:9ddc:1111::/72", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0089.yaml b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0089.yaml new file mode 100644 index 0000000000..774a4b708c --- /dev/null +++ b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0089.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: netcidrintersects/cidr ipv6 subnet does not overlap + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + net.cidr_intersects("fd1e:5bfe:8af3:9ddc::/64", "2001:4860:4860::8888/32", x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0090.yaml b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0090.yaml new file mode 100644 index 0000000000..d6836346bd --- /dev/null +++ b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0090.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: netcidrintersects/cidr subnet overlap malformed cidr a + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_intersects("not-a-cidr", "192.168.1.0/24", x) + } + want_error_code: eval_builtin_error + want_error: "" + strict_error: true diff --git a/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0091.yaml b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0091.yaml new file mode 100644 index 0000000000..56d3eaea10 --- /dev/null +++ b/test/cases/testdata/v1/netcidrintersects/test-netcidrintersects-0091.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: netcidrintersects/cidr subnet overlap malformed cidr b + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_intersects("192.168.1.0/28", "not-a-cidr", x) + } + want_error_code: eval_builtin_error + want_error: "" + strict_error: true diff --git a/test/cases/testdata/v1/netcidrisvalid/test_netcidrisvalid-0001.yaml b/test/cases/testdata/v1/netcidrisvalid/test_netcidrisvalid-0001.yaml new file mode 100644 index 0000000000..a031ce8161 --- /dev/null +++ b/test/cases/testdata/v1/netcidrisvalid/test_netcidrisvalid-0001.yaml @@ -0,0 +1,67 @@ +--- +cases: + - note: valid ipv4 cidr + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_is_valid("192.168.1.0/24", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: true + - note: empty cidr + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_is_valid("", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: false + - note: random string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_is_valid("there goes a string", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: false + - note: valid ipv4 address + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_is_valid("192.168.1.2", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: false + - note: valid ipv6 cidr + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + net.cidr_is_valid("2002::1234:abcd:ffff:c0a8:101/64", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/netcidrmerge/test-ipv6-with-and-without-prefix.yaml b/test/cases/testdata/v1/netcidrmerge/test-ipv6-with-and-without-prefix.yaml new file mode 100644 index 0000000000..08701f3826 --- /dev/null +++ b/test/cases/testdata/v1/netcidrmerge/test-ipv6-with-and-without-prefix.yaml @@ -0,0 +1,60 @@ +--- +cases: + - note: netcidrmerge/cidr ipv6 with prefix + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["2601:600:8a80:207e:a57d:7567:e2c9:e7b3/128"], x) + } + want_result: + - x: + - 2601:600:8a80:207e:a57d:7567:e2c9:e7b3/128 + - note: netcidrmerge/cidr ipv6 with prefix, same twice + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["2601:600:8a80:207e:a57d:7567:e2c9:e7b3/128", "2601:600:8a80:207e:a57d:7567:e2c9:e7b3/128"], x) + } + want_result: + - x: + - 2601:600:8a80:207e:a57d:7567:e2c9:e7b3/128 + - note: netcidrmerge/cidr ipv6 with prefix, two different prefixes + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["2601:600:8a80:207e:a57d:7567:e2c9:e7b3/64", "2601:600:8a80:207e:a57d:7567:e2c9:e7b3/128"], x) + } + want_result: + - x: + - 2601:600:8a80:207e::/64 + - note: netcidrmerge/cidr ipv6 without prefix + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["2601:600:8a80:207e:a57d:7567:e2c9:e7b3"], x) + } + want_error: "eval_builtin_error: net.cidr_merge: IPv6 invalid: needs prefix length" + strict_error: true + - note: netcidrmerge/cidr ipv6 without prefix, same twice + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["2601:600:8a80:207e:a57d:7567:e2c9:e7b3", "2601:600:8a80:207e:a57d:7567:e2c9:e7b3"], x) + } + want_error: "eval_builtin_error: net.cidr_merge: IPv6 invalid: needs prefix length" + strict_error: true diff --git a/test/cases/testdata/v1/netcidrmerge/test-netcidrmerge0117.yaml b/test/cases/testdata/v1/netcidrmerge/test-netcidrmerge0117.yaml new file mode 100644 index 0000000000..242e6afe4d --- /dev/null +++ b/test/cases/testdata/v1/netcidrmerge/test-netcidrmerge0117.yaml @@ -0,0 +1,214 @@ +--- +cases: + - note: netcidrmerge/cidr single subnet + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.128.0/24"], x) + } + want_result: + - x: + - 192.0.128.0/24 + - note: netcidrmerge/cidr duplicate + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.128.0/24", "192.0.128.0/24"], x) + } + want_result: + - x: + - 192.0.128.0/24 + - note: netcidrmerge/cidr IPv4 zero address + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.128.0/24", "0.0.0.0/0"], x) + } + want_result: + - x: + - 0.0.0.0/0 + - note: netcidrmerge/cidr merge subnets case 1 + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.128.0/24", "192.0.129.0/24"], x) + } + want_result: + - x: + - 192.0.128.0/23 + - note: netcidrmerge/cidr merge subnets case 2 + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.2.112/30", "192.0.2.116/31", "192.0.2.118/31"], x) + } + want_result: + - x: + - 192.0.2.112/29 + - note: netcidrmerge/cidr no overlap case 1 + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.129.0/24", "192.0.130.0/24"], x) + } + want_result: + - x: + - 192.0.129.0/24 + - 192.0.130.0/24 + - note: netcidrmerge/cidr no overlap case 2 + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.2.112/30", "192.0.2.116/32", "192.0.2.118/31"], x) + } + want_result: + - x: + - 192.0.2.112/30 + - 192.0.2.116/32 + - 192.0.2.118/31 + sort_bindings: true + - note: netcidrmerge/cidr mix case 1 + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.2.112/31", "192.0.2.116/31", "192.0.2.118/31"], x) + } + want_result: + - x: + - 192.0.2.112/31 + - 192.0.2.116/30 + - note: netcidrmerge/cidr mix case 2 + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.1.254/31", "192.0.2.0/28", "192.0.2.16/28", "192.0.2.32/28", "192.0.2.48/28", "192.0.2.64/28", "192.0.2.80/28", "192.0.2.96/28", "192.0.2.112/28", "192.0.2.128/28", "192.0.2.144/28", "192.0.2.160/28", "192.0.2.176/28", "192.0.2.192/28", "192.0.2.208/28", "192.0.2.224/28", "192.0.2.240/28", "192.0.3.0/28"], x) + } + want_result: + - x: + - 192.0.1.254/31 + - 192.0.2.0/24 + - 192.0.3.0/28 + - note: netcidrmerge/cidr IPv6 zero address case 1 + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["::/0", "fe80::1/128"], x) + } + want_result: + - x: + - ::/0 + - note: netcidrmerge/cidr IPv6 zero address case 2 + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["::/0", "::192.0.2.0/124", "ff00::101/128"], x) + } + want_result: + - x: + - ::/0 + - note: netcidrmerge/cidr IPv4 and IPv6 + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["fe80::/120", "192.0.2.0/24", "192.0.3.0/24", "192.0.4.0/25", "192.0.4.128/25"], x) + } + want_result: + - x: + - 192.0.2.0/23 + - 192.0.4.0/24 + - fe80::/120 + sort_bindings: true + - note: netcidrmerge/cidr empty + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge([], x) + } + want_result: + - x: [] + - note: netcidrmerge/cidr merge ip and subnets + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.2.112", "192.0.2.116/31", "192.0.2.118/31"], x) + } + want_result: + - x: + - 192.0.2.0/24 + - note: netcidrmerge/cidr merge ip addresses + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["192.0.128.0", "192.0.129.0"], x) + } + want_result: + - x: + - 192.0.128.0/23 + - note: netcidrmerge/cidr merge subnets set + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge({"192.0.2.112/30", "192.0.2.116/31", "192.0.2.118/31"}, x) + } + want_result: + - x: + - 192.0.2.112/29 + - note: netcidrmerge/cidr invalid IP + query: data.test.p = x + modules: + - | + package test + + p := x if { + net.cidr_merge(["foo"], x) + } + want_error_code: eval_builtin_error + strict_error: true diff --git a/test/cases/testdata/v1/netlookupipaddr/test-netlookupipaddr.yaml b/test/cases/testdata/v1/netlookupipaddr/test-netlookupipaddr.yaml new file mode 100644 index 0000000000..5001662993 --- /dev/null +++ b/test/cases/testdata/v1/netlookupipaddr/test-netlookupipaddr.yaml @@ -0,0 +1,46 @@ +--- +cases: + - note: net.lookup_ip_addr/simple ip4 returns that ip4 + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := net.lookup_ip_addr("10.0.0.0") + } + want_result: + - x: + - 10.0.0.0 + - note: net.lookup_ip_addr/simple ip6 returns that ip6 + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := net.lookup_ip_addr("::") + } + want_result: + - x: + - "::" + - note: net.lookup_ip_addr/localhost + query: data.test.p = x + modules: + - | + package test + + # one of these should be the case on any system + p if { + net.lookup_ip_addr("localhost") == {"127.0.0.1"} + } + + p if { + net.lookup_ip_addr("localhost") == {"127.0.0.1", "::1"} + } + + p if { + net.lookup_ip_addr("localhost") == {"::1"} + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/numbersrange/test-numbersrange-0256.yaml b/test/cases/testdata/v1/numbersrange/test-numbersrange-0256.yaml new file mode 100644 index 0000000000..e9d5a85507 --- /dev/null +++ b/test/cases/testdata/v1/numbersrange/test-numbersrange-0256.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: numbersrange/one + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + numbers.range(0, 0, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 0 diff --git a/test/cases/testdata/v1/numbersrange/test-numbersrange-0257.yaml b/test/cases/testdata/v1/numbersrange/test-numbersrange-0257.yaml new file mode 100644 index 0000000000..c27a6ca6c0 --- /dev/null +++ b/test/cases/testdata/v1/numbersrange/test-numbersrange-0257.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: numbersrange/ascending + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + numbers.range(-2, 3, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - -2 + - -1 + - 0 + - 1 + - 2 + - 3 diff --git a/test/cases/testdata/v1/numbersrange/test-numbersrange-0258.yaml b/test/cases/testdata/v1/numbersrange/test-numbersrange-0258.yaml new file mode 100644 index 0000000000..65f480ff25 --- /dev/null +++ b/test/cases/testdata/v1/numbersrange/test-numbersrange-0258.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: numbersrange/descending + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + numbers.range(2, -3, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - 2 + - 1 + - 0 + - -1 + - -2 + - -3 diff --git a/test/cases/testdata/v1/numbersrange/test-numbersrange-0259.yaml b/test/cases/testdata/v1/numbersrange/test-numbersrange-0259.yaml new file mode 100644 index 0000000000..edffc64bbd --- /dev/null +++ b/test/cases/testdata/v1/numbersrange/test-numbersrange-0259.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: numbersrange/precision + query: data.generated.p = x + modules: + - | + package generated + + p if { + numbers.range(49649733057, 49649733060, [49649733057, 49649733058, 49649733059, 49649733060]) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/numbersrange/test-numbersrange-0260.yaml b/test/cases/testdata/v1/numbersrange/test-numbersrange-0260.yaml new file mode 100644 index 0000000000..279c299c17 --- /dev/null +++ b/test/cases/testdata/v1/numbersrange/test-numbersrange-0260.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "numbersrange/error: floating-point number pos 1" + query: data.generated.p = x + modules: + - | + package generated + + p if { + numbers.range(3.14, 4) + } + want_error_code: eval_type_error + want_error: "numbers.range: operand 1 must be integer number but got floating-point number" + strict_error: true diff --git a/test/cases/testdata/v1/numbersrange/test-numbersrange-0261.yaml b/test/cases/testdata/v1/numbersrange/test-numbersrange-0261.yaml new file mode 100644 index 0000000000..d97a3b48ca --- /dev/null +++ b/test/cases/testdata/v1/numbersrange/test-numbersrange-0261.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "numbersrange/error: floating-point number pos 2" + query: data.generated.p = x + modules: + - | + package generated + + p if { + numbers.range(3, 3.14) + } + want_error_code: eval_type_error + want_error: "numbers.range: operand 2 must be integer number but got floating-point number" + strict_error: true diff --git a/test/cases/testdata/v1/numbersrangestep/test-numbersrangestep.yaml b/test/cases/testdata/v1/numbersrangestep/test-numbersrangestep.yaml new file mode 100644 index 0000000000..92d922f08a --- /dev/null +++ b/test/cases/testdata/v1/numbersrangestep/test-numbersrangestep.yaml @@ -0,0 +1,88 @@ +--- +cases: + - note: numbersrangestep/ascending + query: data.test.p = x + modules: + - | + package test + + p := num if { + num := numbers.range_step(0, 10, 2) + } + want_result: + - x: + - 0 + - 2 + - 4 + - 6 + - 8 + - 10 + - note: numbersrangestep/descending + query: data.test.p = x + modules: + - | + package test + + p := num if { + num := numbers.range_step(0, -10, 2) + } + want_result: + - x: + - 0 + - -2 + - -4 + - -6 + - -8 + - -10 + - note: numbersrangestep/negative + query: data.test.p = x + modules: + - | + package test + + p := num if { + num := numbers.range_step(0, 10, -2) + } + want_error_code: eval_builtin_error + want_error: "numbers.range_step: step must be a positive number above zero" + strict_error: true + - note: numbersrangestep/memoryexample + query: data.test.p = x + modules: + - | + package test + + p := num if { + num := numbers.range_step(1024, 4096, 1024) + } + want_result: + - x: + - 1024 + - 2048 + - 3072 + - 4096 + - note: numbersrangestep/equal + query: data.test.p = x + modules: + - | + package test + + p := num if { + num := numbers.range_step(2, 2, 2) + } + want_result: + - x: + - 2 + - note: numbersrangestep/notinrange + query: data.test.p = x + modules: + - | + package test + + p := num if { + num := numbers.range_step(2, 5, 2) + } + want_result: + - x: + - 2 + - 4 diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0300.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0300.yaml new file mode 100644 index 0000000000..91a47851da --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0300.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: objectfilter/base + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.filter({"a": {"b": {"c": 7, "d": 8}}, "e": 9}, {"a"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 7 + d: 8 diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0301.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0301.yaml new file mode 100644 index 0000000000..6d4cf072bd --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0301.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/multiple roots set + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.filter({"a": 1, "b": 2, "c": 3, "e": 9}, {"a", "e"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 + e: 9 diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0302.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0302.yaml new file mode 100644 index 0000000000..ce6eac427f --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0302.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/multiple roots array + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.filter({"a": 1, "b": 2, "c": 3, "e": 9}, ["a", "e"], __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 + e: 9 diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0303.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0303.yaml new file mode 100644 index 0000000000..95a302c4b3 --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0303.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/multiple roots object + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.filter({"a": 1, "b": 2, "c": 3, "e": 9}, {"a": "foo", "e": ""}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 + e: 9 diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0304.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0304.yaml new file mode 100644 index 0000000000..5f59992ba9 --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0304.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: objectfilter/duplicate roots + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.filter({"a": {"b": {"c": 7, "d": 8}}, "e": 9}, {"a"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 7 + d: 8 diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0305.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0305.yaml new file mode 100644 index 0000000000..c7d3c2b321 --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0305.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectfilter/empty roots set + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.filter({"a": 7}, set(), __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0306.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0306.yaml new file mode 100644 index 0000000000..42c46eff3e --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0306.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectfilter/empty roots array + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.filter({"a": 7}, [], __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0307.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0307.yaml new file mode 100644 index 0000000000..7b41791789 --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0307.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectfilter/empty roots object + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.filter({"a": 7}, {}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0308.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0308.yaml new file mode 100644 index 0000000000..a7d050c236 --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0308.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectfilter/empty object + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.filter({}, {"a"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0309.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0309.yaml new file mode 100644 index 0000000000..40f558566c --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0309.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/error invalid object param type array input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.filter(__local2__, {"a"}, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": ["a"]}' + want_error_code: eval_type_error + want_error: "object.filter: operand 1 must be object but got array" + strict_error: true diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0310.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0310.yaml new file mode 100644 index 0000000000..a7cd45449f --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0310.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/error invalid object param type bool input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.filter(__local2__, {"a"}, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": false}' + want_error_code: eval_type_error + want_error: "object.filter: operand 1 must be object but got boolean" + strict_error: true diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0311.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0311.yaml new file mode 100644 index 0000000000..5d5825c80e --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0311.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/error invalid object param type number input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.filter(__local2__, {"a"}, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": 123}' + want_error_code: eval_type_error + want_error: "object.filter: operand 1 must be object but got number" + strict_error: true diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0312.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0312.yaml new file mode 100644 index 0000000000..37d3b51205 --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0312.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/error invalid object param type string input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.filter(__local2__, {"a"}, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": "foo"}' + want_error_code: eval_type_error + want_error: "object.filter: operand 1 must be object but got string" + strict_error: true diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0313.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0313.yaml new file mode 100644 index 0000000000..47c7034efe --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0313.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/error invalid object param type nil input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.filter(__local2__, {"a"}, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": null}' + want_error_code: eval_type_error + want_error: "object.filter: operand 1 must be object but got null" + strict_error: true diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0314.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0314.yaml new file mode 100644 index 0000000000..3df1ae7833 --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0314.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/error invalid key param type string input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.filter({"a": 1}, __local2__, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": "foo"}' + want_error_code: eval_type_error + want_error: "object.filter: operand 2 must be one of {object, set, array} but got string" + strict_error: true diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0315.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0315.yaml new file mode 100644 index 0000000000..a03937f4e3 --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0315.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/error invalid key param type boolean input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.filter({"a": 1}, __local2__, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": true}' + want_error_code: eval_type_error + want_error: "object.filter: operand 2 must be one of {object, set, array} but got boolean" + strict_error: true diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0316.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0316.yaml new file mode 100644 index 0000000000..06a776bc0e --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0316.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/error invalid key param type number input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.filter({"a": 1}, __local2__, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": 22}' + want_error_code: eval_type_error + want_error: "object.filter: operand 2 must be one of {object, set, array} but got number" + strict_error: true diff --git a/test/cases/testdata/v1/objectfilter/test-objectfilter-0317.yaml b/test/cases/testdata/v1/objectfilter/test-objectfilter-0317.yaml new file mode 100644 index 0000000000..bf790a6eab --- /dev/null +++ b/test/cases/testdata/v1/objectfilter/test-objectfilter-0317.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectfilter/error invalid key param type nil input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.filter({"a": 1}, __local2__, __local1__) + __local0__ = __local1__ + } + input_term: '{"x": null}' + want_error_code: eval_type_error + want_error: "object.filter: operand 2 must be one of {object, set, array} but got null" + strict_error: true diff --git a/test/cases/testdata/v1/objectfilteridempotent/test-objectfilteridempotent-0319.yaml b/test/cases/testdata/v1/objectfilteridempotent/test-objectfilteridempotent-0319.yaml new file mode 100644 index 0000000000..b835a26ac5 --- /dev/null +++ b/test/cases/testdata/v1/objectfilteridempotent/test-objectfilteridempotent-0319.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: objectfilteridempotent/TestBuiltinObjectFilterIdempotent + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = {"a": 1, "b": 2, "c": 3} + object.filter(__local0__, {"a"}, __local1__) + __local1__ = {"a": 1} + object.filter(__local0__, {"b"}, __local2__) + __local2__ = {"b": 2} + object.filter(__local0__, {"c"}, __local3__) + __local3__ = {"c": 3} + __local0__ = {"a": 1, "b": 2, "c": 3} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml b/test/cases/testdata/v1/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml new file mode 100644 index 0000000000..ee6a5f921d --- /dev/null +++ b/test/cases/testdata/v1/objectfilternonstringkey/test-objectfilternonstringkey-0318.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: objectfilternonstringkey/non string root + query: data.generated.p = x + modules: + - | + package generated + + p if { + object.filter({"a": 1, [[7]]: 2}, {[[7]]}, __local1__) + __local0__ = __local1__ + __local0__ = {[[7]]: 2} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/objectget/test-objectget-0262.yaml b/test/cases/testdata/v1/objectget/test-objectget-0262.yaml new file mode 100644 index 0000000000..3869e62a0d --- /dev/null +++ b/test/cases/testdata/v1/objectget/test-objectget-0262.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectget/basic case . found + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.get({"a": "b"}, "a", "c", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: b diff --git a/test/cases/testdata/v1/objectget/test-objectget-0263.yaml b/test/cases/testdata/v1/objectget/test-objectget-0263.yaml new file mode 100644 index 0000000000..13b13bd0f5 --- /dev/null +++ b/test/cases/testdata/v1/objectget/test-objectget-0263.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectget/basic case . not found + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.get({"a": "b"}, "c", "c", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: c diff --git a/test/cases/testdata/v1/objectget/test-objectget-0264.yaml b/test/cases/testdata/v1/objectget/test-objectget-0264.yaml new file mode 100644 index 0000000000..88baa9958e --- /dev/null +++ b/test/cases/testdata/v1/objectget/test-objectget-0264.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectget/integer key found + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.get({1: 2}, 1, 3, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: 2 diff --git a/test/cases/testdata/v1/objectget/test-objectget-0265.yaml b/test/cases/testdata/v1/objectget/test-objectget-0265.yaml new file mode 100644 index 0000000000..4b55030ffd --- /dev/null +++ b/test/cases/testdata/v1/objectget/test-objectget-0265.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectget/integer key . not found + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.get({1: 2}, 2, 3, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: 3 diff --git a/test/cases/testdata/v1/objectget/test-objectget-0266.yaml b/test/cases/testdata/v1/objectget/test-objectget-0266.yaml new file mode 100644 index 0000000000..b2b16b2129 --- /dev/null +++ b/test/cases/testdata/v1/objectget/test-objectget-0266.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: objectget/complex value . found + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.get({"a": {"b": "c"}}, "a", true, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + b: c diff --git a/test/cases/testdata/v1/objectget/test-objectget-0267.yaml b/test/cases/testdata/v1/objectget/test-objectget-0267.yaml new file mode 100644 index 0000000000..9fc05f39ad --- /dev/null +++ b/test/cases/testdata/v1/objectget/test-objectget-0267.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectget/complex value . not found + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.get({"a": {"b": "c"}}, "b", true, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/objectget/test-objectget-path.yaml b/test/cases/testdata/v1/objectget/test-objectget-path.yaml new file mode 100644 index 0000000000..27e0ef5430 --- /dev/null +++ b/test/cases/testdata/v1/objectget/test-objectget-path.yaml @@ -0,0 +1,126 @@ +--- +cases: + - note: objectget/empty_path_returns_object + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get({"a": 1}, [], 2) + } + want_result: + - x: + a: 1 + - note: objectget/path_with_single_element + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get({"a": 1}, ["a"], 2) + } + want_result: + - x: 1 + - note: objectget/path_with_two_elements + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get({"a": {"b": 1}}, ["a", "b"], 2) + } + want_result: + - x: 1 + - note: objectget/path_with_three_elements + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get({"a": {"b": {"c": 1}}}, ["a", "b", "c"], 2) + } + want_result: + - x: 1 + - note: objectget/path_with_single_element_no_result + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get({"a": 1}, ["b"], 2) + } + want_result: + - x: 2 + - note: objectget/path_with_two_elements_no_result + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get({"a": {"b": 1}}, ["b", "a"], 2) + } + want_result: + - x: 2 + - note: objectget/path_with_three_elements_no_result + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get({"a": {"b": {"c": 1}}}, ["a", "b", "a"], 2) + } + want_result: + - x: 2 + - note: objectget/path_with_non_string_keys + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get({1: {"b": {[1, 2, 3]: 1}}}, [1, "b", [1, 2, 3]], 2) + } + want_result: + - x: 1 + - note: objectget/get_intermediate_non_object + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get({"a": {"b": [1, 2, 3]}}, ["a", "b", "a"], 2) + } + want_result: + - x: 2 + - note: objectget/get_intermediate_array + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get({"a": {"b": [{"c": 1}]}}, ["a", "b", 0, "c"], 2) + } + want_result: + - x: 1 + - note: objectget/get_for_non_object + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := object.get(input.obj, ["a"], 2) + } + input_term: '{"obj":"object"}' + want_error_code: eval_type_error + want_error: "object.get: operand 1 must be object but got string" + strict_error: true diff --git a/test/cases/testdata/v1/objectkeys/test-objectkeys.yaml b/test/cases/testdata/v1/objectkeys/test-objectkeys.yaml new file mode 100644 index 0000000000..6d3c65d3c3 --- /dev/null +++ b/test/cases/testdata/v1/objectkeys/test-objectkeys.yaml @@ -0,0 +1,77 @@ +--- +cases: + - note: objectkeys/string_keys_found + query: data.test.p = x + modules: + - | + package test + + p := object.keys({"a": 1, "b": 2}) + want_result: + - x: + - a + - b + - note: objectkeys/number_keys_found + query: data.test.p = x + modules: + - | + package test + + p := object.keys({1: 1, 2: 2}) + want_result: + - x: + - 1 + - 2 + - note: objectkeys/object_keys_found + query: data.test.p = x + modules: + - | + package test + + p := object.keys({{"a": 1}: 1, {"b": 2}: 2}) + want_result: + - x: + - a: 1 + - b: 2 + - note: objectkeys/set_keys_found + query: data.test.p = x + modules: + - | + package test + + p := object.keys({{"a"}: 1, {"b"}: 2}) + want_result: + - x: + - - a + - - b + - note: objectkeys/array_keys_found + query: data.test.p = x + modules: + - | + package test + + p := object.keys({["a"]: 1, ["b"]: 2}) + want_result: + - x: + - - a + - - b + - note: objectkeys/empty_result + query: data.test.p = x + modules: + - | + package test + + p := object.keys({}) + want_result: + - x: [] + - note: objectkeys/error_on_non_object + query: data.test.p = x + modules: + - | + package test + + p := object.keys(input.obj) + input_term: '{"obj":"object"}' + want_error_code: eval_type_error + want_error: "object.keys: operand 1 must be object but got string" + strict_error: true diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0279.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0279.yaml new file mode 100644 index 0000000000..eebee73e0e --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0279.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectremove/base + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.remove({"a": 1, "b": {"c": 3}}, {"a"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + b: + c: 3 diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0280.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0280.yaml new file mode 100644 index 0000000000..3f1704f27d --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0280.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: objectremove/multiple keys set + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.remove({"a": 1, "b": {"c": 3}, "d": 4}, {"b", "d"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0281.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0281.yaml new file mode 100644 index 0000000000..c3f89f0ec2 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0281.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: objectremove/multiple keys array + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.remove({"a": 1, "b": {"c": 3}, "d": 4}, ["d", "b"], __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0282.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0282.yaml new file mode 100644 index 0000000000..a9fa6557c3 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0282.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: objectremove/multiple keys object + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.remove({"a": 1, "b": {"c": 3}, "d": 4}, {"b": 1, "d": ""}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0283.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0283.yaml new file mode 100644 index 0000000000..2d9047ffed --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0283.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: objectremove/multiple keys object nested + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.remove({"a": {"b": {"c": 2}}, "x": 123}, {"a": {"b": {"foo": "bar"}}}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + x: 123 diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0284.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0284.yaml new file mode 100644 index 0000000000..5f19b69d49 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0284.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectremove/empty object + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.remove({}, {"a", "b"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0285.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0285.yaml new file mode 100644 index 0000000000..87745acaee --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0285.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/empty keys set + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.remove({"a": 1, "b": {"c": 3}}, set(), __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 + b: + c: 3 diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0286.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0286.yaml new file mode 100644 index 0000000000..53ee22afd4 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0286.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/empty keys array + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.remove({"a": 1, "b": {"c": 3}}, [], __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 + b: + c: 3 diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0287.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0287.yaml new file mode 100644 index 0000000000..066f2215a2 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0287.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/empty keys obj + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.remove({"a": 1, "b": {"c": 3}}, {}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 + b: + c: 3 diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0288.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0288.yaml new file mode 100644 index 0000000000..5416527902 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0288.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/key doesnt exist + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.remove({"a": 1, "b": {"c": 3}}, {"z"}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 + b: + c: 3 diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0289.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0289.yaml new file mode 100644 index 0000000000..ac14e8fcf6 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0289.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/error invalid object param type array input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.remove(__local2__, {"a"}, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": ["a"]}' + want_error_code: eval_type_error + want_error: "object.remove: operand 1 must be object but got array" + strict_error: true diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0290.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0290.yaml new file mode 100644 index 0000000000..288147a7ac --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0290.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/error invalid object param type bool input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.remove(__local2__, {"a"}, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": false}' + want_error_code: eval_type_error + want_error: "object.remove: operand 1 must be object but got boolean" + strict_error: true diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0291.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0291.yaml new file mode 100644 index 0000000000..bd53059164 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0291.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/error invalid object param type number input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.remove(__local2__, {"a"}, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": 123}' + want_error_code: eval_type_error + want_error: "object.remove: operand 1 must be object but got number" + strict_error: true diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0292.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0292.yaml new file mode 100644 index 0000000000..cbecf44444 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0292.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/error invalid object param type string input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.remove(__local2__, {"a"}, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": "foo"}' + want_error_code: eval_type_error + want_error: "object.remove: operand 1 must be object but got string" + strict_error: true diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0293.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0293.yaml new file mode 100644 index 0000000000..12bf8f35ee --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0293.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/error invalid object param type nil input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.remove(__local2__, {"a"}, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": null}' + want_error_code: eval_type_error + want_error: "object.remove: operand 1 must be object but got null" + strict_error: true diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0294.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0294.yaml new file mode 100644 index 0000000000..d8a0351749 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0294.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/error invalid key param type string input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.remove({"a": 1}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": "foo"}' + want_error_code: eval_type_error + want_error: "object.remove: operand 2 must be one of {object, set, array} but got string" + strict_error: true diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0295.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0295.yaml new file mode 100644 index 0000000000..fdf7ae13fe --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0295.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/error invalid key param type boolean input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.remove({"a": 1}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": true}' + want_error_code: eval_type_error + want_error: "object.remove: operand 2 must be one of {object, set, array} but got boolean" + strict_error: true diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0296.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0296.yaml new file mode 100644 index 0000000000..8ac4f70e35 --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0296.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/error invalid key param type number input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.remove({"a": 1}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": 22}' + want_error_code: eval_type_error + want_error: "object.remove: operand 2 must be one of {object, set, array} but got number" + strict_error: true diff --git a/test/cases/testdata/v1/objectremove/test-objectremove-0297.yaml b/test/cases/testdata/v1/objectremove/test-objectremove-0297.yaml new file mode 100644 index 0000000000..18f2da266b --- /dev/null +++ b/test/cases/testdata/v1/objectremove/test-objectremove-0297.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectremove/error invalid key param type nil input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.x + object.remove({"a": 1}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"x": null}' + want_error_code: eval_type_error + want_error: "object.remove: operand 2 must be one of {object, set, array} but got null" + strict_error: true diff --git a/test/cases/testdata/v1/objectremoveidempotent/test-objectremoveidempotent-0298.yaml b/test/cases/testdata/v1/objectremoveidempotent/test-objectremoveidempotent-0298.yaml new file mode 100644 index 0000000000..1ff19ea3d7 --- /dev/null +++ b/test/cases/testdata/v1/objectremoveidempotent/test-objectremoveidempotent-0298.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: objectremoveidempotent/TestBuiltinObjectRemoveIdempotent + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = {"a": 1, "b": 2, "c": 3} + object.remove(__local0__, {"a"}, __local1__) + __local1__ = {"b": 2, "c": 3} + object.remove(__local0__, {"b"}, __local2__) + __local2__ = {"a": 1, "c": 3} + object.remove(__local0__, {"c"}, __local3__) + __local3__ = {"a": 1, "b": 2} + __local0__ = {"a": 1, "b": 2, "c": 3} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml b/test/cases/testdata/v1/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml new file mode 100644 index 0000000000..833c457053 --- /dev/null +++ b/test/cases/testdata/v1/objectremovenonstringkey/test-objectremovenonstringkey-0299.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: objectremovenonstringkey/non string root + query: data.generated.p = x + modules: + - | + package generated + + p if { + object.remove({"a": 1, [[7]]: 2}, {[[7]]}, __local1__) + __local0__ = __local1__ + __local0__ = {"a": 1} + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0268.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0268.yaml new file mode 100644 index 0000000000..dc815e1857 --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0268.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: objectunion/both empty + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.union({}, {}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: {} diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0269.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0269.yaml new file mode 100644 index 0000000000..ee45d1fad2 --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0269.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: objectunion/left empty + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.union({}, {"a": 1}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0270.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0270.yaml new file mode 100644 index 0000000000..2a34805cb1 --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0270.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: objectunion/right empty + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.union({"a": 1}, {}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0271.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0271.yaml new file mode 100644 index 0000000000..9d031d5352 --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0271.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: objectunion/base + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.union({"a": 1}, {"b": 2}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 1 + b: 2 diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0272.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0272.yaml new file mode 100644 index 0000000000..2a751078e2 --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0272.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: objectunion/nested + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.union({"a": {"b": {"c": 1}}}, {"b": 2}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 1 + b: 2 diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0273.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0273.yaml new file mode 100644 index 0000000000..bb87dd0515 --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0273.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: objectunion/nested reverse + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.union({"b": 2}, {"a": {"b": {"c": 1}}}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 1 + b: 2 diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0274.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0274.yaml new file mode 100644 index 0000000000..3b6177f707 --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0274.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: objectunion/conflict simple + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.union({"a": 1}, {"a": 2}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: 2 diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0275.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0275.yaml new file mode 100644 index 0000000000..774928abbe --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0275.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: objectunion/conflict nested and extra field + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.union({"a": 1}, {"a": {"b": {"c": 1}}, "d": 7}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: + c: 1 + d: 7 diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0276.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0276.yaml new file mode 100644 index 0000000000..e4fa7ef5d8 --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0276.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: objectunion/conflict multiple + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + object.union({"a": {"b": {"c": 1}}, "e": 1}, {"a": {"b": "foo", "b1": "bar"}, "d": 7, "e": 17}, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + a: + b: foo + b1: bar + d: 7 + e: 17 diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0277.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0277.yaml new file mode 100644 index 0000000000..430fc69886 --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0277.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectunion/error wrong lhs type input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.a + object.union(__local2__, {"b": 2}, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"a": [1, 2, 3]}' + want_error_code: eval_type_error + want_error: "object.union: operand 1 must be object but got array" + strict_error: true diff --git a/test/cases/testdata/v1/objectunion/test-objectunion-0278.yaml b/test/cases/testdata/v1/objectunion/test-objectunion-0278.yaml new file mode 100644 index 0000000000..661bb80699 --- /dev/null +++ b/test/cases/testdata/v1/objectunion/test-objectunion-0278.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: objectunion/error wrong rhs type input + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.b + object.union({"a": 1}, __local2__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"b": [1, 2, 3]}' + want_error_code: eval_type_error + want_error: "object.union: operand 2 must be object but got array" + strict_error: true diff --git a/test/cases/testdata/v1/objectunionn/test-objectunionn-0001.yaml b/test/cases/testdata/v1/objectunionn/test-objectunionn-0001.yaml new file mode 100644 index 0000000000..5de72493cc --- /dev/null +++ b/test/cases/testdata/v1/objectunionn/test-objectunionn-0001.yaml @@ -0,0 +1,83 @@ +--- +cases: + - note: objectunionn/empty array + query: data.test.p = x + modules: + - | + package test + + p := object.union_n([{}]) + want_result: + - x: {} + - note: objectunionn/single item array + query: data.test.p = x + modules: + - | + package test + + p := object.union_n([{"foo": "bar"}]) + want_result: + - x: + foo: bar + - note: objectunionn/merge objects + query: data.test.x = x + modules: + - | + package test + + x := object.union_n([{"foo": "bar"}, {"x": "y"}]) + want_result: + - x: + foo: bar + x: "y" + - note: objectunionn/merge objects conflict + query: data.test.x = x + modules: + - | + package test + + x := object.union_n([{"foo": "bar"}, {"foo": "baz"}]) + want_result: + - x: + foo: baz + - note: objectunionn/merge objects extended + query: data.test.x = x + modules: + - | + package test + + x := object.union_n([ + { + "a": 1, + "b": 2, + "c": 3, + }, + { + "foo": "baz", + "a": "a", + "b": 2, + "d": 4, + }, + { + "a": "final A!", + "e": 5.0, + }, + ]) + want_result: + - x: + a: final A! + b: 2 + c: 3 + d: 4 + e: 5 + foo: baz + - note: "# 5073 regression test" + query: data.test.x = x + modules: + - | + package test + + x := object.union_n(input) + input_term: '[{"foo": 1}, {"bar": 2}, "baz"]' + want_error_code: eval_type_error + strict_error: true diff --git a/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0984.yaml b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0984.yaml new file mode 100644 index 0000000000..ddc7269194 --- /dev/null +++ b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0984.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: partialdocconstants/obj-1 + query: data.ex.foo.bar = x + modules: + - | + package ex + + foo["bar"] := 0 + + foo["baz"] := 1 + + foo["*"] := [1, 2, 3] if { + input.foo = 7 + } + + bar contains "x" + + bar contains "y" + + bar contains "*" if { + input.foo = 7 + } + data: {} + want_result: + - x: 0 diff --git a/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0985.yaml b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0985.yaml new file mode 100644 index 0000000000..7e12a24b53 --- /dev/null +++ b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0985.yaml @@ -0,0 +1,34 @@ +--- +cases: + - note: partialdocconstants/obj + query: data.ex.foo = x + modules: + - | + package ex + + foo["bar"] := 0 + + foo["baz"] := 1 + + foo["*"] := [1, 2, 3] if { + input.foo = 7 + } + + bar contains "x" + + bar contains "y" + + bar contains "*" if { + input.foo = 7 + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = 0 + } + data: {} + want_result: + - x: + bar: 0 + baz: 1 diff --git a/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0986.yaml b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0986.yaml new file mode 100644 index 0000000000..a0354cfde6 --- /dev/null +++ b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0986.yaml @@ -0,0 +1,49 @@ +--- +cases: + - note: partialdocconstants/obj-all + query: data.ex.foo = x + modules: + - | + package partial.ex + + foo["bar"] := 0 + + foo["baz"] := 1 + + foo["*"] := [1, 2, 3] if { + input.foo = 7 + } + - | + package ex + + foo["bar"] := 0 + + foo["baz"] := 1 + + foo["*"] := [1, 2, 3] if { + input.foo = 7 + } + + bar contains "x" + + bar contains "y" + + bar contains "*" if { + input.foo = 7 + } + - | + package topdown_test_partial + + __result__ := _result if { + data.partial.ex.foo = _result + } + data: {} + input_term: '{"foo": 7}' + want_result: + - x: + "*": + - 1 + - 2 + - 3 + bar: 0 + baz: 1 diff --git a/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0987.yaml b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0987.yaml new file mode 100644 index 0000000000..4c6a89af3d --- /dev/null +++ b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0987.yaml @@ -0,0 +1,42 @@ +--- +cases: + - note: partialdocconstants/set-1 + query: data.ex.bar.x = x + modules: + - | + package topdown_test_partial + + __result__ := _result if { + data.partial.ex.foo = _result + } + - | + package partial.ex + + foo["bar"] := 0 + + foo["baz"] := 1 + + foo["*"] := [1, 2, 3] if { + input.foo = 7 + } + - | + package ex + + foo["bar"] := 0 + + foo["baz"] := 1 + + foo["*"] := [1, 2, 3] if { + input.foo = 7 + } + + bar contains "x" + + bar contains "y" + + bar contains "*" if { + input.foo = 7 + } + data: {} + want_result: + - x: x diff --git a/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0988.yaml b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0988.yaml new file mode 100644 index 0000000000..4a34e82fda --- /dev/null +++ b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0988.yaml @@ -0,0 +1,45 @@ +--- +cases: + - note: partialdocconstants/set + query: data.ex.bar = x + modules: + - | + package ex + + foo["bar"] := 0 + + foo["baz"] := 1 + + foo["*"] := [1, 2, 3] if { + input.foo = 7 + } + + bar contains "x" + + bar contains "y" + + bar contains "*" if { + input.foo = 7 + } + - | + package topdown_test_partial + + __result__ := _result if { + _result = "x" + } + - | + package partial.ex + + foo["bar"] := 0 + + foo["baz"] := 1 + + foo["*"] := [1, 2, 3] if { + input.foo = 7 + } + data: {} + want_result: + - x: + - x + - "y" + sort_bindings: true diff --git a/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0989.yaml b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0989.yaml new file mode 100644 index 0000000000..b467c447a3 --- /dev/null +++ b/test/cases/testdata/v1/partialdocconstants/test-partialdocconstants-0989.yaml @@ -0,0 +1,47 @@ +--- +cases: + - note: partialdocconstants/set-all + query: data.ex.bar = x + modules: + - | + package ex + + foo["bar"] := 0 + + foo["baz"] := 1 + + foo["*"] := [1, 2, 3] if { + input.foo = 7 + } + + bar contains "x" + + bar contains "y" + + bar contains "*" if { + input.foo = 7 + } + - | + package topdown_test_partial + + __result__ := _result if { + data.partial.ex.bar = _result + } + - | + package partial.ex + + bar contains "x" + + bar contains "y" + + bar contains "*" if { + input.foo = 7 + } + data: {} + input_term: '{"foo": 7}' + want_result: + - x: + - "*" + - x + - "y" + sort_bindings: true diff --git a/test/cases/testdata/v1/partialiter/test-partialiter-001.yaml b/test/cases/testdata/v1/partialiter/test-partialiter-001.yaml new file mode 100644 index 0000000000..a2ae4125ab --- /dev/null +++ b/test/cases/testdata/v1/partialiter/test-partialiter-001.yaml @@ -0,0 +1,46 @@ +--- +cases: + - note: partialiter/sets unique + query: data.test.p = x + modules: + - | + package test + + p := count([x | q[x]]) + + q contains 1 + + q contains 1 + + q contains 2 + want_result: + - x: 2 + - note: partialiter/objects unique + query: data.test.p = x + modules: + - | + package test + + p := count([x | q[x]]) + + q[1] := 1 + + q[1] := 1 + + q[2] := 1 + want_result: + - x: 2 + - note: partialiter/objects conflict + query: data.test.p = x + modules: + - | + package test + + p := count([x | q[x]]) + + q[1] := 1 + + q[1] := 2 + + q[2] := 1 + want_error_code: eval_conflict_error diff --git a/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0519.yaml b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0519.yaml new file mode 100644 index 0000000000..6a29ecce77 --- /dev/null +++ b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0519.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: partialobjectdoc/identity + query: data.generated.p = x + modules: + - | + package generated + + p[k] := v if { + data.b[k] = v + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: + v1: hello + v2: goodbye diff --git a/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0520.yaml b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0520.yaml new file mode 100644 index 0000000000..68c2ff2fee --- /dev/null +++ b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0520.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: partialobjectdoc/composites + query: data.generated.p = x + modules: + - | + package generated + + p[k] := v if { + data.d[k] = v + } + data: + d: + e: + - bar + - baz + want_result: + - x: + e: + - bar + - baz diff --git a/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0521.yaml b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0521.yaml new file mode 100644 index 0000000000..888e7467f2 --- /dev/null +++ b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0521.yaml @@ -0,0 +1,39 @@ +--- +cases: + - note: partialobjectdoc/body/join var + query: data.generated.p = x + modules: + - | + package generated + + p[k] := v if { + data.a[i] = v + data.g[k][i] = v + } + data: + a: + - "1" + - "2" + - "3" + - "4" + g: + a: + - "1" + - "0" + - "0" + - "0" + b: + - "0" + - "2" + - "0" + - "0" + c: + - "0" + - "0" + - "0" + - "4" + want_result: + - x: + a: "1" + b: "2" + c: "4" diff --git a/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0522.yaml b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0522.yaml new file mode 100644 index 0000000000..98108d5e76 --- /dev/null +++ b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0522.yaml @@ -0,0 +1,41 @@ +--- +cases: + - note: partialobjectdoc/composite value + query: data.generated.p = x + modules: + - | + package generated + + p[k] := [v1, {"v2": v2}] if { + data.g[k] = x + x[v1] = v2 + v2 != 0 + } + data: + g: + a: + - 1 + - 0 + - 0 + - 0 + b: + - 0 + - 2 + - 0 + - 0 + c: + - 0 + - 0 + - 0 + - 4 + want_result: + - x: + a: + - 0 + - v2: 1 + b: + - 1 + - v2: 2 + c: + - 3 + - v2: 4 diff --git a/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0523.yaml b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0523.yaml new file mode 100644 index 0000000000..dd40b46e20 --- /dev/null +++ b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0523.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: partialobjectdoc/same key/value pair + query: data.generated.p = x + modules: + - | + package generated + + p[k] := 1 if { + ks = ["a", "b", "c", "a"] + ks[_] = k + } + data: {} + want_result: + - x: + a: 1 + b: 1 + c: 1 diff --git a/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0524.yaml b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0524.yaml new file mode 100644 index 0000000000..d2ab9a52ed --- /dev/null +++ b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-0524.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: partialobjectdoc/non-string key + query: data.generated.p = x + modules: + - | + package generated + + p[k] := 1 if { + ks = [1, {}, null] + ks[_] = k + } + data: {} + want_result: + - x: + "{}": 1 + "1": 1 + "null": 1 diff --git a/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-ref.yaml b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-ref.yaml new file mode 100644 index 0000000000..60508f2ff3 --- /dev/null +++ b/test/cases/testdata/v1/partialobjectdoc/test-partialobjectdoc-ref.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: partialobjectdoc/ref + query: data.generated.q = x + modules: + - | + package generated + + p.q[k] := v if { + k := ["foo", "bar"][v] + } + + p.baz := 2 + + q if { + x := "bar" + y := "q" + p[y][x] == 1 + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/partialobjectdoc/test-wasm-cases.yaml b/test/cases/testdata/v1/partialobjectdoc/test-wasm-cases.yaml new file mode 100644 index 0000000000..8b8a7e2ae6 --- /dev/null +++ b/test/cases/testdata/v1/partialobjectdoc/test-wasm-cases.yaml @@ -0,0 +1,132 @@ +--- +cases: + - note: wasm/additive + query: data.x.q = x + modules: + - | + package x + + p["a"] := 1 + + p["b"] := 2 + + q if { + p == {"a": 1, "b": 2} + } + want_result: + - x: true + - note: wasm/additive (negative) + query: data.x.p = input + modules: + - | + package x + + p["a"] := 1 + + p["b"] := 2 + + p["c"] := 3 + input: + a: 1 + b: 2 + want_result: [] + - note: wasm/input + query: data.x.q = x + modules: + - | + package x + + p["a"] := 1 if input.x = 1 + + p["b"] := 2 if input.y = 2 + + q if { + p == {"a": 1, "b": 2} + } + input: + x: 1 + "y": 2 + want_result: + - x: true + - note: wasm/input (negative) + query: data.x.q = x + modules: + - | + package x + + p["a"] := 1 if input.x = 1 + + p["b"] := 2 if input.y = 2 + + p["c"] := 3 if input.z = 3 + + q if { + p == data.z + } + data: + z: + a: 1 + b: 2 + input: + x: 1 + "y": 2 + want_result: + - x: true + - note: wasm/composites + query: data.x.q = x + modules: + - | + package x + + p[x] := [y] if { + x = "a" + y = 1 + } + + p[x] := [y] if { + x = "b" + y = 2 + } + + q if p == {"a": [1], "b": [2]} + want_result: + - x: true + - note: wasm/conflict error + query: data.x.q = x + modules: + - | + package x + + p["x"] := 1 + + p["x"] := 2 + + q if { + p == data.z + } + data: + z: + a: 1 + want_error_code: eval_conflict_error + want_error: "eval_conflict_error: complete rules must not produce multiple outputs" + - note: wasm/object dereference + query: data.x.q = x + modules: + - | + package x + + p["a"] := {"b": 1} + + q if { + p.a.b = 1 + } + want_result: + - x: true + - note: wasm/object dereference (negative) + query: data.x.p.a.b = 1 + modules: + - | + package x + + p["a"] := {"b": 2} + want_result: [] diff --git a/test/cases/testdata/v1/partialsetdoc/test-issue-3369.yaml b/test/cases/testdata/v1/partialsetdoc/test-issue-3369.yaml new file mode 100644 index 0000000000..948929ff85 --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-issue-3369.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: partialsetdoc/unexpected 'var requires evaluation' + query: data.x.p[x] = z + modules: + - | + package x + + p contains a if { + a := q + } + + q contains b if { + b := 1 + } + want_result: + - x: + - 1 + z: + - 1 diff --git a/test/cases/testdata/v1/partialsetdoc/test-issue-3376.yaml b/test/cases/testdata/v1/partialsetdoc/test-issue-3376.yaml new file mode 100644 index 0000000000..95ca0a22b2 --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-issue-3376.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: partialsetdoc/iteration + query: data.foo.p = x + modules: + - | + package foo + + p if { + q[i][j] = v # this fails! + } + + q contains x if { + x = r + } + + r contains x if { + x = [1] + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/partialsetdoc/test-issue-3819.yaml b/test/cases/testdata/v1/partialsetdoc/test-issue-3819.yaml new file mode 100644 index 0000000000..3f4154d3af --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-issue-3819.yaml @@ -0,0 +1,27 @@ +--- +cases: + - note: "partialsetdoc: object sort while iter" + query: data.foo.p = x + modules: + - | + package foo + + p contains x if { + data.a[x] # iterates data.a + q[_] + } + + q contains x if { + x = data.a # inserts data.a into a set, sorts the object keys + } + data: + a: + apples: "2" + bananas: "1" + clementines: "3" + want_result: + - x: + - apples + - bananas + - clementines + sort_bindings: true diff --git a/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0511.yaml b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0511.yaml new file mode 100644 index 0000000000..f3bfba8d2b --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0511.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: partialsetdoc/array values + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.a[i] = x + } + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: + - "1" + - "2" + - "3" + - "4" + sort_bindings: true diff --git a/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0512.yaml b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0512.yaml new file mode 100644 index 0000000000..d0dde42c94 --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0512.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: partialsetdoc/array indices + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.a[x] = _ + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 0 + - 1 + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0513.yaml b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0513.yaml new file mode 100644 index 0000000000..ec750442e9 --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0513.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: partialsetdoc/object keys + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.b[x] = _ + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: + - v1 + - v2 + sort_bindings: true diff --git a/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0514.yaml b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0514.yaml new file mode 100644 index 0000000000..f51fee98d5 --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0514.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: partialsetdoc/object values + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.b[i] = x + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: + - goodbye + - hello + sort_bindings: true diff --git a/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0515.yaml b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0515.yaml new file mode 100644 index 0000000000..5cf42b7e8c --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0515.yaml @@ -0,0 +1,32 @@ +--- +cases: + - note: partialsetdoc/nested composites + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.f[i] = x + } + data: + f: + - xs: + - "1" + ys: + - "2" + - xs: + - "2" + ys: + - "3" + want_result: + - x: + - xs: + - "1" + ys: + - "2" + - xs: + - "2" + ys: + - "3" + sort_bindings: true diff --git a/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0516.yaml b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0516.yaml new file mode 100644 index 0000000000..9884351282 --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0516.yaml @@ -0,0 +1,31 @@ +--- +cases: + - note: partialsetdoc/deep ref/heterogeneous + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.c[i][j][k] = x + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - null + - false + - true + - 3.14159 + - foo + sort_bindings: true diff --git a/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0517.yaml b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0517.yaml new file mode 100644 index 0000000000..ca97c5f5bd --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0517.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: partialsetdoc/composite var value + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.a[i] + x = [i, __local0__] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - - 0 + - 1 + - - 1 + - 2 + - - 2 + - 3 + - - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0518.yaml b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0518.yaml new file mode 100644 index 0000000000..b109420ce3 --- /dev/null +++ b/test/cases/testdata/v1/partialsetdoc/test-partialsetdoc-0518.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: partialsetdoc/composite key + query: data.generated.p = x + modules: + - | + package generated + + p contains [x, {"y": y}] if { + x = 1 + y = 2 + } + data: {} + want_result: + - x: + - - 1 + - "y": 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/planner-ir/test-array-ir-unify.yaml b/test/cases/testdata/v1/planner-ir/test-array-ir-unify.yaml new file mode 100644 index 0000000000..52d7c8709e --- /dev/null +++ b/test/cases/testdata/v1/planner-ir/test-array-ir-unify.yaml @@ -0,0 +1,55 @@ +--- +cases: + - note: ir/unification array and array comprehension + query: data.test.p = x + modules: + - | + package test + + p := foo if { + [foo] = [x | x := 1] + } + want_result: + - x: 1 + - note: ir/unification array comprehension and array + query: data.test.p = x + modules: + - | + package test + + p := foo if { + [x | x := 1] = [foo] + } + want_result: + - x: 1 + - note: ir/fixpoint key/value (negative) + query: data.test.p = x + modules: + - | + package test + + p if { + some foo + foo == input.foos[foo] + } + input: + foos: + - foo + want_result: [] + - note: ir/fixpoint key/value + query: data.test.p = x + modules: + - | + package test + + p := foo if { + some foo + foo == input.foos[foo] + } + input: + foos: + - 2 + - 1 + - 0 + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/planner-ir/test-call-dynamic.yaml b/test/cases/testdata/v1/planner-ir/test-call-dynamic.yaml new file mode 100644 index 0000000000..d7c4baf2e1 --- /dev/null +++ b/test/cases/testdata/v1/planner-ir/test-call-dynamic.yaml @@ -0,0 +1,119 @@ +--- +cases: + - note: ir/call_dynamic in comprehension + query: data.test.p = x + modules: + - | + package test + + p := x if { + b := input + x := {y | y := data.a[b][_]} + } + - | + package a + + b := {"foo", "bar"} + - | + package a + + c := {"x", "y"} + input: b + want_result: + - x: + - bar + - foo + sort_bindings: true + - note: ir/no call-dynamic with mixed partial rules + query: data.test.p = x + modules: + - | + package test + + p := data.a.b[c] if c := "c" + - | + package a + + b[c] := "C" if c := "c" + + b["d"] := "D" + want_result: + - x: C + - note: ir/call-dynamic with mixed partial rules + query: data.test.p = x + modules: + - | + package test + + p := a[b].c if b := "b" + + a.b.c := "C" + + a.x.d := "D" + want_result: + - x: C + - note: ir/no call-dynamic with mixed partial rules, ref heads + query: data.test.p = x + modules: + - | + package test + + p := a.b[c] if c := "c" + + a.b[c] := "C" if c := "c" + + a.b.d := "D" + want_result: + - x: C + - note: ir/call-dynamic with mixed partial rules, ref heads + query: data.test.p = x + modules: + - | + package test + + p := a[b][c] if { + b := "b" + c := "c" + } + + a.b.c := "C" + + a.x.d := "D" + want_result: + - x: C + - note: ir/call-dynamic with ref heads, issue 5839 + query: data.test.p = x + modules: + - | + package test + + p := a[b][c].allow if { + b := "b" + c := "c" + } + + a.b.c.allow := true + + a.x.d.allow := true + + a.y[x] := "E" if x := "x" + want_result: + - x: true + - note: ir/call-dynamic with ref heads, issue 5839, penultimate + query: data.test.p = x + modules: + - | + package test + + p := a[b][c] if { + b := "b" + c := "c" + } + + a.b.c := true + + a.x.d := true + + a.y := "E" + want_result: + - x: true diff --git a/test/cases/testdata/v1/providers-aws/aws-sign_req-errors.yaml b/test/cases/testdata/v1/providers-aws/aws-sign_req-errors.yaml new file mode 100644 index 0000000000..a57f8ca033 --- /dev/null +++ b/test/cases/testdata/v1/providers-aws/aws-sign_req-errors.yaml @@ -0,0 +1,189 @@ +--- +cases: + - note: providers-aws-sign_req/failure-simple-missing http request keys + query: data.test.p = x + modules: + - | + package test + + req := {} + + aws_config := { + "aws_access_key": "MYAWSACCESSKEYGOESHERE", + "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", + "aws_session_token": "MYAWSSECURITYTOKENGOESHERE", + "aws_service": "s3", + "aws_region": "us-east-1", + } + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=0047a7016c81e5c7f29cd522f97e911e04fc472fced0aee7916cbc287ad6c8e3", + "host": "example.com", + "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_error_code: eval_type_error + want_error: 'providers.aws.sign_req: operand 1 missing required request parameters(s): {"method", "url"}' + strict_error: true + - note: providers-aws-sign_req/failure-simple-invalid type http request keys + query: data.test.p = x + modules: + - | + package test + + req := {"method": set(), "url": set()} + + aws_config := { + "aws_access_key": "MYAWSACCESSKEYGOESHERE", + "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", + "aws_session_token": "MYAWSSECURITYTOKENGOESHERE", + "aws_service": "s3", + "aws_region": "us-east-1", + } + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=0047a7016c81e5c7f29cd522f97e911e04fc472fced0aee7916cbc287ad6c8e3", + "host": "example.com", + "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_error_code: eval_type_error + want_error: 'providers.aws.sign_req: operand 1 invalid values for required request parameters(s): {"method", "url"}' + strict_error: true + - note: providers-aws-sign_req/failure-simple-missing aws keys + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "http://example.com"} + + aws_config := {"example": "example"} + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=0047a7016c81e5c7f29cd522f97e911e04fc472fced0aee7916cbc287ad6c8e3", + "host": "example.com", + "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_error_code: eval_type_error + want_error: 'providers.aws.sign_req: operand 2 missing required AWS config parameters(s): {"aws_access_key", "aws_region", "aws_secret_access_key", "aws_service"}' + strict_error: true + - note: providers-aws-sign_req/failure-simple-invalid type aws keys + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "http://example.com"} + + aws_config := { + "aws_access_key": 1, + "aws_secret_access_key": 2, + "aws_session_token": 3, + "aws_service": 4, + "aws_region": 5, + } + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=0047a7016c81e5c7f29cd522f97e911e04fc472fced0aee7916cbc287ad6c8e3", + "host": "example.com", + "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_error_code: eval_type_error + want_error: 'providers.aws.sign_req: operand 2 invalid values for required AWS config parameters(s): {"aws_access_key", "aws_region", "aws_secret_access_key", "aws_service"}' + strict_error: true + - note: providers-aws-sign_req/failure-simple-bad timestamp + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "http://example.com"} + + aws_config := { + "aws_access_key": "MYAWSACCESSKEYGOESHERE", + "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", + "aws_session_token": "MYAWSSECURITYTOKENGOESHERE", + "aws_service": "s3", + "aws_region": "us-east-1", + } + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=0047a7016c81e5c7f29cd522f97e911e04fc472fced0aee7916cbc287ad6c8e3", + "host": "example.com", + "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, -1e9) == expected + } + want_error_code: eval_type_error + want_error: "providers.aws.sign_req: operand 3 could not convert time_ns value into a unix timestamp" + strict_error: true + - note: providers-aws-sign_req/failure-simple-bad-type-payload-signing-config + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "https://example.com", "headers": {"foo": "bar"}} + + aws_config := {"aws_access_key": "MYAWSACCESSKEYGOESHERE", "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", "aws_service": "s3", "aws_region": "us-east-1", "disable_payload_signing": "false"} + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=8f1dc7c9b9978356a0d0989fd26a95307f4f8a4aa264d8220647b7097d839952", + "foo": "bar", + "host": "example.com", + "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "https://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_error_code: eval_type_error + want_error: "providers.aws.sign_req: operand 2 invalid value for 'disable_payload_signing' in AWS config" + strict_error: true diff --git a/test/cases/testdata/v1/providers-aws/aws-sign_req.yaml b/test/cases/testdata/v1/providers-aws/aws-sign_req.yaml new file mode 100644 index 0000000000..fce2e11003 --- /dev/null +++ b/test/cases/testdata/v1/providers-aws/aws-sign_req.yaml @@ -0,0 +1,346 @@ +--- +cases: + - note: providers-aws-sign_req/success-simple-no body + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "http://example.com"} + + aws_config := { + "aws_access_key": "MYAWSACCESSKEYGOESHERE", + "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", + "aws_service": "s3", + "aws_region": "us-east-1", + } + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=0047a7016c81e5c7f29cd522f97e911e04fc472fced0aee7916cbc287ad6c8e3", + "host": "example.com", + "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-with headers no body + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "http://example.com", "headers": {"foo": "bar"}} + + aws_config := { + "aws_access_key": "MYAWSACCESSKEYGOESHERE", + "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", + "aws_service": "s3", + "aws_region": "us-east-1", + } + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=8f1dc7c9b9978356a0d0989fd26a95307f4f8a4aa264d8220647b7097d839952", + "host": "example.com", + "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "x-amz-date": "20151228T140825Z", + "foo": "bar", + }, + "method": "get", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-no body-with session token + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "http://example.com"} + + aws_config := { + "aws_access_key": "MYAWSACCESSKEYGOESHERE", + "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", + "aws_session_token": "MYAWSSECURITYTOKENGOESHERE", + "aws_service": "s3", + "aws_region": "us-east-1", + } + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token,Signature=23c31bda8a74630c0a94f6b82a3511e7e74728df98e6f54ed0840488dbbdc8d1", + "host": "example.com", + "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "x-amz-date": "20151228T140825Z", + "x-amz-security-token": "MYAWSSECURITYTOKENGOESHERE", + }, + "method": "get", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-body + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "http://example.com", "body": {"example": {1, 2, 3, 4}}} + + aws_config := {"aws_access_key": "MYAWSACCESSKEYGOESHERE", "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", "aws_service": "s3", "aws_region": "us-east-1"} + + expected := { + "body": {"example": {1, 2, 3, 4}}, + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=5fb06ab1cfd74c8fcb3af95b8cce696708cf6155d971dac10f254d79799c6e88", + "host": "example.com", + "x-amz-content-sha256": "bacff6243c850423883052ac3c336fd645994442933408dfd3f9e858e69bda07", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-raw_body + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "http://example.com", "raw_body": "{\"example\": {1, 2, 3, 4}}"} + + aws_config := {"aws_access_key": "MYAWSACCESSKEYGOESHERE", "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", "aws_service": "s3", "aws_region": "us-east-1"} + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=5bf26e169cb8b02330dba39d53932532438fc856c2f10537689a09ed807c7195", + "host": "example.com", + "x-amz-content-sha256": "22906461e2a98a3e780d0fd260e341bed5e544661e97c5936fc7f3af11aaad8b", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "raw_body": "{\"example\": {1, 2, 3, 4}}", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-body-and-raw_body + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "http://example.com", "body": {"example": {1, 2, 3, 4}}, "raw_body": "{\"example\": {1, 2, 3, 4}}"} + + aws_config := {"aws_access_key": "MYAWSACCESSKEYGOESHERE", "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", "aws_service": "s3", "aws_region": "us-east-1"} + + expected := { + "body": {"example": {1, 2, 3, 4}}, + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=5bf26e169cb8b02330dba39d53932532438fc856c2f10537689a09ed807c7195", + "host": "example.com", + "x-amz-content-sha256": "22906461e2a98a3e780d0fd260e341bed5e544661e97c5936fc7f3af11aaad8b", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "raw_body": "{\"example\": {1, 2, 3, 4}}", + "url": "http://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-with-headers-no-body-with-payload-signing + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "https://example.com", "headers": {"foo": "bar"}} + + aws_config := {"aws_access_key": "MYAWSACCESSKEYGOESHERE", "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", "aws_service": "s3", "aws_region": "us-east-1", "disable_payload_signing": false} + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=8f1dc7c9b9978356a0d0989fd26a95307f4f8a4aa264d8220647b7097d839952", + "foo": "bar", + "host": "example.com", + "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "https://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-with-headers-no-body-no-payload-signing + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "https://example.com", "headers": {"foo": "bar"}} + + aws_config := {"aws_access_key": "MYAWSACCESSKEYGOESHERE", "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", "aws_service": "s3", "aws_region": "us-east-1", "disable_payload_signing": true} + + expected := { + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=c6e6db654e92172f71e18c714c123711de069ac6fd7df1348e5b28fd05532028", + "foo": "bar", + "host": "example.com", + "x-amz-content-sha256": "UNSIGNED-PAYLOAD", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "https://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-with-headers-with-body-with-payload-signing + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "https://example.com", "headers": {"foo": "bar"}, "body": {"example": {1, 2, 3, 4}}} + + aws_config := {"aws_access_key": "MYAWSACCESSKEYGOESHERE", "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", "aws_service": "s3", "aws_region": "us-east-1", "disable_payload_signing": false} + + expected := { + "body": {"example": {1, 2, 3, 4}}, + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=f6703a8727ec0a32f81b225a002f622e511e8a7d2ca8914894fcbb7a71d8d9d8", + "foo": "bar", + "host": "example.com", + "x-amz-content-sha256": "bacff6243c850423883052ac3c336fd645994442933408dfd3f9e858e69bda07", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "https://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-with-headers-with-body-no-payload-signing + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "https://example.com", "headers": {"foo": "bar"}, "body": {"example": {1, 2, 3, 4}}} + + aws_config := {"aws_access_key": "MYAWSACCESSKEYGOESHERE", "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", "aws_service": "s3", "aws_region": "us-east-1", "disable_payload_signing": true} + + expected := { + "body": {"example": {1, 2, 3, 4}}, + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=c6e6db654e92172f71e18c714c123711de069ac6fd7df1348e5b28fd05532028", + "foo": "bar", + "host": "example.com", + "x-amz-content-sha256": "UNSIGNED-PAYLOAD", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "https://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-with-existing-sha-header-with-body-with-payload-signing + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "https://example.com", "headers": {"foo": "bar", "x-amz-content-sha256": "existing-value"}, "body": {"example": {1, 2, 3, 4}}} + + aws_config := {"aws_access_key": "MYAWSACCESSKEYGOESHERE", "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", "aws_service": "s3", "aws_region": "us-east-1", "disable_payload_signing": false} + + expected := { + "body": {"example": {1, 2, 3, 4}}, + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=42bcac7fc6d170e09be72fdf38b62e59361265bc59d5f9156f0d6faf889e98ba", + "foo": "bar", + "host": "example.com", + "x-amz-content-sha256": "bacff6243c850423883052ac3c336fd645994442933408dfd3f9e858e69bda07", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "https://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true + - note: providers-aws-sign_req/success-simple-with-existing-sha-header-with-body-no-payload-signing + query: data.test.p = x + modules: + - | + package test + + req := {"method": "get", "url": "https://example.com", "headers": {"foo": "bar", "x-amz-content-sha256": "existing-value"}, "body": {"example": {1, 2, 3, 4}}} + + aws_config := {"aws_access_key": "MYAWSACCESSKEYGOESHERE", "aws_secret_access_key": "MYAWSSECRETACCESSKEYGOESHERE", "aws_service": "s3", "aws_region": "us-east-1", "disable_payload_signing": true} + + expected := { + "body": {"example": {1, 2, 3, 4}}, + "headers": { + "Authorization": "AWS4-HMAC-SHA256 Credential=MYAWSACCESSKEYGOESHERE/20151228/us-east-1/s3/aws4_request,SignedHeaders=foo;host;x-amz-content-sha256;x-amz-date,Signature=edcd3ca3fd3acdfbcecad1a1d8062dbc6562d90352e294c336f9727397f9c383", + "foo": "bar", + "host": "example.com", + "x-amz-content-sha256": "UNSIGNED-PAYLOAD", + "x-amz-date": "20151228T140825Z", + }, + "method": "get", + "url": "https://example.com", + } + + p if { + providers.aws.sign_req(req, aws_config, 1451311705000000000) == expected + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/rand/test-rand.intn.yaml b/test/cases/testdata/v1/rand/test-rand.intn.yaml new file mode 100644 index 0000000000..e99fbb95bf --- /dev/null +++ b/test/cases/testdata/v1/rand/test-rand.intn.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: rand.intn/consistent values for same arguments + query: data.test.p = x + modules: + - | + package test + + p := count(rands) if { + rands := {rand.intn("key", 100) | numbers.range(1, 100)[_]} + } + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/reachable/test-reachable-0322.yaml b/test/cases/testdata/v1/reachable/test-reachable-0322.yaml new file mode 100644 index 0000000000..df499e3169 --- /dev/null +++ b/test/cases/testdata/v1/reachable/test-reachable-0322.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: reachable/empty + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + graph.reachable({}, {"a"}, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: "{}" + want_result: + - x: [] diff --git a/test/cases/testdata/v1/reachable/test-reachable-0323.yaml b/test/cases/testdata/v1/reachable/test-reachable-0323.yaml new file mode 100644 index 0000000000..274ad0fd59 --- /dev/null +++ b/test/cases/testdata/v1/reachable/test-reachable-0323.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: reachable/cycle + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + graph.reachable({ + "a": {"b"}, + "b": {"c"}, + "c": {"a"}, + }, {"a"}, __local1__) + sort(__local1__, __local2__) + __local0__ = __local2__ + } + data: {} + input_term: "{}" + want_result: + - x: + - a + - b + - c diff --git a/test/cases/testdata/v1/reachable/test-reachable-0324.yaml b/test/cases/testdata/v1/reachable/test-reachable-0324.yaml new file mode 100644 index 0000000000..6ca4c53fee --- /dev/null +++ b/test/cases/testdata/v1/reachable/test-reachable-0324.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: reachable/components + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + graph.reachable({ + "a": {"b", "c"}, + "b": {"d"}, + "c": {"d"}, + "d": set(), + "e": {"f"}, + "f": {"e"}, + "x": {"x"}, + }, {"b", "e"}, __local1__) + sort(__local1__, __local2__) + __local0__ = __local2__ + } + data: {} + input_term: "{}" + want_result: + - x: + - b + - d + - e + - f diff --git a/test/cases/testdata/v1/reachable/test-reachable-0325.yaml b/test/cases/testdata/v1/reachable/test-reachable-0325.yaml new file mode 100644 index 0000000000..96a7a73115 --- /dev/null +++ b/test/cases/testdata/v1/reachable/test-reachable-0325.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: reachable/arrays + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + graph.reachable({ + "a": ["b"], + "b": ["c"], + "c": ["a"], + }, ["a"], __local1__) + sort(__local1__, __local2__) + __local0__ = __local2__ + } + data: {} + input_term: "{}" + want_result: + - x: + - a + - b + - c diff --git a/test/cases/testdata/v1/reachable/test-reachable-0326.yaml b/test/cases/testdata/v1/reachable/test-reachable-0326.yaml new file mode 100644 index 0000000000..80b657d508 --- /dev/null +++ b/test/cases/testdata/v1/reachable/test-reachable-0326.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: reachable/malformed 1 + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.graph + __local3__ = input.initial + graph.reachable(__local2__, __local3__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"graph": 1, "initial": [1]}' + want_error_code: eval_type_error + strict_error: true diff --git a/test/cases/testdata/v1/reachable/test-reachable-0327.yaml b/test/cases/testdata/v1/reachable/test-reachable-0327.yaml new file mode 100644 index 0000000000..9328f09d3b --- /dev/null +++ b/test/cases/testdata/v1/reachable/test-reachable-0327.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: reachable/malformed 2 + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.graph + __local3__ = input.initial + graph.reachable(__local2__, __local3__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"graph": {"a": null}, "initial": ["a"]}' + want_result: + - x: + - a diff --git a/test/cases/testdata/v1/reachable/test-reachable-0328.yaml b/test/cases/testdata/v1/reachable/test-reachable-0328.yaml new file mode 100644 index 0000000000..490c80f3fb --- /dev/null +++ b/test/cases/testdata/v1/reachable/test-reachable-0328.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: reachable/malformed 3 + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local2__ = input.graph + __local3__ = input.initial + graph.reachable(__local2__, __local3__, __local1__) + __local0__ = __local1__ + } + data: {} + input_term: '{"graph": {"a": []}, "initial": "a"}' + want_error_code: eval_type_error + strict_error: true diff --git a/test/cases/testdata/v1/reachable/test-reachable-paths-0422.yaml b/test/cases/testdata/v1/reachable/test-reachable-paths-0422.yaml new file mode 100644 index 0000000000..193703bb96 --- /dev/null +++ b/test/cases/testdata/v1/reachable/test-reachable-paths-0422.yaml @@ -0,0 +1,137 @@ +--- +cases: + - note: reachable_paths/empty + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths({}, {"a"}, result) + } + data: {} + want_result: + - x: [] + - note: reachable_paths/cycle + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": { "a": {"b"}, "b": {"c"}, "c": {"a"}, }, "initial": {"a"} }' + want_result: + - x: + - - a + - b + - c + - note: reachable_paths/components + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": { "a": {"b", "c"}, "b": {"d"}, "c": {"d"}, "d": set(), "e": {"f"}, "f": {"e"}, "x": {"x"}, }, "initial": { "b", "e" } }' + want_result: + - x: + - - b + - d + - - e + - f + - note: reachable_paths/arrays + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": { "a": ["b"], "b": ["c"], "c": ["a"], }, "initial": ["a"] }' + want_result: + - x: + - - a + - b + - c + - note: reachable_paths/malformed 1 + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": 1, "initial": [1] }' + want_error_code: eval_type_error + strict_error: true + - note: reachable_paths/malformed 2 + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": { "a": null }, "initial": ["a"] }' + want_result: + - x: + - - a + - note: reachable_paths/malformed 3 + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": { "a": [] }, "initial": "a" }' + want_error_code: eval_type_error + strict_error: true + - note: reachable_paths/multiple_paths + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": { "a": ["b", "c"], "b": ["c"], "c": [], }, "initial": {"a"} }' + want_result: + - x: + - - a + - b + - c + - - a + - c + - note: reachable_paths/invalid_end + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": { "a": ["b"], "b": ["nonexistent"], }, "initial": {"a", "b"} }' + want_result: + - x: + - - a + - b + - - b diff --git a/test/cases/testdata/v1/reachable/test-reachable-paths-1022.yaml b/test/cases/testdata/v1/reachable/test-reachable-paths-1022.yaml new file mode 100644 index 0000000000..9eb8f359bf --- /dev/null +++ b/test/cases/testdata/v1/reachable/test-reachable-paths-1022.yaml @@ -0,0 +1,81 @@ +--- +cases: + - note: reachable_paths/cycle_1022_1 + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": { "one": ["two","five"], "two": ["four"], "three": [""], "four": ["three"], "five": ["seven","six"], "six": ["nine"], "seven": ["eight"], "eight": [""], "nine": [""], }, "initial": {"one"} }' + want_result: + - x: + - - one + - five + - seven + - eight + - - one + - five + - six + - nine + - - one + - two + - four + - three + - note: reachable_paths/cycle_1022_2 + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": { "one": {"two","five"}, "two": {"four"}, "three": {""}, "four": {"three"}, "five": {"seven","six"}, "six": {"nine"}, "seven": {"eight"}, "eight": {""}, "nine": {""}, }, "initial": {"one"} }' + want_result: + - x: + - - one + - five + - seven + - eight + - - one + - five + - six + - nine + - - one + - two + - four + - three + - note: reachable_paths/cycle_1022_3 + query: data.reachable.p = x + modules: + - | + package reachable + + p := result if { + graph.reachable_paths(input.graph, input.initial, result) + } + data: {} + input_term: '{ "graph": { "one": ["two","five"], "two": ["four"], "three": [""], "four": ["three"], "five": ["seven","six"], "six": ["nine","seven"], "seven": ["eight"], "eight": ["three"], "nine": [""], }, "initial": {"one"} }' + want_result: + - x: + - - one + - five + - seven + - eight + - three + - - one + - five + - six + - - one + - five + - six + - nine + - - one + - two + - four + - three diff --git a/test/cases/testdata/v1/refheads/test-generic-refs.yaml b/test/cases/testdata/v1/refheads/test-generic-refs.yaml new file mode 100644 index 0000000000..d3780d22f5 --- /dev/null +++ b/test/cases/testdata/v1/refheads/test-generic-refs.yaml @@ -0,0 +1,273 @@ +--- +cases: + - note: refheads/general, single var + query: data.test.p = x + modules: + - | + package test + + p[q].r := i if q := ["a", "b", "c"][i] + want_result: + - x: + a: + r: 0 + b: + r: 1 + c: + r: 2 + - note: refheads/general, multiple vars + query: data.test.p = x + modules: + - | + package test + + p[q][r] if q := ["a", "b", "c"][r] + want_result: + - x: + a: + "0": true + b: + "1": true + c: + "2": true + - note: refheads/general, deep query + query: data.test.p.b = x + modules: + - | + package test + + p[q][r] if q := ["a", "b", "c"][r] + want_result: + - x: + "1": true + - note: refheads/general, overlapping rule, no conflict + query: data.test.p = x + modules: + - | + package test + + p[q].r := i if q := ["a", "b", "c"][i] + + p.a.r := 0 + want_result: + - x: + a: + r: 0 + b: + r: 1 + c: + r: 2 + - note: refheads/general, overlapping rule, different dynamic depths, no conflict + query: data.test.p = x + modules: + - | + package test + + p[q].r.s := i if q := ["a", "b", "c"][i] + + p.d.r := 3 + + p.e := 4 + want_result: + - x: + a: + r: + s: 0 + b: + r: + s: 1 + c: + r: + s: 2 + d: + r: 3 + e: 4 + - note: refheads/general, self-conflict + query: data.test.p = x + modules: + - | + package test + + p[q].r.s := i if q := ["a", "b", "c", "b"][i] + want_error_code: eval_conflict_error + - note: refheads/general, overlapping rule, conflict + query: data.test.p = x + modules: + - | + package test + + p[q].r.s := i if q := ["a", "b", "c"][i] + + p.a.r := 42 + want_error_code: eval_conflict_error + - note: refheads/general, overlapping rule, deep override inside other rule object value, conflict + query: data.test.p = x + modules: + - | + package test + + p[q].r := v if { + q := "q" + v := {"s": {"t": 1}} + } + + p.q.r.s.t := 42 + want_error_code: eval_conflict_error + - note: refheads/general, overlapping rule, deep injection into other rule object value, conflict + query: data.test.p = x + modules: + - | + package test + + p[q].r := v if { + q := "q" + v := {"s": {"t": 1}} + } + + p.q.r.s.u := 42 + want_error_code: eval_conflict_error + - note: refheads/general, set leaf (shallow ref) + query: data.test.p = x + modules: + - | + package test + + p[q] contains r if { + x := ["a", "b", "c"] + q := x[_] + r := x[_] + q != r + } + + p.b contains "foo" + want_result: + - x: + a: + - b + - c + b: + - a + - c + - foo + c: + - a + - b + - note: refheads/general, set leaf (other rule defines dynamic ref portion) + query: data.test.p = x + modules: + - | + package test + + p.q contains r if { + r := ["a", "b", "c"][_] + } + + p[q] := r if { + q := "foo" + r := "bar" + } + want_result: + - x: + foo: bar + q: + - a + - b + - c + - note: refheads/general, set leaf + query: data.test.p = x + modules: + - | + package test + + p[q].r contains s if { + x := ["a", "b", "c"] + q := x[_] + s := x[_] + q != s + } + + p.b.r contains "foo" + want_result: + - x: + a: + r: + - b + - c + b: + r: + - a + - c + - foo + c: + r: + - a + - b + - note: refheads/general, set leaf, deep query + query: data.test.p.b.r.c = x + modules: + - | + package test + + p[q].r contains s if { + x := ["a", "b", "c"] + q := x[_] + s := x[_] + q != s + } + + p.b.r contains "foo" + want_result: + - x: c + - note: refheads/general, input var + query: data.test.p = x + modules: + - | + package test + + p[input.x].r := "foo" + input: + x: bar + want_result: + - x: + bar: + r: foo + - note: refheads/general, external non-ground var + query: data.test.p = x + modules: + - | + package test + + a := [x | x := input.x[_]] + + b := input.y + + p[a[b]].r[s] := i if { + s := a[i] + } + input: + x: + - foo + - bar + - baz + "y": 1 + want_result: + - x: + bar: + r: + bar: 1 + baz: 2 + foo: 0 + - note: refheads/general, multiple result-set entries + query: data.test.p.q[i].s = x + modules: + - | + package test + + p.q[r].s := 1 if r := "foo" + + p.q[r].s := 2 if r := "bar" + want_result: + - i: foo + x: 1 + - i: bar + x: 2 diff --git a/test/cases/testdata/v1/refheads/test-refs-as-rule-heads.yaml b/test/cases/testdata/v1/refheads/test-refs-as-rule-heads.yaml new file mode 100644 index 0000000000..fe7d7950a9 --- /dev/null +++ b/test/cases/testdata/v1/refheads/test-refs-as-rule-heads.yaml @@ -0,0 +1,355 @@ +--- +cases: + - note: refheads/single-value + query: data.test.p = x + modules: + - | + package test + + p.q.r := 1 + + p.q.s := 2 + want_result: + - x: + q: + r: 1 + s: 2 + - note: refheads/single-value, with var + query: data.test.p = x + modules: + - | + package test + + p.q.r := 1 + + p.q[s] := 2 if s := "s" + want_result: + - x: + q: + r: 1 + s: 2 + - note: refheads/single-value, with var, conflict + query: data.test.p.q = x + modules: + - | + package test + + p.q.r := 1 + + p.q[s] := 2 if s := "r" + want_error_code: eval_conflict_error + want_error: object keys must be unique + - note: "refheads/complete: direct query" + query: data.test.a.b.c.p = x + modules: + - | + package test + + a.b.c.p := true + want_result: + - x: true + - note: "refheads/complete: direct query q" + query: data.test.q = x + modules: + - | + package test + + q := 0 + want_result: + - x: 0 + - note: "refheads/complete: full package extent" + query: data.test = x + modules: + - | + package test + + a.b.c.p := true + want_result: + - x: + a: + b: + c: + p: true + - note: refheads/complete+mixed + query: data.test.p = x + modules: + - | + package test + + a.b.c.p := 1 + + q := 0 + + a.b.d := 3 + + p if { + q == 0 + a.b.c.p == 1 + a.b.d == 3 + } + want_result: + - x: true + - note: refheads/single-value rule + query: data.test.a = x + modules: + - | + package test + + a.b[x] := y if { + x := "c" + y := "d" + } + want_result: + - x: + b: + c: d + - note: refheads/multi-value + query: data.test.a = x + modules: + - | + package test + + a.b contains x if some x in [1, 2, 3] + want_result: + - x: + b: + - 1 + - 2 + - 3 + - note: "refheads/single-value: previously partial object" + query: data.test.a.b = x + modules: + - | + package test + + a.b[x] := i if some i, x in [1, 2, 3] + want_result: + - x: + "1": 0 + "2": 1 + "3": 2 + - note: "refheads/multi-value: same rule" + query: data.test.a = x + modules: + - | + package test + + a.b.c.d contains 1 + - | + package test.a + + b.c.d contains 2 + want_result: + - x: + b: + c: + d: + - 1 + - 2 + - note: refheads/single-value default rule + query: data.test.a = x + modules: + - | + package test + + default a.b.c := "d" + want_result: + - x: + b: + c: d + - note: refheads/single-value example + query: data.test.a = x + modules: + - | + package test + + q[7] := 8 + + a[x] if q[x] + want_result: + - x: + "7": true + - note: refheads/single-value example, false + query: data.test.a = x + modules: + - | + package test + + q[7] := 8 if false + + a[x] if q[x] + want_result: + - x: {} + - note: refheads/mixed example, multiple rules + query: data.test.a.b = x + modules: + - | + package test + + a.b.c := "d" + + a.b.e := "f" + + a.b.g contains x if some x in numbers.range(1, 3) + + a.b.h[x] := 1 if x := "one" + want_result: + - x: + c: d + e: f + g: + - 1 + - 2 + - 3 + h: + one: 1 + - note: refheads/website-example/partial-obj + query: data.example.apps_by_hostname.helium = x + modules: + - | + package example + + apps_by_hostname[hostname] := app if { + some i + server := sites[_].servers[_] + hostname := server.hostname + apps[i].servers[_] == server.name + app := apps[i].name + } + + sites := [ + { + "region": "east", + "name": "prod", + "servers": [ + { + "name": "web-0", + "hostname": "hydrogen", + }, + { + "name": "web-1", + "hostname": "helium", + }, + { + "name": "db-0", + "hostname": "lithium", + }, + ], + }, + { + "region": "west", + "name": "smoke", + "servers": [ + { + "name": "web-1000", + "hostname": "beryllium", + }, + { + "name": "web-1001", + "hostname": "boron", + }, + { + "name": "db-1000", + "hostname": "carbon", + }, + ], + }, + { + "region": "west", + "name": "dev", + "servers": [ + { + "name": "web-dev", + "hostname": "nitrogen", + }, + { + "name": "db-dev", + "hostname": "oxygen", + }, + ], + }, + ] + + apps := [ + { + "name": "web", + "servers": ["web-0", "web-1", "web-1000", "web-1001", "web-dev"], + }, + { + "name": "mysql", + "servers": ["db-0", "db-1000"], + }, + { + "name": "mongodb", + "servers": ["db-dev"], + }, + ] + + containers := [ + { + "image": "redis", + "ipaddress": "10.0.0.1", + "name": "big_stallman", + }, + { + "image": "nginx", + "ipaddress": "10.0.0.2", + "name": "cranky_euclid", + }, + ] + want_result: + - x: web + - note: refheads/website-example/partial-set + query: data.example.public_network = x + modules: + - | + package example + + public_network contains net.id if { + some net in input.networks + net.public + } + input: + networks: + - id: n1 + public: true + - id: n2 + public: false + want_result: + - x: + - n1 + - note: refheads/many-vars + query: data.test.p = x + modules: + - | + package test + + p[a][b][c][d][e] if { + some a in numbers.range(1, 5) + some b in numbers.range(1, 5) + some c in numbers.range(1, 5) + some d in numbers.range(1, 5) + some e in numbers.range(1, 5) + (((a + b) + c) + d) + e == 24 + } + want_result: + - x: + "4": + "5": + "5": + "5": + "5": true + "5": + "4": + "5": + "5": + "5": true + "5": + "4": + "5": + "5": true + "5": + "4": + "5": true + "5": + "4": true diff --git a/test/cases/testdata/v1/refheads/test-regressions.yaml b/test/cases/testdata/v1/refheads/test-regressions.yaml new file mode 100644 index 0000000000..1fc427f66e --- /dev/null +++ b/test/cases/testdata/v1/refheads/test-regressions.yaml @@ -0,0 +1,162 @@ +--- +cases: + - note: regression/ref-not-hashable + query: data.test = x + modules: + - | + package test + + ms[m.z] := m if { + m := input.xs[y] + } + input: + xs: + something: + z: a + want_result: + - x: + ms: + a: + z: a + - note: regression/function refs and package extent + query: data.test = x + modules: + - | + package test + + foo["bar"](x) := x + 1 + + x := foo.bar(2) + want_result: + - x: + foo: {} + x: 3 + - note: regression/rule refs and package extent + query: data.test = x + modules: + - | + package test + + buz["quz"] := 3 if input == 3 + + x := y if { + y := buz.quz with input as 3 + } + want_result: + - x: + buz: {} + x: 3 + - note: regression/rule refs and package extents, multiple modules + query: data.test = x + modules: + - | + package test + + x := y if { + y := data.test.buz.quz with input as 3 + } + - | + package test.buz + + quz := 3 if input == 3 + want_result: + - x: + buz: {} + x: 3 + - note: regression/type checking with ref rules + query: data.test.p = x + modules: + - | + package test + + all[0] := [2] + + level := 1 + + p := y if y := all[level - 1][_] + want_result: + - x: 2 + - note: regression/type checking with ref rules, number + query: data.test.p[0] = x + modules: + - | + package test + + p[0] := 1 + want_result: + - x: 1 + - note: regression/type checking with ref rules, bool + query: data.test.p[true] = x + modules: + - | + package test + + p[true] := 1 + want_result: + - x: 1 + - note: regression/full extent with partial object rule with empty indexer lookup result + query: data.test = x + modules: + - | + package test + + p[x] := 2 if { + x := input # we'll get 0 rules for data.test.p + false + } + want_result: + - x: + p: {} + - note: regression/obj in ref head query + query: data.test.p[{"a":"b"}] = x + modules: + - | + package test + + p[{"a": "b"}] := true + want_result: + - x: true + - note: regression/full extent with non-string (number) last term + query: data.test = x + modules: + - | + package test + + p[0] := true + want_result: + - x: + p: + "0": true + - note: regression/full extent with non-string last term, comparison + query: data.test.q = x + modules: + - | + package test + + p[0] := 1 + + q if p[0] == 1 + want_result: + - x: true + - note: regression/full extent with non-string (boolean) last term + query: data.test = x + modules: + - | + package test + + p[true] := true + want_result: + - x: + p: + "true": true + - note: regression/full extent with non-string last term, comparison + query: data.test.q = x + modules: + - | + package test + + p[true] := false + + q if p[true] == false + want_result: + - x: true diff --git a/test/cases/testdata/v1/regexfind/test-regexfind-0334.yaml b/test/cases/testdata/v1/regexfind/test-regexfind-0334.yaml new file mode 100644 index 0000000000..1497cd27e3 --- /dev/null +++ b/test/cases/testdata/v1/regexfind/test-regexfind-0334.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: regexfind/finds all match values + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.find_n("a.", "paranormal", -1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - - ar + - an + - al + sort_bindings: true diff --git a/test/cases/testdata/v1/regexfind/test-regexfind-0335.yaml b/test/cases/testdata/v1/regexfind/test-regexfind-0335.yaml new file mode 100644 index 0000000000..9ee8298083 --- /dev/null +++ b/test/cases/testdata/v1/regexfind/test-regexfind-0335.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: regexfind/finds specified number of match values + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.find_n("a.", "paranormal", 2, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - - ar + - an + sort_bindings: true diff --git a/test/cases/testdata/v1/regexfind/test-regexfind-0336.yaml b/test/cases/testdata/v1/regexfind/test-regexfind-0336.yaml new file mode 100644 index 0000000000..d365e70c6c --- /dev/null +++ b/test/cases/testdata/v1/regexfind/test-regexfind-0336.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: regexfind/finds no matching values + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.find_n("bork", "paranormal", -1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - [] + sort_bindings: true diff --git a/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml new file mode 100644 index 0000000000..cf6d9213a6 --- /dev/null +++ b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0337.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: regexfindallstringsubmatch/finds no matches + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.find_all_string_submatch_n("a(x*)b", "-", -1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - [] + sort_bindings: true diff --git a/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml new file mode 100644 index 0000000000..3788ad9a87 --- /dev/null +++ b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0338.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: regexfindallstringsubmatch/single match without captures + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.find_all_string_submatch_n("a(x*)b", "-ab-", -1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - - - ab + - "" + sort_bindings: true diff --git a/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml new file mode 100644 index 0000000000..d9b40e97cf --- /dev/null +++ b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0339.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: regexfindallstringsubmatch/single match with a capture + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.find_all_string_submatch_n("a(x*)b", "-axxb-", -1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - - - axxb + - xx + sort_bindings: true diff --git a/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml new file mode 100644 index 0000000000..23828ae47a --- /dev/null +++ b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0340.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: regexfindallstringsubmatch/multiple matches with captures-1 + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.find_all_string_submatch_n("a(x*)b", "-ab-axb-", -1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - - - ab + - "" + - - axb + - x + sort_bindings: true diff --git a/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml new file mode 100644 index 0000000000..516f432b42 --- /dev/null +++ b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0341.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: regexfindallstringsubmatch/multiple matches with captures-2 + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.find_all_string_submatch_n("a(x*)b", "-axxb-ab-", -1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - - - axxb + - xx + - - ab + - "" + sort_bindings: true diff --git a/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml new file mode 100644 index 0000000000..183a94ed85 --- /dev/null +++ b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0342.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: regexfindallstringsubmatch/multiple patterns, matches, and captures + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.find_all_string_submatch_n("[^aouiye]([aouiye])([^aouiye])?", "somestri", -1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - - - som + - o + - m + - - ri + - i + - "" + sort_bindings: true diff --git a/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml new file mode 100644 index 0000000000..5f69d06574 --- /dev/null +++ b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-0343.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: regexfindallstringsubmatch/multiple patterns, matches, and captures with specified number of matches + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.find_all_string_submatch_n("[^aouiye]([aouiye])([^aouiye])?", "somestri", 1, __local0__) + x = __local0__ + } + want_result: + - x: + - - - som + - o + - m diff --git a/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml new file mode 100644 index 0000000000..de3220b56e --- /dev/null +++ b/test/cases/testdata/v1/regexfindallstringsubmatch/test-regexfindallstringsubmatch-large-input.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: regexfindallstringsubmatch/large input + query: data.test.p = x + modules: + - | + package test + + p contains m if some m in regex.find_all_string_submatch_n("^.*$", input.long, -1) + input: + long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabc + want_result: + - x: + - - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabc diff --git a/test/cases/testdata/v1/regexisvalid/test-regexisvalid-0329.yaml b/test/cases/testdata/v1/regexisvalid/test-regexisvalid-0329.yaml new file mode 100644 index 0000000000..7687d8fae7 --- /dev/null +++ b/test/cases/testdata/v1/regexisvalid/test-regexisvalid-0329.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: regexisvalid/bad operand type + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = data.num + regex.is_valid(__local0__, x) + } + data: + num: 10 + want_result: + - x: false diff --git a/test/cases/testdata/v1/regexisvalid/test-regexisvalid-0330.yaml b/test/cases/testdata/v1/regexisvalid/test-regexisvalid-0330.yaml new file mode 100644 index 0000000000..1e347e74b6 --- /dev/null +++ b/test/cases/testdata/v1/regexisvalid/test-regexisvalid-0330.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: regexisvalid/bad pattern + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + regex.is_valid(`++`, x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/regexisvalid/test-regexisvalid-0331.yaml b/test/cases/testdata/v1/regexisvalid/test-regexisvalid-0331.yaml new file mode 100644 index 0000000000..dfe3eed8c1 --- /dev/null +++ b/test/cases/testdata/v1/regexisvalid/test-regexisvalid-0331.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: regexisvalid/good pattern + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + regex.is_valid(`.+`, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/regexmatch/test-regexmatch-0861.yaml b/test/cases/testdata/v1/regexmatch/test-regexmatch-0861.yaml new file mode 100644 index 0000000000..532cc9891c --- /dev/null +++ b/test/cases/testdata/v1/regexmatch/test-regexmatch-0861.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: regexmatch/regex.match + query: data.generated.p = x + modules: + - | + package generated + + p if { + regex.match("^[a-z]+\\[[0-9]+\\]$", "foo[1]") + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/regexmatchtemplate/test-regexmatchtemplate-0332.yaml b/test/cases/testdata/v1/regexmatchtemplate/test-regexmatchtemplate-0332.yaml new file mode 100644 index 0000000000..f8864a3dc7 --- /dev/null +++ b/test/cases/testdata/v1/regexmatchtemplate/test-regexmatchtemplate-0332.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: regexmatchtemplate/matches wildcard with {} + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.template_match("urn:foo:{.*}", "urn:foo:bar:baz", "{", "}", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/regexmatchtemplate/test-regexmatchtemplate-0333.yaml b/test/cases/testdata/v1/regexmatchtemplate/test-regexmatchtemplate-0333.yaml new file mode 100644 index 0000000000..fde6994f0e --- /dev/null +++ b/test/cases/testdata/v1/regexmatchtemplate/test-regexmatchtemplate-0333.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: regexmatchtemplate/matches wildcard with <> + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + regex.template_match("urn:foo:<.*>", "urn:foo:bar:baz", "<", ">", x) + } + data: {} + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/regexreplace/test-regexreplace-0001.yaml b/test/cases/testdata/v1/regexreplace/test-regexreplace-0001.yaml new file mode 100644 index 0000000000..f7744b6a28 --- /dev/null +++ b/test/cases/testdata/v1/regexreplace/test-regexreplace-0001.yaml @@ -0,0 +1,40 @@ +--- +cases: + - note: "regex.replace: test pattern match and replace" + query: data.test.p = x + modules: + - | + package test + + p := x if { + s := "-wy-wxxy-" + x := regex.replace(s, "w(x*)y", "0") + } + data: {} + want_result: + - x: -0-0- + - note: "regex.replace: work with groups" + query: data.test.p = x + modules: + - | + package test + + p := x if { + s := "foo" + x := regex.replace(s, "(foo)", "$1$1") + } + data: {} + want_result: + - x: foofoo + - note: "regex.replace: bad regex pattern: Syntax error" + query: data.test.p = x + modules: + - | + package test + + p := x if { + s := "foo" + x := regex.replace(s, "[", "$1") + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/regexsplit/test-regexsplit-0862.yaml b/test/cases/testdata/v1/regexsplit/test-regexsplit-0862.yaml new file mode 100644 index 0000000000..7babc99c94 --- /dev/null +++ b/test/cases/testdata/v1/regexsplit/test-regexsplit-0862.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "regexsplit/regex.split: empty string" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + regex.split("^[a-z]+\\[[0-9]+\\]$", "", [x]) + } + data: {} + want_result: + - x: "" diff --git a/test/cases/testdata/v1/regexsplit/test-regexsplit-0863.yaml b/test/cases/testdata/v1/regexsplit/test-regexsplit-0863.yaml new file mode 100644 index 0000000000..5e10dbc7d4 --- /dev/null +++ b/test/cases/testdata/v1/regexsplit/test-regexsplit-0863.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "regexsplit/regex.split: non-repeat pattern" + query: data.generated.p = x + modules: + - | + package generated + + p := [v, w, x, y] if { + regex.split("a", "banana", [v, w, x, y]) + } + data: {} + want_result: + - x: + - b + - "n" + - "n" + - "" diff --git a/test/cases/testdata/v1/regexsplit/test-regexsplit-0864.yaml b/test/cases/testdata/v1/regexsplit/test-regexsplit-0864.yaml new file mode 100644 index 0000000000..58adc9c58e --- /dev/null +++ b/test/cases/testdata/v1/regexsplit/test-regexsplit-0864.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "regexsplit/regex.split: repeat pattern" + query: data.generated.p = x + modules: + - | + package generated + + p := [v, w] if { + regex.split("z+", "pizza", [v, w]) + } + data: {} + want_result: + - x: + - pi + - a diff --git a/test/cases/testdata/v1/regometadatachain/test-regometadatachain-1.yaml b/test/cases/testdata/v1/regometadatachain/test-regometadatachain-1.yaml new file mode 100644 index 0000000000..69424c4caa --- /dev/null +++ b/test/cases/testdata/v1/regometadatachain/test-regometadatachain-1.yaml @@ -0,0 +1,96 @@ +--- +cases: + - note: regometadatachain/simple + query: data.testing.p = x + modules: + - | + # METADATA + # description: The Rego test suite + package testing + + # METADATA + # title: Testing annotations + # authors: + # - The OPA contributors + p := x if { + x := rego.metadata.chain() + } + want_result: + - x: + - annotations: + authors: + - name: The OPA contributors + scope: rule + title: Testing annotations + path: + - testing + - p + - annotations: + description: The Rego test suite + scope: package + path: + - testing + - note: regometadatachain/rule mixed scope + query: data.testing.p = x + modules: + - | + # METADATA + # description: The Rego test suite + package testing + + # METADATA + # scope: document + # title: Testing annotations + # authors: + # - The OPA contributors + p := "foo" if { + false + } + + # METADATA + # title: Another annotation + p := x if { + x := rego.metadata.chain() + } + want_result: + - x: + - annotations: + scope: rule + title: Another annotation + path: + - testing + - p + - annotations: + authors: + - name: The OPA contributors + scope: document + title: Testing annotations + path: + - testing + - p + - annotations: + description: The Rego test suite + scope: package + path: + - testing + - note: regometadatachain/package spanning modules + query: data.testing.p = x + modules: + - | + # METADATA + # description: A set of package annotations seen across multiple modules + package testing + - | + package testing + + p := rego.metadata.chain() + want_result: + - x: + - path: + - testing + - p + - annotations: + description: A set of package annotations seen across multiple modules + scope: package + path: + - testing diff --git a/test/cases/testdata/v1/regometadatarule/test-regometadatarule-1.yaml b/test/cases/testdata/v1/regometadatarule/test-regometadatarule-1.yaml new file mode 100644 index 0000000000..4c75d4daab --- /dev/null +++ b/test/cases/testdata/v1/regometadatarule/test-regometadatarule-1.yaml @@ -0,0 +1,48 @@ +--- +cases: + - note: regometadatarule/simple + query: data.testing.p = x + modules: + - | + # METADATA + # description: The Rego test suite + package testing + + # METADATA + # title: Testing annotations + # authors: + # - The OPA contributors + p := x if { + x := rego.metadata.rule() + } + want_result: + - x: + authors: + - name: The OPA contributors + scope: rule + title: Testing annotations + - note: regometadatarule/rule scope only + query: data.testing.p = x + modules: + - | + # METADATA + # description: The Rego test suite + package testing + + # METADATA + # title: Testing annotations + # authors: + # - The OPA contributors + p := "foo" if { + false + } + + # METADATA + # title: Another annotation + p := x if { + x := rego.metadata.rule() + } + want_result: + - x: + scope: rule + title: Another annotation diff --git a/test/cases/testdata/v1/regoparsemodule/test-regoparsemodule-0320.yaml b/test/cases/testdata/v1/regoparsemodule/test-regoparsemodule-0320.yaml new file mode 100644 index 0000000000..ecac1f0b02 --- /dev/null +++ b/test/cases/testdata/v1/regoparsemodule/test-regoparsemodule-0320.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: regoparsemodule/ok + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = data.ok + rego.parse_module("x.rego", __local0__, module) + x = module["package"].path[1].value + } + data: + ok: |- + package foo.bar + + import data.a + + p { a = true } + want_result: + - x: foo diff --git a/test/cases/testdata/v1/regoparsemodule/test-regoparsemodule-0321.yaml b/test/cases/testdata/v1/regoparsemodule/test-regoparsemodule-0321.yaml new file mode 100644 index 0000000000..15fcf005be --- /dev/null +++ b/test/cases/testdata/v1/regoparsemodule/test-regoparsemodule-0321.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: regoparsemodule/error + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = data.err + rego.parse_module("x.rego", __local0__, x) + } + data: + err: package foo. + want_error_code: eval_builtin_error + want_error: "rego_parse_error: unexpected eof token: expected ident" + strict_error: true diff --git a/test/cases/testdata/v1/rendertemplate/rendertemplate.yaml b/test/cases/testdata/v1/rendertemplate/rendertemplate.yaml new file mode 100644 index 0000000000..54b0f2bf4a --- /dev/null +++ b/test/cases/testdata/v1/rendertemplate/rendertemplate.yaml @@ -0,0 +1,54 @@ +--- +cases: + - note: rendertemplate/simple + query: data.test.p = x + modules: + - | + package test + + template_string := `{{.test}}` + + template_vars := {`test`: `hello world`} + + p := strings.render_template(template_string, template_vars) + want_result: + - x: hello world + - note: rendertemplate/simpleint + query: data.test.p = x + modules: + - | + package test + + template_string := `{{.test}}` + + template_vars := {`test`: 2023} + + p := strings.render_template(template_string, template_vars) + want_result: + - x: "2023" + - note: rendertemplate/complex + query: data.test.p = x + modules: + - | + package test + + template_string := `{{range $i, $name := .hellonames}}{{if $i}},{{end}}hello {{$name}}{{end}}` + + template_vars := {`hellonames`: [`rohan`, `john doe`]} + + p := strings.render_template(template_string, template_vars) + want_result: + - x: hello rohan,hello john doe + - note: rendertemplate/missingkey + query: data.test.p = x + modules: + - | + package test + + template_string := `{{.testvarnotprovided}}` + + template_vars := {`test`: `hello world`} + + p := strings.render_template(template_string, template_vars) + want_error_code: eval_builtin_error + strict_error: true diff --git a/test/cases/testdata/v1/replacen/test-replacen-0374.yaml b/test/cases/testdata/v1/replacen/test-replacen-0374.yaml new file mode 100644 index 0000000000..f035fc1d32 --- /dev/null +++ b/test/cases/testdata/v1/replacen/test-replacen-0374.yaml @@ -0,0 +1,41 @@ +--- +cases: + - note: replacen/replace multiple patterns + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + strings.replace_n({"<": "<", ">": ">"}, "This is HTML!", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - This is <b>HTML</b>! + sort_bindings: true + - note: replacen/replace multiple patterns/overlapping + query: data.test.p = x + modules: + - | + package test + + p := strings.replace_n({"f": "x", "foo": "xxx"}, "foobar") + data: {} + want_result: + - x: xoobar + - note: replacen/replace multiple patterns/overlapping/insertion order does not matter + query: data.test.p = x + modules: + - | + package test + + p := x if { + x := strings.replace_n({k: v | k := ["f", "foo"][i]; v := ["x", "xxx"][i]}, "foo") + y := strings.replace_n({k: v | k := ["foo", "f"][i]; v := ["xxx", "x"][i]}, "foo") + x == y + } + data: {} + want_result: + - x: xoo diff --git a/test/cases/testdata/v1/replacen/test-replacen-0375.yaml b/test/cases/testdata/v1/replacen/test-replacen-0375.yaml new file mode 100644 index 0000000000..a22db22fc2 --- /dev/null +++ b/test/cases/testdata/v1/replacen/test-replacen-0375.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: replacen/find no patterns + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + strings.replace_n({"old1": "new1", "old2": "new2"}, "Everything is new1, new2", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: + - Everything is new1, new2 + sort_bindings: true diff --git a/test/cases/testdata/v1/replacen/test-replacen-bad-operands.yaml b/test/cases/testdata/v1/replacen/test-replacen-bad-operands.yaml new file mode 100644 index 0000000000..2649226759 --- /dev/null +++ b/test/cases/testdata/v1/replacen/test-replacen-bad-operands.yaml @@ -0,0 +1,37 @@ +--- +cases: + - note: replacen/bad pattern object operand/non-string key + query: data.test.p = x + modules: + - | + package test + + p := strings.replace_n({2: "x" | true}, "foo") + want_error_code: eval_type_error + want_error: "strings.replace_n: operand 1 non-string key found in pattern object" + strict_error: true + - note: replacen/bad pattern object operand/non-string value + query: data.test.p = x + modules: + - | + package test + + p := strings.replace_n(data.pattern, "foo") + data: + pattern: + f: 100 + want_error_code: eval_type_error + want_error: "strings.replace_n: operand 1 non-string value found in pattern object" + strict_error: true + - note: replacen/bad pattern object operand/non-string value + query: data.test.p = x + modules: + - | + package test + + p := strings.replace_n({"foo": "baz"}, data.string) + data: + string: 100 + want_error_code: eval_type_error + want_error: "strings.replace_n: operand 2 must be string but got number" + strict_error: true diff --git a/test/cases/testdata/v1/semvercompare/test-semvercompare-0344.yaml b/test/cases/testdata/v1/semvercompare/test-semvercompare-0344.yaml new file mode 100644 index 0000000000..5e2ef4839b --- /dev/null +++ b/test/cases/testdata/v1/semvercompare/test-semvercompare-0344.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: semvercompare/a < b + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + semver.compare("1.0.0", "2.0.0", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: -1 diff --git a/test/cases/testdata/v1/semvercompare/test-semvercompare-0345.yaml b/test/cases/testdata/v1/semvercompare/test-semvercompare-0345.yaml new file mode 100644 index 0000000000..8eb6f9b441 --- /dev/null +++ b/test/cases/testdata/v1/semvercompare/test-semvercompare-0345.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: semvercompare/a > b + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + semver.compare("2.0.0", "1.0.0", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/semvercompare/test-semvercompare-0346.yaml b/test/cases/testdata/v1/semvercompare/test-semvercompare-0346.yaml new file mode 100644 index 0000000000..6ab3ad2ade --- /dev/null +++ b/test/cases/testdata/v1/semvercompare/test-semvercompare-0346.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: semvercompare/a == b + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + semver.compare("1.0.0", "1.0.0", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: 0 diff --git a/test/cases/testdata/v1/semvercompare/test-semvercompare-0347.yaml b/test/cases/testdata/v1/semvercompare/test-semvercompare-0347.yaml new file mode 100644 index 0000000000..742beda199 --- /dev/null +++ b/test/cases/testdata/v1/semvercompare/test-semvercompare-0347.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: semvercompare/invalid version a + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + semver.compare("1", "1.0.0", __local0__) + x = __local0__ + } + want_error_code: eval_builtin_error + want_error: 'semver.compare: operand 1: string "1" is not a valid SemVer' + strict_error: true diff --git a/test/cases/testdata/v1/semvercompare/test-semvercompare-0348.yaml b/test/cases/testdata/v1/semvercompare/test-semvercompare-0348.yaml new file mode 100644 index 0000000000..0f0c011251 --- /dev/null +++ b/test/cases/testdata/v1/semvercompare/test-semvercompare-0348.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: semvercompare/invalid version b + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + semver.compare("1.0.0", "1", __local0__) + x = __local0__ + } + data: {} + want_error_code: eval_builtin_error + want_error: 'semver.compare: operand 2: string "1" is not a valid SemVer' + strict_error: true diff --git a/test/cases/testdata/v1/semverisvalid/test-semverisvalid-0349.yaml b/test/cases/testdata/v1/semverisvalid/test-semverisvalid-0349.yaml new file mode 100644 index 0000000000..67322b9a0f --- /dev/null +++ b/test/cases/testdata/v1/semverisvalid/test-semverisvalid-0349.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: semverisvalid/valid + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + semver.is_valid("1.0.0", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/semverisvalid/test-semverisvalid-0350.yaml b/test/cases/testdata/v1/semverisvalid/test-semverisvalid-0350.yaml new file mode 100644 index 0000000000..ff23972419 --- /dev/null +++ b/test/cases/testdata/v1/semverisvalid/test-semverisvalid-0350.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: semverisvalid/invalid version + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + semver.is_valid("1", __local0__) + x = __local0__ + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/semverisvalid/test-semverisvalid-0351.yaml b/test/cases/testdata/v1/semverisvalid/test-semverisvalid-0351.yaml new file mode 100644 index 0000000000..b618638dff --- /dev/null +++ b/test/cases/testdata/v1/semverisvalid/test-semverisvalid-0351.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: semverisvalid/invalid type + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + semver.is_valid(1, __local0__) + x = __local0__ + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/sets/test-sets-0871.yaml b/test/cases/testdata/v1/sets/test-sets-0871.yaml new file mode 100644 index 0000000000..0105f3c626 --- /dev/null +++ b/test/cases/testdata/v1/sets/test-sets-0871.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: sets/set_diff + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + s1 = {1, 2, 3, 4} + s2 = {1, 3} + __local0__ = s1 - s2 + x = __local0__ + } + data: {} + want_result: + - x: + - 2 + - 4 diff --git a/test/cases/testdata/v1/sets/test-sets-0872.yaml b/test/cases/testdata/v1/sets/test-sets-0872.yaml new file mode 100644 index 0000000000..4f8c090a28 --- /dev/null +++ b/test/cases/testdata/v1/sets/test-sets-0872.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "sets/set_diff: refs" + query: data.generated.p = x + modules: + - | + package generated + + p = x if { + __local0__ := data.a[0] + __local1__ := data.a[1] + __local2__ := data.a[2] + s1 := {__local0__, __local1__, __local2__} + __local3__ := data.a[0] + s2 := {2, __local3__} + x := s1 - s2 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 3 diff --git a/test/cases/testdata/v1/sets/test-sets-0873.yaml b/test/cases/testdata/v1/sets/test-sets-0873.yaml new file mode 100644 index 0000000000..718b5d593c --- /dev/null +++ b/test/cases/testdata/v1/sets/test-sets-0873.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: "sets/set_diff: ground output" + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = {1, 2, 3} - {2, 3} + {1} = __local0__ + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/sets/test-sets-0874.yaml b/test/cases/testdata/v1/sets/test-sets-0874.yaml new file mode 100644 index 0000000000..493ad83693 --- /dev/null +++ b/test/cases/testdata/v1/sets/test-sets-0874.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "sets/set_diff: virt docs" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local1__ = data.generated.s1 + __local2__ = data.generated.s2 + __local0__ = __local1__ - __local2__ + x = __local0__ + } + + s1 contains 1 + + s1 contains 2 + + s1 contains "c" + + s2 := {"c", 1} + data: {} + want_result: + - x: + - 2 diff --git a/test/cases/testdata/v1/sets/test-sets-0875.yaml b/test/cases/testdata/v1/sets/test-sets-0875.yaml new file mode 100644 index 0000000000..8c81727d59 --- /dev/null +++ b/test/cases/testdata/v1/sets/test-sets-0875.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: sets/intersect + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local1__ = data.a[1] + __local2__ = data.a[2] + __local3__ = data.a[2] + __local0__ = {3, __local1__, __local2__} & {3, 4, __local3__} + x = __local0__ + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 3 diff --git a/test/cases/testdata/v1/sets/test-sets-0876.yaml b/test/cases/testdata/v1/sets/test-sets-0876.yaml new file mode 100644 index 0000000000..b5a31cbe72 --- /dev/null +++ b/test/cases/testdata/v1/sets/test-sets-0876.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: sets/union + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local1__ = data.a[1] + __local2__ = data.a[2] + __local3__ = data.a[2] + __local0__ = {3, __local1__, __local2__} | {3, 4, __local3__} + {2, 3, 4} = __local0__ + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/sprintf/test-sprintf.yaml b/test/cases/testdata/v1/sprintf/test-sprintf.yaml new file mode 100644 index 0000000000..f5a57b436f --- /dev/null +++ b/test/cases/testdata/v1/sprintf/test-sprintf.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: sprintf/big_int + query: data.test.p = x + modules: + - | + package test + + p := x if { + x = sprintf("%s", [123456789123456789123]) + } + want_result: + - x: "123456789123456789123" + - note: sprintf/big_int/max_cert_serial_number + query: data.test.p = x + modules: + - | + package test + + p := x if { + x = sprintf("%s", [1208925819614629174706175]) + } + want_result: + - x: "1208925819614629174706175" diff --git a/test/cases/testdata/v1/strings/test-anyprefixmatch.yaml b/test/cases/testdata/v1/strings/test-anyprefixmatch.yaml new file mode 100644 index 0000000000..217bc093f7 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-anyprefixmatch.yaml @@ -0,0 +1,430 @@ +--- +cases: + - note: strings/any_prefix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - a/ + - d/ + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: + - x: true + - note: strings/any_prefix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - f/ + - d/ + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: [] + - note: strings/any_prefix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - a/b/ + - a/ + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: + - x: true + - note: strings/any_prefix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - d/ + - e/f/g + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: + - x: true + - note: strings/any_prefix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - aa/b + - e/f + strings: + - aa/bb/cc + - aa/bb/dd + - ee/ff/gg + want_result: + - x: true + - note: strings/any_prefix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - a/b + - e/f + strings: + - aa/bb/cc + - aa/bb/dd + - ee/ff/gg + want_result: [] + - note: strings/any_prefix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - b/cc + strings: + - aa/bb/cc + - aa/bb/dd + - ee/ff/gg + want_result: [] + - note: strings/any_prefix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - a/b + - e/f + strings: [] + want_result: [] + - note: strings/any_prefix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: [] + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: [] + - note: strings/any_prefix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: [] + strings: [] + want_result: [] + - note: strings/any_prefix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefix) + } + input: + prefix: a/ + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: + - x: true + - note: strings/any_prefix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefix) + } + input: + prefix: d/ + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: [] + - note: strings/any_prefix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.string, input.prefixes) + } + input: + prefixes: + - a/ + - d/ + string: a/b/c + want_result: + - x: true + - note: strings/any_prefix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.string, input.prefixes) + } + input: + prefixes: + - g/ + - d/ + string: a/b/c + want_result: [] + - note: strings/any_prefix_match/match + query: data.test.p = x + modules: + - | + package test + + strings_set contains str if { + str := input.strings[_] + } + + prefixes_set contains prefix if { + prefix := input.prefixes[_] + } + + p if { + strings.any_prefix_match(strings_set, prefixes_set) + } + input: + prefixes: + - a/ + - d/ + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: + - x: true + - note: strings/any_prefix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + strings_set contains str if { + str := input.strings[_] + } + + prefixes_set contains prefix if { + prefix := input.prefixes[_] + } + + p if { + strings.any_prefix_match(strings_set, prefixes_set) + } + input: + prefixes: + - f/ + - d/ + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: [] + - note: strings/any_prefix_match/type_error_nostrict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - f/ + - d/ + strings: + - "1" + - "2" + - "3" + want_result: [] + - note: strings/any_prefix_match/type_error_nostrict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - f/ + - d/ + strings: 1 + want_result: [] + - note: strings/any_prefix_match/type_error_nostrict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - "1" + - "2" + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: [] + - note: strings/any_prefix_match/type_error_nostrict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: 1 + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: [] + - note: strings/any_prefix_match/type_error_strict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - f/ + - d/ + strings: + - 1 + - 2 + - 3 + want_error: "test-0.rego:4: eval_type_error: strings.any_prefix_match: operand 1 must be array of strings but got array containing number" + strict_error: true + - note: strings/any_prefix_match/type_error_strict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - f/ + - d/ + strings: 1 + want_error: "test-0.rego:4: eval_type_error: strings.any_prefix_match: operand 1 must be one of {string, set, array} but got number" + strict_error: true + - note: strings/any_prefix_match/type_error_strict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: + - 1 + - 2 + strings: + - a/b/c + - a/b/d + - e/f/g + want_error: "test-0.rego:4: eval_type_error: strings.any_prefix_match: operand 2 must be array of strings but got array containing number" + strict_error: true + - note: strings/any_prefix_match/type_error_strict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_prefix_match(input.strings, input.prefixes) + } + input: + prefixes: 1 + strings: + - a/b/c + - a/b/d + - e/f/g + want_error: "test-0.rego:4: eval_type_error: strings.any_prefix_match: operand 2 must be one of {string, set, array} but got number" + strict_error: true diff --git a/test/cases/testdata/v1/strings/test-anysuffixmatch.yaml b/test/cases/testdata/v1/strings/test-anysuffixmatch.yaml new file mode 100644 index 0000000000..1db3eb321b --- /dev/null +++ b/test/cases/testdata/v1/strings/test-anysuffixmatch.yaml @@ -0,0 +1,430 @@ +--- +cases: + - note: strings/any_suffix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffixes) + } + input: + strings: + - a/b/c + - a/b/d + - e/f/g + suffixes: + - /c + - /a + want_result: + - x: true + - note: strings/any_suffix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffixes) + } + input: + strings: + - a/b/c + - a/b/d + - e/f/g + suffixes: + - /f + - /a + want_result: [] + - note: strings/any_suffix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffixes) + } + input: + strings: + - a/b/c + - a/b/d + - e/f/g + suffixes: + - /b/c + - /d + want_result: + - x: true + - note: strings/any_suffix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffixes) + } + input: + strings: + - a/b/c + - a/b/d + - e/f/g + suffixes: + - /a + - e/f/g + want_result: + - x: true + - note: strings/any_suffix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffixes) + } + input: + strings: + - aa/bb/cc + - aa/bb/dd + - ee/ff/gg + suffixes: + - b/cc + - f/g + want_result: + - x: true + - note: strings/any_suffix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffixes) + } + input: + strings: + - aa/bb/cc + - aa/bb/dd + - ee/ff/gg + suffixes: + - b/c + - f/g + want_result: [] + - note: strings/any_suffix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffixes) + } + input: + strings: + - aa/bb/cc + - aa/bb/dd + - ee/ff/gg + suffixes: + - aa/b + want_result: [] + - note: strings/any_suffix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffixes) + } + input: + strings: [] + suffixes: + - a/b + - e/f + want_result: [] + - note: strings/any_suffix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffixes) + } + input: + strings: + - a/b/c + - a/b/d + - e/f/g + suffixes: [] + want_result: [] + - note: strings/any_suffix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffixes) + } + input: + strings: [] + suffixes: [] + want_result: [] + - note: strings/any_suffix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffix) + } + input: + strings: + - a/b/c + - a/b/d + - e/f/g + suffix: /c + want_result: + - x: true + - note: strings/any_suffix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.suffix) + } + input: + strings: + - a/b/c + - a/b/d + - e/f/g + suffix: /h + want_result: [] + - note: strings/any_suffix_match/match + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.string, input.suffixes) + } + input: + string: a/b/c + suffixes: + - /c + - /a + want_result: + - x: true + - note: strings/any_suffix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.string, input.suffixes) + } + input: + string: a/b/g + suffixes: + - /c + - /a + want_result: [] + - note: strings/any_suffix_match/match + query: data.test.p = x + modules: + - | + package test + + strings_set contains str if { + str := input.strings[_] + } + + suffixes_set contains suffix if { + suffix := input.suffixes[_] + } + + p if { + strings.any_suffix_match(strings_set, suffixes_set) + } + input: + strings: + - a/b/c + - a/b/d + - e/f/g + suffixes: + - /c + - /a + want_result: + - x: true + - note: strings/any_suffix_match/nomatch + query: data.test.p = x + modules: + - | + package test + + strings_set contains str if { + str := input.strings[_] + } + + suffixes_set contains suffix if { + suffix := input.suffixes[_] + } + + p if { + strings.any_suffix_match(strings_set, suffixes_set) + } + input: + strings: + - a/b/c + - a/b/d + - e/f/g + suffixes: + - /f + - /a + want_result: [] + - note: strings/any_suffix_match/type_error_nostrict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.prefixes) + } + input: + prefixes: + - f/ + - d/ + strings: + - 1 + - 2 + - 3 + want_result: [] + - note: strings/any_suffix_match/type_error_nostrict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.prefixes) + } + input: + prefixes: + - f/ + - d/ + strings: 1 + want_result: [] + - note: strings/any_suffix_match/type_error_nostrict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.prefixes) + } + input: + prefixes: + - 1 + - 2 + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: [] + - note: strings/any_suffix_match/type_error_nostrict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.prefixes) + } + input: + prefixes: 1 + strings: + - a/b/c + - a/b/d + - e/f/g + want_result: [] + - note: strings/any_suffix_match/type_error_strict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.prefixes) + } + input: + prefixes: + - f/ + - d/ + strings: + - 1 + - 2 + - 3 + want_error: "test-0.rego:4: eval_type_error: strings.any_suffix_match: operand 1 must be array of strings but got array containing number" + strict_error: true + - note: strings/any_suffix_match/type_error_strict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.prefixes) + } + input: + prefixes: + - f/ + - d/ + strings: 1 + want_error: "test-0.rego:4: eval_type_error: strings.any_suffix_match: operand 1 must be one of {string, set, array} but got number" + strict_error: true + - note: strings/any_suffix_match/type_error_strict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.prefixes) + } + input: + prefixes: + - 1 + - 2 + strings: + - a/b/c + - a/b/d + - e/f/g + want_error: "test-0.rego:4: eval_type_error: strings.any_suffix_match: operand 2 must be array of strings but got array containing number" + strict_error: true + - note: strings/any_suffix_match/type_error_strict + query: data.test.p = x + modules: + - | + package test + + p if { + strings.any_suffix_match(input.strings, input.prefixes) + } + input: + prefixes: 1 + strings: + - a/b/c + - a/b/d + - e/f/g + want_error: "test-0.rego:4: eval_type_error: strings.any_suffix_match: operand 2 must be one of {string, set, array} but got number" + strict_error: true diff --git a/test/cases/testdata/v1/strings/test-strings-0877.yaml b/test/cases/testdata/v1/strings/test-strings-0877.yaml new file mode 100644 index 0000000000..3098c70937 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0877.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: strings/format_int + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + format_int(15.5, 16, x) + } + data: {} + want_result: + - x: f diff --git a/test/cases/testdata/v1/strings/test-strings-0878.yaml b/test/cases/testdata/v1/strings/test-strings-0878.yaml new file mode 100644 index 0000000000..39f79c038b --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0878.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "strings/format_int: undefined" + query: data.generated.p = x + modules: + - | + package generated + + p if { + format_int(15.5, 16, "10000") + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/strings/test-strings-0879.yaml b/test/cases/testdata/v1/strings/test-strings-0879.yaml new file mode 100644 index 0000000000..a4a88e8f0f --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0879.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "strings/format_int: ref dest" + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.numbers[2] + format_int(3.1, 10, __local0__) + } + data: + numbers: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: true diff --git a/test/cases/testdata/v1/strings/test-strings-0880.yaml b/test/cases/testdata/v1/strings/test-strings-0880.yaml new file mode 100644 index 0000000000..b07a2aaa3e --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0880.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "strings/format_int: ref dest (2)" + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.numbers[2] + not format_int(4.1, 10, __local0__) + } + data: + numbers: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: true diff --git a/test/cases/testdata/v1/strings/test-strings-0881.yaml b/test/cases/testdata/v1/strings/test-strings-0881.yaml new file mode 100644 index 0000000000..c8a320c5c7 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0881.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/format_int: err: bad base" + query: data.generated.p = x + modules: + - | + package generated + + p if { + format_int(4.1, 199, x) + } + want_error_code: eval_type_error + want_error: operand 2 must be one of {2, 8, 10, 16} + strict_error: true diff --git a/test/cases/testdata/v1/strings/test-strings-0882.yaml b/test/cases/testdata/v1/strings/test-strings-0882.yaml new file mode 100644 index 0000000000..22194f38cc --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0882.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: strings/concat + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + concat("/", ["", "foo", "bar", "0", "baz"], x) + } + data: {} + want_result: + - x: /foo/bar/0/baz diff --git a/test/cases/testdata/v1/strings/test-strings-0883.yaml b/test/cases/testdata/v1/strings/test-strings-0883.yaml new file mode 100644 index 0000000000..0bbaefa5aa --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0883.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "strings/concat: set" + query: data.test.p = x + modules: + - | + package test + + # Sets are unordered, so the output is not guaranteed. + # These are theoretically possible: + possibilities := { + "1,2,3", + "2,3,1", + "3,1,2", + "3,2,1", + "2,1,3", + "1,3,2", + } + + p if { + x := concat(",", {"1", "2", "3"}) + possibilities[x] + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/strings/test-strings-0884.yaml b/test/cases/testdata/v1/strings/test-strings-0884.yaml new file mode 100644 index 0000000000..75fac3d257 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0884.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "strings/concat: undefined" + query: data.generated.p = x + modules: + - | + package generated + + p if { + concat("/", ["a", "b"], "deadbeef") + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/strings/test-strings-0885.yaml b/test/cases/testdata/v1/strings/test-strings-0885.yaml new file mode 100644 index 0000000000..484e37ea00 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0885.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "strings/concat: ref dest" + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.c[0].x[2] + concat("", ["f", "o", "o"], __local0__) + } + data: + c: + - "true": + - null + - "3.14159" + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: true diff --git a/test/cases/testdata/v1/strings/test-strings-0886.yaml b/test/cases/testdata/v1/strings/test-strings-0886.yaml new file mode 100644 index 0000000000..1a915fa615 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0886.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "strings/concat: ref dest (2)" + query: data.generated.p = x + modules: + - | + package generated + + p if { + __local0__ = data.c[0].x[2] + not concat("", ["b", "a", "r"], __local0__) + } + data: + c: + - "true": + - null + - "3.14159" + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: true diff --git a/test/cases/testdata/v1/strings/test-strings-0887.yaml b/test/cases/testdata/v1/strings/test-strings-0887.yaml new file mode 100644 index 0000000000..a4f982d338 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0887.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: strings/indexof + query: data.test.p = x + modules: + - | + package test + + p := x if { + indexof("abcdefgh", "cde", x) + } + want_result: + - x: 2 + - note: strings/indexof + query: data.test.p = x + modules: + - | + package test + + p := x if { + indexof("abcabcabcdefgh", "cde", x) + } + want_result: + - x: 8 diff --git a/test/cases/testdata/v1/strings/test-strings-0888.yaml b/test/cases/testdata/v1/strings/test-strings-0888.yaml new file mode 100644 index 0000000000..464a7c326b --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0888.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/indexof: not found" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + indexof("abcdefgh", "xyz", x) + } + data: {} + want_result: + - x: -1 diff --git a/test/cases/testdata/v1/strings/test-strings-0889.yaml b/test/cases/testdata/v1/strings/test-strings-0889.yaml new file mode 100644 index 0000000000..39e7844e69 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0889.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: strings/substring + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("abcdefgh", 2, 3, x) + } + data: {} + want_result: + - x: cde + - note: "strings/substring: unicode" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("åäö", 0, 2, x) + } + want_result: + - x: åä diff --git a/test/cases/testdata/v1/strings/test-strings-0890.yaml b/test/cases/testdata/v1/strings/test-strings-0890.yaml new file mode 100644 index 0000000000..2a81bd9cf0 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0890.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "strings/substring: remainder" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("abcdefgh", 2, -1, x) + } + data: {} + want_result: + - x: cdefgh + - note: "strings/substring: remainder unicode" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("aåäö", 2, -1, x) + } + want_result: + - x: äö diff --git a/test/cases/testdata/v1/strings/test-strings-0891.yaml b/test/cases/testdata/v1/strings/test-strings-0891.yaml new file mode 100644 index 0000000000..feacbbf49c --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0891.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "strings/substring: too long" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("abcdefgh", 2, 10000, x) + } + data: {} + want_result: + - x: cdefgh + - note: "strings/substring: too long unicode" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("abcdefghåäö", 2, 10000, x) + } + want_result: + - x: cdefghåäö diff --git a/test/cases/testdata/v1/strings/test-strings-0892.yaml b/test/cases/testdata/v1/strings/test-strings-0892.yaml new file mode 100644 index 0000000000..fa4b69d32c --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0892.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "strings/substring: offset negative" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("aaa", -1, -1, x) + } + want_error_code: eval_builtin_error + want_error: negative offset + strict_error: true + - note: "strings/substring: offset negative unicode" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("åäö", -1, -1, x) + } + want_error_code: eval_builtin_error + want_error: negative offset + strict_error: true diff --git a/test/cases/testdata/v1/strings/test-strings-0893.yaml b/test/cases/testdata/v1/strings/test-strings-0893.yaml new file mode 100644 index 0000000000..a138064b29 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0893.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "strings/substring: offset too long" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("aaa", 3, -1, x) + } + data: {} + want_result: + - x: "" + - note: "strings/substring: offset too long unicode" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("åäö", 3, -1, x) + } + want_result: + - x: "" diff --git a/test/cases/testdata/v1/strings/test-strings-0894.yaml b/test/cases/testdata/v1/strings/test-strings-0894.yaml new file mode 100644 index 0000000000..4d357481e8 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0894.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "strings/substring: offset too long 2" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("aaa", 4, -1, x) + } + data: {} + want_result: + - x: "" + - note: "strings/substring: offset too long 2 unicode" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + substring("åäö", 4, -1, x) + } + want_result: + - x: "" diff --git a/test/cases/testdata/v1/strings/test-strings-0895.yaml b/test/cases/testdata/v1/strings/test-strings-0895.yaml new file mode 100644 index 0000000000..035c44ae5b --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0895.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: strings/contains + query: data.generated.p = x + modules: + - | + package generated + + p if { + contains("abcdefgh", "defg") + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/strings/test-strings-0896.yaml b/test/cases/testdata/v1/strings/test-strings-0896.yaml new file mode 100644 index 0000000000..a7499f950c --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0896.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "strings/contains: undefined" + query: data.generated.p = x + modules: + - | + package generated + + p if { + contains("abcdefgh", "ac") + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/strings/test-strings-0897.yaml b/test/cases/testdata/v1/strings/test-strings-0897.yaml new file mode 100644 index 0000000000..ddba86ec3e --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0897.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: strings/startswith + query: data.generated.p = x + modules: + - | + package generated + + p if { + startswith("abcdefgh", "abcd") + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/strings/test-strings-0898.yaml b/test/cases/testdata/v1/strings/test-strings-0898.yaml new file mode 100644 index 0000000000..d42d12b86f --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0898.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "strings/startswith: undefined" + query: data.generated.p = x + modules: + - | + package generated + + p if { + startswith("abcdefgh", "bcd") + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/strings/test-strings-0899.yaml b/test/cases/testdata/v1/strings/test-strings-0899.yaml new file mode 100644 index 0000000000..e4b6d3af6c --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0899.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: strings/endswith + query: data.generated.p = x + modules: + - | + package generated + + p if { + endswith("abcdefgh", "fgh") + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/strings/test-strings-0900.yaml b/test/cases/testdata/v1/strings/test-strings-0900.yaml new file mode 100644 index 0000000000..49245edfbf --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0900.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: "strings/endswith: undefined" + query: data.generated.p = x + modules: + - | + package generated + + p if { + endswith("abcdefgh", "fg") + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/strings/test-strings-0901.yaml b/test/cases/testdata/v1/strings/test-strings-0901.yaml new file mode 100644 index 0000000000..4b72b0a8bf --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0901.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: strings/lower + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + lower("AbCdEf", x) + } + data: {} + want_result: + - x: abcdef diff --git a/test/cases/testdata/v1/strings/test-strings-0902.yaml b/test/cases/testdata/v1/strings/test-strings-0902.yaml new file mode 100644 index 0000000000..6d29195f74 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0902.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: strings/upper + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + upper("AbCdEf", x) + } + data: {} + want_result: + - x: ABCDEF diff --git a/test/cases/testdata/v1/strings/test-strings-0903.yaml b/test/cases/testdata/v1/strings/test-strings-0903.yaml new file mode 100644 index 0000000000..4bd0d3e44c --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0903.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/split: empty string" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + split("", ".", [x]) + } + data: {} + want_result: + - x: "" diff --git a/test/cases/testdata/v1/strings/test-strings-0904.yaml b/test/cases/testdata/v1/strings/test-strings-0904.yaml new file mode 100644 index 0000000000..4a0d68544d --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0904.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/split: one" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + split("foo", ".", [x]) + } + data: {} + want_result: + - x: foo diff --git a/test/cases/testdata/v1/strings/test-strings-0905.yaml b/test/cases/testdata/v1/strings/test-strings-0905.yaml new file mode 100644 index 0000000000..9e928b0720 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0905.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "strings/split: many" + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y] if { + split("foo.bar.baz", ".", [x, "bar", y]) + } + data: {} + want_result: + - x: + - foo + - baz diff --git a/test/cases/testdata/v1/strings/test-strings-0906.yaml b/test/cases/testdata/v1/strings/test-strings-0906.yaml new file mode 100644 index 0000000000..de222313d8 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0906.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/replace: empty string" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + replace("", "hi", "bye", x) + } + data: {} + want_result: + - x: "" diff --git a/test/cases/testdata/v1/strings/test-strings-0907.yaml b/test/cases/testdata/v1/strings/test-strings-0907.yaml new file mode 100644 index 0000000000..5f0f72dcb2 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0907.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/replace: one" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + replace("foo.bar", ".", ",", x) + } + data: {} + want_result: + - x: foo,bar diff --git a/test/cases/testdata/v1/strings/test-strings-0908.yaml b/test/cases/testdata/v1/strings/test-strings-0908.yaml new file mode 100644 index 0000000000..e2b57e5202 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0908.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/replace: many" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + replace("foo.bar.baz", ".", ",", x) + } + data: {} + want_result: + - x: foo,bar,baz diff --git a/test/cases/testdata/v1/strings/test-strings-0909.yaml b/test/cases/testdata/v1/strings/test-strings-0909.yaml new file mode 100644 index 0000000000..4be2cb147f --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0909.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/replace: overlap" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + replace("foo...bar", "..", ",,", x) + } + data: {} + want_result: + - x: foo,,.bar diff --git a/test/cases/testdata/v1/strings/test-strings-0910.yaml b/test/cases/testdata/v1/strings/test-strings-0910.yaml new file mode 100644 index 0000000000..04151043a9 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0910.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/trim: empty string" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + trim("", ".", x) + } + data: {} + want_result: + - x: "" diff --git a/test/cases/testdata/v1/strings/test-strings-0911.yaml b/test/cases/testdata/v1/strings/test-strings-0911.yaml new file mode 100644 index 0000000000..35bd22c17c --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0911.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/trim: end" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + trim("foo.bar...", ".", x) + } + data: {} + want_result: + - x: foo.bar diff --git a/test/cases/testdata/v1/strings/test-strings-0912.yaml b/test/cases/testdata/v1/strings/test-strings-0912.yaml new file mode 100644 index 0000000000..b377cad5b1 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0912.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/trim: start" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + trim("...foo.bar", ".", x) + } + data: {} + want_result: + - x: foo.bar diff --git a/test/cases/testdata/v1/strings/test-strings-0913.yaml b/test/cases/testdata/v1/strings/test-strings-0913.yaml new file mode 100644 index 0000000000..adabba912d --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0913.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/trim: both" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + trim("...foo.bar...", ".", x) + } + data: {} + want_result: + - x: foo.bar diff --git a/test/cases/testdata/v1/strings/test-strings-0914.yaml b/test/cases/testdata/v1/strings/test-strings-0914.yaml new file mode 100644 index 0000000000..a2e9b81182 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0914.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/trim: multi-cutset" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + trim("...foo.bar...", ".fr", x) + } + data: {} + want_result: + - x: oo.ba diff --git a/test/cases/testdata/v1/strings/test-strings-0915.yaml b/test/cases/testdata/v1/strings/test-strings-0915.yaml new file mode 100644 index 0000000000..af40b661e4 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0915.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/trim: multi-cutset-none" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + trim("...foo.bar...", ".o", x) + } + data: {} + want_result: + - x: foo.bar diff --git a/test/cases/testdata/v1/strings/test-strings-0916.yaml b/test/cases/testdata/v1/strings/test-strings-0916.yaml new file mode 100644 index 0000000000..1ad9853462 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0916.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/sprintf: none" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sprintf("hi", [], x) + } + data: {} + want_result: + - x: hi diff --git a/test/cases/testdata/v1/strings/test-strings-0917.yaml b/test/cases/testdata/v1/strings/test-strings-0917.yaml new file mode 100644 index 0000000000..06b857da81 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0917.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/sprintf: string" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sprintf("hi %s", ["there"], x) + } + data: {} + want_result: + - x: hi there diff --git a/test/cases/testdata/v1/strings/test-strings-0918.yaml b/test/cases/testdata/v1/strings/test-strings-0918.yaml new file mode 100644 index 0000000000..37e51f0c1a --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0918.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/sprintf: int" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sprintf("hi %02d", [5], x) + } + data: {} + want_result: + - x: hi 05 diff --git a/test/cases/testdata/v1/strings/test-strings-0919.yaml b/test/cases/testdata/v1/strings/test-strings-0919.yaml new file mode 100644 index 0000000000..82c48aba0f --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0919.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/sprintf: hex" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sprintf("hi %02X.%02X", [127, 1], x) + } + data: {} + want_result: + - x: hi 7F.01 diff --git a/test/cases/testdata/v1/strings/test-strings-0920.yaml b/test/cases/testdata/v1/strings/test-strings-0920.yaml new file mode 100644 index 0000000000..89c10bea1f --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0920.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/sprintf: float" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sprintf("hi %.2f", [3.1415], x) + } + data: {} + want_result: + - x: hi 3.14 diff --git a/test/cases/testdata/v1/strings/test-strings-0921.yaml b/test/cases/testdata/v1/strings/test-strings-0921.yaml new file mode 100644 index 0000000000..b4d5414d32 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0921.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/sprintf: float too big" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sprintf("hi %v", [2e308], x) + } + data: {} + want_result: + - x: hi 2e308 diff --git a/test/cases/testdata/v1/strings/test-strings-0922.yaml b/test/cases/testdata/v1/strings/test-strings-0922.yaml new file mode 100644 index 0000000000..1a5edc45e7 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0922.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/sprintf: bool" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sprintf("hi %s", [true], x) + } + data: {} + want_result: + - x: hi true diff --git a/test/cases/testdata/v1/strings/test-strings-0923.yaml b/test/cases/testdata/v1/strings/test-strings-0923.yaml new file mode 100644 index 0000000000..056fa96002 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0923.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: "strings/sprintf: composite" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + sprintf("hi %v", [["there", 5, 3.14]], x) + } + data: {} + want_result: + - x: hi ["there", 5, 3.14] diff --git a/test/cases/testdata/v1/strings/test-strings-0924.yaml b/test/cases/testdata/v1/strings/test-strings-0924.yaml new file mode 100644 index 0000000000..e8d6de78aa --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0924.yaml @@ -0,0 +1,71 @@ +--- +cases: + - note: strings/reverse_bar + query: data.test.p = x + modules: + - | + package test + + p := strings.reverse(data.foo) + data: + foo: bar + want_result: + - x: rab + - note: strings/reverse_unicode_multi_char_emojii + query: data.test.p = x + modules: + - | + package test + + p := strings.reverse(data.foo) + data: + foo: 2️⃣ + want_result: + - x: ⃣️2 + - note: strings/reverse_unicode + query: data.test.p = x + modules: + - | + package test + + p := strings.reverse(data.foo) + data: + foo: "1\U0001F600\U0001D6FE" + want_result: + - x: "\U0001D6FE\U0001F6001" + - note: strings/reverse_empty + query: data.test.p = x + modules: + - | + package test + + p := strings.reverse(data.foo) + data: + foo: "" + want_result: + - x: "" + - note: strings/reverse_number_error + query: data.test.p = x + modules: + - | + package test + + p := strings.reverse(data.foo) + data: + foo: 123 + want_error_code: eval_type_error + want_error: "reverse: operand 1 must be string but got number" + strict_error: true + - note: strings/reverse_object_error + query: data.test.p = x + modules: + - | + package test + + p := strings.reverse(data.foo) + data: + foo: + bar: baz + want_error_code: eval_type_error + want_error: "reverse: operand 1 must be string but got object" + strict_error: true diff --git a/test/cases/testdata/v1/strings/test-strings-0925.yaml b/test/cases/testdata/v1/strings/test-strings-0925.yaml new file mode 100644 index 0000000000..f78e75baf4 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0925.yaml @@ -0,0 +1,47 @@ +--- +cases: + - note: strings/indexof_n_single_match + query: data.test.p = x + modules: + - | + package test + + p := indexof_n("dogcat", "cat") + want_result: + - x: + - 3 + - note: strings/indexof_n_multiple_matches + query: data.test.p = x + modules: + - | + package test + + p := indexof_n("dogcatdogcat", "cat") + want_result: + - x: + - 3 + - 9 + - note: strings/indexof_n_no_match + query: data.test.p = x + modules: + - | + package test + + p := indexof_n("dogcat", "rabbit") + want_result: + - x: [] + - note: strings/indexof_n_unicode_matches + query: data.test.p = x + modules: + - "package test\n\np := indexof_n(\"\U0001F607\U0001F600\U0001F607\U0001F600\U0001F607\U0001F600\", \"\U0001F600\")\n" + want_result: + - x: + - 1 + - 3 + - 5 + - note: strings/indexof_n_unicode_no_match + query: data.test.p = x + modules: + - "package test\n\np := indexof_n(\"\U0001F607\U0001F600\U0001F607\U0001F600\U0001F607\U0001F600\", \"\U0001F602\")\n" + want_result: + - x: [] diff --git a/test/cases/testdata/v1/strings/test-strings-0926.yaml b/test/cases/testdata/v1/strings/test-strings-0926.yaml new file mode 100644 index 0000000000..b6eded1f57 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-0926.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: strings/count_single_word_match + query: data.test.p = x + modules: + - | + package test + + p := strings.count("cheese", "e") + want_result: + - x: 3 + - note: strings/count_multiple_separate_matches + query: data.test.p = x + modules: + - | + package test + + p := strings.count("hello hello hello world", "hello") + want_result: + - x: 3 + - note: strings/count_n_no_match + query: data.test.p = x + modules: + - | + package test + + p := strings.count("dummy", "x") + want_result: + - x: 0 diff --git a/test/cases/testdata/v1/strings/test-strings-indexof-unicode.yaml b/test/cases/testdata/v1/strings/test-strings-indexof-unicode.yaml new file mode 100644 index 0000000000..d5b572a990 --- /dev/null +++ b/test/cases/testdata/v1/strings/test-strings-indexof-unicode.yaml @@ -0,0 +1,47 @@ +--- +cases: + - note: "strings/indexof: unicode char" + query: data.test.p = x + modules: + - | + package test + + p := x if { + indexof("μx", "x", x) + } + want_result: + - x: 1 + - note: "strings/indexof: unicode chars not found" + query: data.test.p = x + modules: + - | + package test + + p := x if { + indexof("μ", "μμ", x) + } + want_result: + - x: -1 + - note: "strings/indexof: unicode string" + query: data.test.p = x + modules: + - | + package test + + p := x if { + indexof("skön var våren", "vår", x) + } + want_result: + - x: 9 + - note: "strings/indexof: unicode string emoji" + query: data.test.p = x + modules: + - "package test\n\np := x if {\n\tindexof(\"\U0001F367\U0001F368\U0001F9C1\U0001F370\U0001F36E\", \"\U0001F36E\", x)\n}\n" + want_result: + - x: 4 + - note: "strings/indexof: unicode string emojis" + query: data.test.p = x + modules: + - "package test\n\np := x if {\n\tindexof(\"\U0001F367\U0001F368\U0001F9C1\U0001F370\U0001F36E\", \"\U0001F367\U0001F368\U0001F9C1\U0001F370\U0001F36E\", x)\n}\n" + want_result: + - x: 0 diff --git a/test/cases/testdata/v1/subset/test-subset.yaml b/test/cases/testdata/v1/subset/test-subset.yaml new file mode 100644 index 0000000000..ad2bb75baa --- /dev/null +++ b/test/cases/testdata/v1/subset/test-subset.yaml @@ -0,0 +1,415 @@ +--- +cases: + - note: subset/simple object subset 1 + query: data.test.test_result = x + modules: + - | + package test + + A := { + "a": 5, + "b": 7, + "c": 15, + } + + B := {"a": 5} + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + test_result if { + AsubB # B is a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/simple object subset 2 + query: data.test.test_result = x + modules: + - | + package test + + A := { + "a": 5, + "b": 7, + "c": 15, + } + + B := { + "a": 5, + "b": 10, + } + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + test_result if { + not AsubB # B is not a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/nested object subset 1 + query: data.test.test_result = x + modules: + - | + package test + + A := { + "a": 5, + "b": 7, + "c": 15, + "nested": { + "x": 10, + "y": 15, + "z": 20, + }, + } + + B := { + "a": 5, + "nested": { + "x": 10, + "y": 15, + "z": 20, + }, + } + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + test_result if { + AsubB # B is a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/nested object subset 2 + query: data.test.test_result = x + modules: + - | + package test + + A := { + "a": 5, + "b": 7, + "c": 15, + "nested": { + "x": 10, + "y": 15, + "z": 20, + }, + } + + # The subset operation applies recursively to nested objects + + B := { + "a": 5, + "nested": { + "x": 10, + "y": 15, + }, + } + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + test_result if { + AsubB # B is a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/nested object subset 3 + query: data.test.test_result = x + modules: + - | + package test + + A := { + "a": 5, + "b": 7, + "c": 15, + "nested": { + "x": 10, + "y": 15, + "z": 20, + "set1": {1, 2, 3, 4}, + "arr1": [6, 7, 8, 9], + }, + } + + # The subset operation applies recursively to nested objects + + B := { + "a": 5, + "nested": { + "x": 10, + "y": 15, + "set1": {4, 1}, + "arr1": [6, 7], + }, + } + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + test_result if { + AsubB # B is a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/sets 1 + query: data.test.test_result = x + modules: + - | + package test + + A := {1, 2, 3} + + B := {3, 2} + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + test_result if { + AsubB # B is a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/nested sets 1 + query: data.test.test_result = x + modules: + - | + package test + + A := {1, 2, 3, {"a", "b", "c"}} + + B := {3, 2, {"a", "b", "c"}} + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + test_result if { + AsubB # B is a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/nested sets 2 + query: data.test.test_result = x + modules: + - | + package test + + A := {1, 2, 3, {"a", "b", "c"}} + + B := {3, 2, {"a", "b"}} + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + # Notice that there isn't really a well-defined way to "match" the two + # nested sets to one another, so we B is not a subset of A in this + # case. + + test_result if { + not AsubB # B is not a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/arrays 1 + query: data.test.test_result = x + modules: + - | + package test + + A := [1, 2, 3, 4, 5, 6] + + B := [3, 4, 5] + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + # Notice that there isn't really a well-defined way to "match" the two + # nested sets to one another, so we B is not a subset of A in this + # case. + + test_result if { + AsubB # B is a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/arrays 2 + query: data.test.test_result = x + modules: + - | + package test + + A := [1, 2, 3, 4, 5, 6] + + B := [1, 2, 3] + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + # Notice that there isn't really a well-defined way to "match" the two + # nested sets to one another, so we B is not a subset of A in this + # case. + + test_result if { + AsubB # B is a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/arrays 3 + query: data.test.test_result = x + modules: + - | + package test + + A := [1, 2, 3, 4, 5, 6] + + B := [4, 5, 6] + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + # Notice that there isn't really a well-defined way to "match" the two + # nested sets to one another, so we B is not a subset of A in this + # case. + + test_result if { + AsubB # B is a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/arrays 4 + query: data.test.test_result = x + modules: + - | + package test + + A := [1, 2, 3, 4, 5, 6] + + B := [1, 2, 3, 4, 5, 6] + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + # Notice that there isn't really a well-defined way to "match" the two + # nested sets to one another, so we B is not a subset of A in this + # case. + + test_result if { + AsubB # B is a subset of A + BsubA # A is a subset of B + } + want_result: + - x: true + - note: subset/array and set 1 + query: data.test.test_result = x + modules: + - | + package test + + A := [1, 2, 3, 4, 5, 6] + + B := {4, 3, 2} + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + test_result if { + AsubB # B is a subset of A + not BsubA # It is invalid operands + } + want_result: + - x: true + - note: subset/array and set 2 + query: data.test.test_result = x + modules: + - | + package test + + A := [1, 2, 3, 4, 5, 6] + + B := {9, 8, 7} + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + test_result if { + not AsubB # B is not a subset of A + not BsubA # It is invalid operands + } + want_result: + - x: true + - note: subset/arrays 5 + query: data.test.test_result = x + modules: + - | + package test + + A := [1, 2, 3, 4, 5, 6] + + B := [4, 5, 6, 8] + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + # Notice that there isn't really a well-defined way to "match" the two + # nested sets to one another, so we B is not a subset of A in this + # case. + + test_result if { + not AsubB # B is not a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true + - note: subset/arrays 6 + query: data.test.test_result = x + modules: + - | + package test + + A := [1, 2, 3, 4, 5, 6] + + B := [8, 9, 10] + + AsubB := object.subset(A, B) + + BsubA := object.subset(B, A) + + # Notice that there isn't really a well-defined way to "match" the two + # nested sets to one another, so we B is not a subset of A in this + # case. + + test_result if { + not AsubB # B is not a subset of A + not BsubA # A is not a subset of B + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/time/test-time-0947.yaml b/test/cases/testdata/v1/time/test-time-0947.yaml new file mode 100644 index 0000000000..be9b93716b --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0947.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: time/time caching + query: data.generated.p = x + modules: + - | + package generated + + p if { + time.now_ns(t0) + test.sleep("10ms") + time.now_ns(t1) + t1 = t2 + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/time/test-time-0948.yaml b/test/cases/testdata/v1/time/test-time-0948.yaml new file mode 100644 index 0000000000..680cf0833c --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0948.yaml @@ -0,0 +1,64 @@ +--- +cases: + - note: time/parse_nanos + query: data.generated.p = x + modules: + - | + package generated + + p[case_id] := ns if { + case := input.cases[case_id] + time.parse_ns(case.layout, case.value, ns) + } + input: + cases: + "1": + layout: 2006-01-02T15:04:05Z07:00 + value: "2017-06-02T19:00:00-07:00" + "2": + layout: 2006-01-02T15:04:05Z07:00 + value: "1677-09-21T00:12:43.145224192-00:00" + "3": + layout: 2006-01-02T15:04:05Z07:00 + value: "2262-04-11T23:47:16.854775807-00:00" + "4": + layout: 01/02 03:04:05PM '06 -0700 + value: 06/02 07:00:00PM '17 -0700 + "5": + layout: 02 Jan 06 15:04 -0700 + value: 02 Jun 17 19:00 -0700 + "6": + layout: RFC822Z + value: 02 Jun 17 19:00 -0700 + want_result: + - x: + "1": 1496455200000000000 + "2": -9223372036854775808 + "3": 9223372036854775807 + "4": 1496455200000000000 + "5": 1496455200000000000 + "6": 1496455200000000000 + - note: time/parse_nanos_too_small + query: data.generated.p = x + modules: + - | + package generated + + p := ns if { + time.parse_ns("2006-01-02T15:04:05Z07:00", "1677-09-21T00:12:43.145224191-00:00", ns) + } + want_error_code: eval_builtin_error + want_error: time outside of valid range + strict_error: true + - note: time/parse_nanos_too_large + query: data.generated.p = x + modules: + - | + package generated + + p := ns if { + time.parse_ns("2006-01-02T15:04:05Z07:00", "2262-04-11T23:47:16.854775808-00:00", ns) + } + want_error_code: eval_builtin_error + want_error: time outside of valid range + strict_error: true diff --git a/test/cases/testdata/v1/time/test-time-0949.yaml b/test/cases/testdata/v1/time/test-time-0949.yaml new file mode 100644 index 0000000000..c4d97607c5 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0949.yaml @@ -0,0 +1,48 @@ +--- +cases: + - note: time/parse_rfc3339_nanos + query: data.generated.p = x + modules: + - | + package generated + + p[t] := ns if { + t = input.cases[_] + time.parse_rfc3339_ns(t, ns) + } + input: + cases: + - "1677-09-21T00:12:43.145224192-00:00" + - "1970-01-01T00:00:00-00:00" + - "2017-06-02T19:00:00-07:00" + - "2262-04-11T23:47:16.854775807-00:00" + want_result: + - x: + "1677-09-21T00:12:43.145224192-00:00": -9223372036854775808 + "1970-01-01T00:00:00-00:00": 0 + "2017-06-02T19:00:00-07:00": 1496455200000000000 + "2262-04-11T23:47:16.854775807-00:00": 9223372036854775807 + - note: time/parse_rfc3339_nanos_too_small + query: data.generated.p = x + modules: + - | + package generated + + p := ns if { + time.parse_rfc3339_ns("1677-09-21T00:12:43.145224191-00:00", ns) + } + want_error_code: eval_builtin_error + want_error: time outside of valid range + strict_error: true + - note: time/parse_rfc3339_nanos_too_large + query: data.generated.p = x + modules: + - | + package generated + + p := ns if { + time.parse_rfc3339_ns("2262-04-11T23:47:16.854775808-00:00", ns) + } + want_error_code: eval_builtin_error + want_error: time outside of valid range + strict_error: true diff --git a/test/cases/testdata/v1/time/test-time-0950.yaml b/test/cases/testdata/v1/time/test-time-0950.yaml new file mode 100644 index 0000000000..1ca6fd4dd0 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0950.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: time/parse duration nanos + query: data.generated.p = x + modules: + - | + package generated + + p := ns if { + time.parse_duration_ns("100ms", ns) + } + data: {} + want_result: + - x: 100000000 diff --git a/test/cases/testdata/v1/time/test-time-0951.yaml b/test/cases/testdata/v1/time/test-time-0951.yaml new file mode 100644 index 0000000000..43e3869424 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0951.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: time/date + query: data.generated.p = x + modules: + - | + package generated + + p := [__local0__, __local1__, __local2__] if { + __local3__ = 1517814000 * 1000 + __local4__ = __local3__ * 1000 + __local5__ = __local4__ * 1000 + time.date(__local5__, __local6__) + [__local0__, __local1__, __local2__] = __local6__ + } + data: {} + want_result: + - x: + - 2018 + - 2 + - 5 diff --git a/test/cases/testdata/v1/time/test-time-0952.yaml b/test/cases/testdata/v1/time/test-time-0952.yaml new file mode 100644 index 0000000000..61582c1e00 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0952.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: time/date with LA tz + query: data.generated.p = x + modules: + - | + package generated + + p := [__local0__, __local1__, __local2__] if { + __local3__ = 1517814000 * 1000 + __local4__ = __local3__ * 1000 + __local5__ = __local4__ * 1000 + time.date([__local5__, "America/Los_Angeles"], __local6__) + [__local0__, __local1__, __local2__] = __local6__ + } + data: {} + want_result: + - x: + - 2018 + - 2 + - 4 diff --git a/test/cases/testdata/v1/time/test-time-0953.yaml b/test/cases/testdata/v1/time/test-time-0953.yaml new file mode 100644 index 0000000000..c0a1af1cca --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0953.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: time/date with empty tz + query: data.generated.p = x + modules: + - | + package generated + + p := [__local0__, __local1__, __local2__] if { + __local3__ = 1517832000 * 1000 + __local4__ = __local3__ * 1000 + __local5__ = __local4__ * 1000 + time.date([__local5__, ""], __local6__) + [__local0__, __local1__, __local2__] = __local6__ + } + data: {} + want_result: + - x: + - 2018 + - 2 + - 5 diff --git a/test/cases/testdata/v1/time/test-time-0954.yaml b/test/cases/testdata/v1/time/test-time-0954.yaml new file mode 100644 index 0000000000..d6f7441c34 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0954.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: time/date leap day + query: data.generated.p = x + modules: + - | + package generated + + p := [__local0__, __local1__, __local2__] if { + __local3__ = 1582977600 * 1000 + __local4__ = __local3__ * 1000 + __local5__ = __local4__ * 1000 + time.date(__local5__, __local6__) + [__local0__, __local1__, __local2__] = __local6__ + } + data: {} + want_result: + - x: + - 2020 + - 2 + - 29 diff --git a/test/cases/testdata/v1/time/test-time-0955.yaml b/test/cases/testdata/v1/time/test-time-0955.yaml new file mode 100644 index 0000000000..718e4b20b3 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0955.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: time/date too big + query: data.generated.p = x + modules: + - | + package generated + + p := [__local0__, __local1__, __local2__] if { + __local3__ = 1582977600 * 1000 + __local4__ = __local3__ * 1000 + __local5__ = __local4__ * 1000 + __local6__ = __local5__ * 1000 + time.date(__local6__, __local7__) + [__local0__, __local1__, __local2__] = __local7__ + } + want_error_code: eval_builtin_error + want_error: timestamp too big + strict_error: true diff --git a/test/cases/testdata/v1/time/test-time-0956.yaml b/test/cases/testdata/v1/time/test-time-0956.yaml new file mode 100644 index 0000000000..64afe9c6af --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0956.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: time/clock + query: data.generated.p = x + modules: + - | + package generated + + p := [__local0__, __local1__, __local2__] if { + __local3__ = 1517832000 * 1000 + __local4__ = __local3__ * 1000 + __local5__ = __local4__ * 1000 + time.clock(__local5__, __local6__) + [__local0__, __local1__, __local2__] = __local6__ + } + data: {} + want_result: + - x: + - 12 + - 0 + - 0 diff --git a/test/cases/testdata/v1/time/test-time-0957.yaml b/test/cases/testdata/v1/time/test-time-0957.yaml new file mode 100644 index 0000000000..53738280d8 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0957.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: time/clock with NY tz + query: data.generated.p = x + modules: + - | + package generated + + p := [__local0__, __local1__, __local2__] if { + __local3__ = 1517832000 * 1000 + __local4__ = __local3__ * 1000 + __local5__ = __local4__ * 1000 + time.clock([__local5__, "America/New_York"], __local6__) + [__local0__, __local1__, __local2__] = __local6__ + } + data: {} + want_result: + - x: + - 7 + - 0 + - 0 diff --git a/test/cases/testdata/v1/time/test-time-0958.yaml b/test/cases/testdata/v1/time/test-time-0958.yaml new file mode 100644 index 0000000000..f316c5047a --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0958.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: time/clock leap day + query: data.generated.p = x + modules: + - | + package generated + + p := [__local0__, __local1__, __local2__] if { + __local3__ = 1582977600 * 1000 + __local4__ = __local3__ * 1000 + __local5__ = __local4__ * 1000 + time.clock(__local5__, __local6__) + [__local0__, __local1__, __local2__] = __local6__ + } + data: {} + want_result: + - x: + - 12 + - 0 + - 0 diff --git a/test/cases/testdata/v1/time/test-time-0959.yaml b/test/cases/testdata/v1/time/test-time-0959.yaml new file mode 100644 index 0000000000..35be109ac9 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0959.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: time/clock too big + query: data.generated.p = x + modules: + - | + package generated + + p := [__local0__, __local1__, __local2__] if { + __local3__ = 1582977600 * 1000 + __local4__ = __local3__ * 1000 + __local5__ = __local4__ * 1000 + __local6__ = __local5__ * 1000 + time.clock(__local6__, __local7__) + [__local0__, __local1__, __local2__] = __local7__ + } + want_error_code: eval_builtin_error + want_error: timestamp too big + strict_error: true diff --git a/test/cases/testdata/v1/time/test-time-0960.yaml b/test/cases/testdata/v1/time/test-time-0960.yaml new file mode 100644 index 0000000000..11b4606cf4 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0960.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: time/weekday + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + time.weekday(1517832000000000000, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: Monday diff --git a/test/cases/testdata/v1/time/test-time-0961.yaml b/test/cases/testdata/v1/time/test-time-0961.yaml new file mode 100644 index 0000000000..aaed084d8e --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0961.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: time/weekday + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + time.weekday(1517918400000000000, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: Tuesday diff --git a/test/cases/testdata/v1/time/test-time-0962.yaml b/test/cases/testdata/v1/time/test-time-0962.yaml new file mode 100644 index 0000000000..2db7c0b6b5 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0962.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: time/weekday + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + time.weekday(1518004800000000000, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: Wednesday diff --git a/test/cases/testdata/v1/time/test-time-0963.yaml b/test/cases/testdata/v1/time/test-time-0963.yaml new file mode 100644 index 0000000000..8c3d47db65 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0963.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: time/weekday + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + time.weekday(1518091200000000000, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: Thursday diff --git a/test/cases/testdata/v1/time/test-time-0964.yaml b/test/cases/testdata/v1/time/test-time-0964.yaml new file mode 100644 index 0000000000..23bac44513 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0964.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: time/weekday + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + time.weekday(1518177600000000000, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: Friday diff --git a/test/cases/testdata/v1/time/test-time-0965.yaml b/test/cases/testdata/v1/time/test-time-0965.yaml new file mode 100644 index 0000000000..fad30d94fe --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0965.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: time/weekday + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + time.weekday(1518264000000000000, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: Saturday diff --git a/test/cases/testdata/v1/time/test-time-0966.yaml b/test/cases/testdata/v1/time/test-time-0966.yaml new file mode 100644 index 0000000000..657c757dac --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0966.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: time/weekday + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + time.weekday(1518350400000000000, __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: Sunday diff --git a/test/cases/testdata/v1/time/test-time-0967.yaml b/test/cases/testdata/v1/time/test-time-0967.yaml new file mode 100644 index 0000000000..2b1670bde8 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0967.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: time/weekday too big + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + __local1__ = 1582977600 * 1000 + __local2__ = __local1__ * 1000 + __local3__ = __local2__ * 1000 + __local4__ = __local3__ * 1000 + time.weekday(__local4__, __local5__) + __local0__ = __local5__ + } + want_error_code: eval_builtin_error + want_error: timestamp too big + strict_error: true diff --git a/test/cases/testdata/v1/time/test-time-0968.yaml b/test/cases/testdata/v1/time/test-time-0968.yaml new file mode 100644 index 0000000000..13dd21a1f5 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0968.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: time/add_date year month day + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + time.add_date(1585852421593912000, 3, 9, 12, __local1__) + __local0__ = __local1__ + } + want_result: + - x: 1705257221593912000 + - note: time/add_date too large result + query: data.generated.p = x + modules: + - | + package generated + + p := ns if { + time.add_date(0, 2262, 1, 1, ns) + } + want_error_code: eval_builtin_error + want_error: time outside of valid range + strict_error: true diff --git a/test/cases/testdata/v1/time/test-time-0969.yaml b/test/cases/testdata/v1/time/test-time-0969.yaml new file mode 100644 index 0000000000..8ca4b62a13 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0969.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: time/add_date negative values + query: data.generated.p = x + modules: + - | + package generated + + p := __local0__ if { + time.add_date(1585852421593912000, -1, -1, -1, __local1__) + __local0__ = __local1__ + } + want_result: + - x: 1551465221593912000 + - note: time/add_date too small result + query: data.generated.p = x + modules: + - | + package generated + + p := ns if { + time.add_date(-9223372036854775808, 0, 0, -1, ns) + } + want_error_code: eval_builtin_error + want_error: time outside of valid range + strict_error: true diff --git a/test/cases/testdata/v1/time/test-time-0970.yaml b/test/cases/testdata/v1/time/test-time-0970.yaml new file mode 100644 index 0000000000..661fb62c0a --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0970.yaml @@ -0,0 +1,66 @@ +--- +cases: + - note: time/diff + query: | + data.test.a = minute_second; data.test.b = different_tz; data.test.c = leap_year; data.test.d = not_leap_year; data.test.e = leap_year_one_day + modules: + - | + package test + + layout := "2006-01-02" + + a := minute_second if { + minute_second := time.diff(time.now_ns() + (((61 * 1000) * 1000) * 1000), time.now_ns()) + } + + b := different_tz if { + different_tz := time.diff([time.now_ns() + (((60 * 1000) * 1000) * 1000), "UTC"], [time.now_ns(), "Asia/Shanghai"]) + } + + c := leap_year if { + leap_year := time.diff(time.parse_ns(layout, "2020-02-02"), time.parse_ns(layout, "2020-03-01")) + } + + d := not_leap_year if { + not_leap_year := time.diff(time.parse_ns(layout, "2021-02-02"), time.parse_ns(layout, "2021-03-01")) + } + + e := leap_year_one_day if { + leap_year_one_day := time.diff(time.parse_ns(layout, "2004-02-29"), time.parse_ns(layout, "2005-03-01")) + } + want_result: + - different_tz: + - 0 + - 0 + - 0 + - 0 + - 1 + - 0 + leap_year: + - 0 + - 0 + - 28 + - 0 + - 0 + - 0 + leap_year_one_day: + - 1 + - 0 + - 1 + - 0 + - 0 + - 0 + minute_second: + - 0 + - 0 + - 0 + - 0 + - 1 + - 1 + not_leap_year: + - 0 + - 0 + - 27 + - 0 + - 0 + - 0 diff --git a/test/cases/testdata/v1/time/test-time-0971.yaml b/test/cases/testdata/v1/time/test-time-0971.yaml new file mode 100644 index 0000000000..3b6f39dba1 --- /dev/null +++ b/test/cases/testdata/v1/time/test-time-0971.yaml @@ -0,0 +1,33 @@ +--- +cases: + - note: time/format + query: | + data.test.a = no_timezone; data.test.b = with_timezone; data.test.c = with_layout; data.test.d = with_constant + modules: + - | + package test + + time_ns := 1670006453141828752 + + a := time.format(time_ns) + + b := time.format([time_ns, "Asia/Kolkata"]) + + c := time.format([time_ns, "Asia/Kolkata", "Mon Jan 02 15:04:05 -0700 2006"]) + + d := time.format([time_ns, "Asia/Kolkata", "RFC1123Z"]) + want_result: + - no_timezone: "2022-12-02T18:40:53.141828752Z" + with_constant: Sat, 03 Dec 2022 00:10:53 +0530 + with_layout: Sat Dec 03 00:10:53 +0530 2022 + with_timezone: "2022-12-03T00:10:53.141828752+05:30" + - note: time/format too big + query: data.generated.p = x + modules: + - | + package generated + + p := time.format(1582977600 * 10e12) + want_error_code: eval_builtin_error + want_error: timestamp too big + strict_error: true diff --git a/test/cases/testdata/v1/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml b/test/cases/testdata/v1/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml new file mode 100644 index 0000000000..45479ddf49 --- /dev/null +++ b/test/cases/testdata/v1/topdowndynamicdispatch/test-topdowndynamicdispatch-1068.yaml @@ -0,0 +1,33 @@ +--- +cases: + - note: topdowndynamicdispatch/dynamic dispatch + query: data = x + modules: + - | + package animals + + dog := "woof" + + cat := "meow" + - | + package dynamic + + sound := __local0__ if { + true + __local1__ = data.dynamic.animal + __local0__ = data.animals[__local1__] + } + + animal := "dog" if { + 2 > 1 + } + data: {} + input_term: "{}" + want_result: + - x: + animals: + cat: meow + dog: woof + dynamic: + animal: dog + sound: woof diff --git a/test/cases/testdata/v1/trim/test-trim-0362.yaml b/test/cases/testdata/v1/trim/test-trim-0362.yaml new file mode 100644 index 0000000000..b8917249dc --- /dev/null +++ b/test/cases/testdata/v1/trim/test-trim-0362.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trim/trims '!¡' from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim("¡¡¡foo, bar!!!", "!¡", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - foo, bar + sort_bindings: true diff --git a/test/cases/testdata/v1/trim/test-trim-0363.yaml b/test/cases/testdata/v1/trim/test-trim-0363.yaml new file mode 100644 index 0000000000..12b96ae13b --- /dev/null +++ b/test/cases/testdata/v1/trim/test-trim-0363.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trim/trims nothing from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim("¡¡¡foo, bar!!!", "i", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - ¡¡¡foo, bar!!! + sort_bindings: true diff --git a/test/cases/testdata/v1/trimleft/test-trimleft-0364.yaml b/test/cases/testdata/v1/trimleft/test-trimleft-0364.yaml new file mode 100644 index 0000000000..b32527f3f2 --- /dev/null +++ b/test/cases/testdata/v1/trimleft/test-trimleft-0364.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trimleft/trims leading '!¡' from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim_left("¡¡¡foo, bar!!!", "!¡", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - foo, bar!!! + sort_bindings: true diff --git a/test/cases/testdata/v1/trimleft/test-trimleft-0365.yaml b/test/cases/testdata/v1/trimleft/test-trimleft-0365.yaml new file mode 100644 index 0000000000..e27ed4faf4 --- /dev/null +++ b/test/cases/testdata/v1/trimleft/test-trimleft-0365.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trimleft/trims nothing from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim_left("!!!foo, bar¡¡¡", "¡", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - "!!!foo, bar¡¡¡" + sort_bindings: true diff --git a/test/cases/testdata/v1/trimprefix/test-trimprefix-0366.yaml b/test/cases/testdata/v1/trimprefix/test-trimprefix-0366.yaml new file mode 100644 index 0000000000..fd45c3427d --- /dev/null +++ b/test/cases/testdata/v1/trimprefix/test-trimprefix-0366.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trimprefix/trims prefix '!¡' from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim_prefix("¡¡¡foo, bar!!!", "¡¡¡foo", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - ", bar!!!" + sort_bindings: true diff --git a/test/cases/testdata/v1/trimprefix/test-trimprefix-0367.yaml b/test/cases/testdata/v1/trimprefix/test-trimprefix-0367.yaml new file mode 100644 index 0000000000..9f042f3265 --- /dev/null +++ b/test/cases/testdata/v1/trimprefix/test-trimprefix-0367.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trimprefix/trims nothing from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim_prefix("¡¡¡foo, bar!!!", "¡¡¡bar", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - ¡¡¡foo, bar!!! + sort_bindings: true diff --git a/test/cases/testdata/v1/trimright/test-trimright-0368.yaml b/test/cases/testdata/v1/trimright/test-trimright-0368.yaml new file mode 100644 index 0000000000..9a4073c06c --- /dev/null +++ b/test/cases/testdata/v1/trimright/test-trimright-0368.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trimright/trims trailing '!¡' from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim_right("¡¡¡foo, bar!!!", "!¡", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - ¡¡¡foo, bar + sort_bindings: true diff --git a/test/cases/testdata/v1/trimright/test-trimright-0369.yaml b/test/cases/testdata/v1/trimright/test-trimright-0369.yaml new file mode 100644 index 0000000000..f07883b832 --- /dev/null +++ b/test/cases/testdata/v1/trimright/test-trimright-0369.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trimright/trims nothing from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim_right("!!!foo, bar¡¡¡", "!", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - "!!!foo, bar¡¡¡" + sort_bindings: true diff --git a/test/cases/testdata/v1/trimspace/test-trimspace-0372.yaml b/test/cases/testdata/v1/trimspace/test-trimspace-0372.yaml new file mode 100644 index 0000000000..ec0e54a084 --- /dev/null +++ b/test/cases/testdata/v1/trimspace/test-trimspace-0372.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trimspace/trims all leading and trailing white space from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim_space(" \t\n foo, bar \n\t\r\n", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - foo, bar + sort_bindings: true diff --git a/test/cases/testdata/v1/trimspace/test-trimspace-0373.yaml b/test/cases/testdata/v1/trimspace/test-trimspace-0373.yaml new file mode 100644 index 0000000000..e225ef9407 --- /dev/null +++ b/test/cases/testdata/v1/trimspace/test-trimspace-0373.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trimspace/trims nothing from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim_space("foo, bar", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - foo, bar + sort_bindings: true diff --git a/test/cases/testdata/v1/trimsuffix/test-trimsuffix-0370.yaml b/test/cases/testdata/v1/trimsuffix/test-trimsuffix-0370.yaml new file mode 100644 index 0000000000..4ba62adcce --- /dev/null +++ b/test/cases/testdata/v1/trimsuffix/test-trimsuffix-0370.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trimsuffix/trims suffix '!¡' from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim_suffix("¡¡¡foo, bar!!!", ", bar!!!", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - ¡¡¡foo + sort_bindings: true diff --git a/test/cases/testdata/v1/trimsuffix/test-trimsuffix-0371.yaml b/test/cases/testdata/v1/trimsuffix/test-trimsuffix-0371.yaml new file mode 100644 index 0000000000..a8bb8ee8ce --- /dev/null +++ b/test/cases/testdata/v1/trimsuffix/test-trimsuffix-0371.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: trimsuffix/trims nothing from string + query: data.generated.p = x + modules: + - | + package generated + + p contains __local0__ if { + trim_suffix("¡¡¡foo, bar!!!", ", foo!!!", __local1__) + __local0__ = __local1__ + } + data: {} + want_result: + - x: + - ¡¡¡foo, bar!!! + sort_bindings: true diff --git a/test/cases/testdata/v1/type/test-regressions.yaml b/test/cases/testdata/v1/type/test-regressions.yaml new file mode 100644 index 0000000000..0416d91a60 --- /dev/null +++ b/test/cases/testdata/v1/type/test-regressions.yaml @@ -0,0 +1,88 @@ +--- +cases: + - note: regression/partial-object override, different key type, query + query: data.test.p.foo = x + modules: + - | + package test + + p[k] := v if { + v := ["a", "b", "c"][k] + } + + p["foo"] := "bar" + want_result: + - x: bar + - note: regression/partial-object override, different key type, referenced in other rule + query: data.test.q = x + modules: + - | + package test + + p[k] := v if { + v := ["a", "b", "c"][k] + } + + p["foo"] := "bar" + + q contains x if { + x := p[_] + x == "bar" + } + want_result: + - x: + - bar + - note: regression/dynamic object to static object comparison (https://github.com/open-policy-agent/opa/issues/6138) + query: data.test.compare = x + modules: + - | + package test + + l := ["a", "b", "c"] + + obj[k] := v if { + v := ["a", "b", "c"][k] + k < 3 + } + + obj[k] := v if { + v := input.m[k] + } + + obj["foo"] := "bar" if input.foo + + obj["baz"] := true if input.baz + + compare if { + # Comparison with static object that doesn't contain "optional" key. + obj == { + 0: "a", + 1: "b", + 2: "c", + } + + obj == { + 0: "a", + 1: "b", + 2: "c", + "foo": "bar", + } with input.foo as true + + obj == { + 0: "a", + 1: "b", + 2: "c", + "baz": true, + } with input.baz as true + + obj == { + 0: "a", + 1: "b", + 2: "c", + 3: "d", + 4: "e", + 100: "f", + } with input.m as {3: "d", 4: "e", 100: "f"} + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0828.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0828.yaml new file mode 100644 index 0000000000..ab314c9654 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0828.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: typebuiltin/is_number + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + is_number(-42.0, x) + is_number(0, y) + is_number(100.1, z) + } + data: {} + want_result: + - x: + - true + - true + - true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0829.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0829.yaml new file mode 100644 index 0000000000..cadd8056b6 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0829.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_number + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_number(null, x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0830.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0830.yaml new file mode 100644 index 0000000000..4cca992518 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0830.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_number + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_number(false, x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0831.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0831.yaml new file mode 100644 index 0000000000..09b347f55a --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0831.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: typebuiltin/is_number + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + arr = [true, 1] + arr[_] = x + is_number(x) + } + data: {} + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0832.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0832.yaml new file mode 100644 index 0000000000..a853c0af1f --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0832.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: typebuiltin/is_string + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y, z] if { + is_string("Hello", x) + is_string("There", y) + is_string("OPA", z) + } + data: {} + want_result: + - x: + - true + - true + - true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0833.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0833.yaml new file mode 100644 index 0000000000..2f45cceb0f --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0833.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_string(null, x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0834.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0834.yaml new file mode 100644 index 0000000000..67743f8095 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0834.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_string + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_string(false, x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0835.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0835.yaml new file mode 100644 index 0000000000..d5b4e64e82 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0835.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: typebuiltin/is_string + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + arr = [true, 1, "Hey"] + arr[_] = x + is_string(x) + } + data: {} + want_result: + - x: + - Hey + sort_bindings: true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0836.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0836.yaml new file mode 100644 index 0000000000..07a46abfc3 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0836.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: typebuiltin/is_boolean + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y] if { + is_boolean(true, x) + is_boolean(false, y) + } + data: {} + want_result: + - x: + - true + - true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0837.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0837.yaml new file mode 100644 index 0000000000..04a2c8694e --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0837.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_boolean + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_boolean(null, x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0838.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0838.yaml new file mode 100644 index 0000000000..a142953583 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0838.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_boolean + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_boolean("Hello", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0839.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0839.yaml new file mode 100644 index 0000000000..29ce0c6969 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0839.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: typebuiltin/is_boolean + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + arr = [false, 1, "Hey"] + arr[_] = x + is_boolean(x) + } + data: {} + want_result: + - x: + - false + sort_bindings: true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0840.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0840.yaml new file mode 100644 index 0000000000..311db3c4f9 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0840.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: typebuiltin/is_array + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y] if { + is_array([1, 2, 3], x) + is_array(["a", "b"], y) + } + data: {} + want_result: + - x: + - true + - true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0841.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0841.yaml new file mode 100644 index 0000000000..2f708ff5d5 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0841.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_array + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_array({1, 2, 3}, x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0842.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0842.yaml new file mode 100644 index 0000000000..f0d536d1d5 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0842.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: typebuiltin/is_set + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y] if { + is_set({1, 2, 3}, x) + is_set({"a", "b"}, y) + } + data: {} + want_result: + - x: + - true + - true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0843.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0843.yaml new file mode 100644 index 0000000000..98d55ffdf3 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0843.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_set([1, 2, 3], x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0844.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0844.yaml new file mode 100644 index 0000000000..ab8662e878 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0844.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: typebuiltin/is_object + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = {"foo": yy | yy = 1} + is_object(__local0__, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0845.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0845.yaml new file mode 100644 index 0000000000..8e38c0145b --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0845.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_object + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_object("foo", x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0846.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0846.yaml new file mode 100644 index 0000000000..beb09cb1f0 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0846.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_null + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_null(null, x) + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0847.yaml b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0847.yaml new file mode 100644 index 0000000000..c67cf8c5c5 --- /dev/null +++ b/test/cases/testdata/v1/typebuiltin/test-typebuiltin-0847.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typebuiltin/is_null + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + is_null(true, x) + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0848.yaml b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0848.yaml new file mode 100644 index 0000000000..58627a6fe9 --- /dev/null +++ b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0848.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typenamebuiltin/type_name + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + type_name(null, x) + } + data: {} + want_result: + - x: "null" diff --git a/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0849.yaml b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0849.yaml new file mode 100644 index 0000000000..f10fb02f79 --- /dev/null +++ b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0849.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typenamebuiltin/type_name + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + type_name(true, x) + } + data: {} + want_result: + - x: boolean diff --git a/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0850.yaml b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0850.yaml new file mode 100644 index 0000000000..9b833dd1f4 --- /dev/null +++ b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0850.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typenamebuiltin/type_name + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + type_name(100, x) + } + data: {} + want_result: + - x: number diff --git a/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0851.yaml b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0851.yaml new file mode 100644 index 0000000000..c26b1370ea --- /dev/null +++ b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0851.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typenamebuiltin/type_name + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + type_name("Hello", x) + } + data: {} + want_result: + - x: string diff --git a/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0852.yaml b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0852.yaml new file mode 100644 index 0000000000..cfbdcc26c8 --- /dev/null +++ b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0852.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typenamebuiltin/type_name + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + type_name([1, 2, 3], x) + } + data: {} + want_result: + - x: array diff --git a/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0853.yaml b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0853.yaml new file mode 100644 index 0000000000..06fbb5e5dd --- /dev/null +++ b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0853.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: typenamebuiltin/type_name + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + type_name({1, 2, 3}, x) + } + data: {} + want_result: + - x: set diff --git a/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0854.yaml b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0854.yaml new file mode 100644 index 0000000000..0ba48d03a8 --- /dev/null +++ b/test/cases/testdata/v1/typenamebuiltin/test-typenamebuiltin-0854.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: typenamebuiltin/type_name + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + __local0__ = {"foo": yy | yy = 1} + type_name(__local0__, x) + } + data: {} + want_result: + - x: object diff --git a/test/cases/testdata/v1/undos/test-undos-0599.yaml b/test/cases/testdata/v1/undos/test-undos-0599.yaml new file mode 100644 index 0000000000..b248d3b4f0 --- /dev/null +++ b/test/cases/testdata/v1/undos/test-undos-0599.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: undos/array-type + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + arr = [[1, [2]], [1, null], [2, [2]]] + [x, [2]] = arr[_] + } + data: {} + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/undos/test-undos-0600.yaml b/test/cases/testdata/v1/undos/test-undos-0600.yaml new file mode 100644 index 0000000000..03cefce274 --- /dev/null +++ b/test/cases/testdata/v1/undos/test-undos-0600.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: undos/arrays-element + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + arr = [[1, 2], [1, null], [2, 2]] + arr[_] = [x, 2] + } + data: {} + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/undos/test-undos-0601.yaml b/test/cases/testdata/v1/undos/test-undos-0601.yaml new file mode 100644 index 0000000000..38f2d202a4 --- /dev/null +++ b/test/cases/testdata/v1/undos/test-undos-0601.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: undos/arrays-length + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + arr = [[1, [2]], [1, []], [2, [2]]] + arr[_] = [x, [2]] + } + data: {} + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/undos/test-undos-0602.yaml b/test/cases/testdata/v1/undos/test-undos-0602.yaml new file mode 100644 index 0000000000..f7d700dff9 --- /dev/null +++ b/test/cases/testdata/v1/undos/test-undos-0602.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: undos/array-ref-element + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.arr_ref + arr = [[1, 2], __local0__, [2, 2]] + arr[_] = [x, 2] + } + data: + arr_ref: + - 1 + - null + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/undos/test-undos-0603.yaml b/test/cases/testdata/v1/undos/test-undos-0603.yaml new file mode 100644 index 0000000000..66b6f06188 --- /dev/null +++ b/test/cases/testdata/v1/undos/test-undos-0603.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: undos/object-type + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + obj = {"a": {"x": 1, "y": {"v": 2}}, "b": {"x": 1, "y": null}, "c": {"x": 2, "y": {"v": 2}}} + {"x": x, "y": {"v": 2}} = obj[_] + } + data: {} + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/undos/test-undos-0604.yaml b/test/cases/testdata/v1/undos/test-undos-0604.yaml new file mode 100644 index 0000000000..d6b8503f97 --- /dev/null +++ b/test/cases/testdata/v1/undos/test-undos-0604.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: undos/objects-element + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + obj = {"a": {"x": 1, "y": 2}, "b": {"x": 1, "y": null}, "c": {"x": 2, "y": 2}} + obj[_] = {"x": x, "y": 2} + } + data: {} + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/undos/test-undos-0605.yaml b/test/cases/testdata/v1/undos/test-undos-0605.yaml new file mode 100644 index 0000000000..99eb6ef9d6 --- /dev/null +++ b/test/cases/testdata/v1/undos/test-undos-0605.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: undos/objects-length + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + obj = {"a": {"x": 1, "y": {"v": 2}}, "b": {"x": 1, "y": {}}, "c": {"x": 2, "y": {"v": 2}}} + obj[_] = {"x": x, "y": {"v": 2}} + } + data: {} + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/undos/test-undos-0606.yaml b/test/cases/testdata/v1/undos/test-undos-0606.yaml new file mode 100644 index 0000000000..55cbf7a854 --- /dev/null +++ b/test/cases/testdata/v1/undos/test-undos-0606.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: undos/object-ref-element + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.obj_ref + obj = {"a": {"x": 1, "y": 2}, "b": __local0__, "c": {"x": 2, "y": 2}} + obj[_] = {"x": x, "y": 2} + } + data: + obj_ref: + "true": null + x: 1 + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/undos/test-undos-0607.yaml b/test/cases/testdata/v1/undos/test-undos-0607.yaml new file mode 100644 index 0000000000..b69eedbb3b --- /dev/null +++ b/test/cases/testdata/v1/undos/test-undos-0607.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: undos/object-ref-missing-key + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.obj_ref_missing_key + obj = {"a": {"x": 1, "y": 2}, "b": __local0__, "c": {"x": 2, "y": 2}} + obj[_] = {"x": x, "y": 2} + } + data: + obj_ref_missing_key: + x: 3 + z: 2 + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/union/test-union-0357.yaml b/test/cases/testdata/v1/union/test-union-0357.yaml new file mode 100644 index 0000000000..0b462842ff --- /dev/null +++ b/test/cases/testdata/v1/union/test-union-0357.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: union/union_0_sets + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + union(set(), x) + } + data: {} + want_result: + - x: [] diff --git a/test/cases/testdata/v1/union/test-union-0358.yaml b/test/cases/testdata/v1/union/test-union-0358.yaml new file mode 100644 index 0000000000..27b1d37264 --- /dev/null +++ b/test/cases/testdata/v1/union/test-union-0358.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: union/union_2_sets + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + union({set(), {1, 2}}, x) + } + data: {} + want_result: + - x: + - 1 + - 2 diff --git a/test/cases/testdata/v1/union/test-union-0359.yaml b/test/cases/testdata/v1/union/test-union-0359.yaml new file mode 100644 index 0000000000..d1deb10fbb --- /dev/null +++ b/test/cases/testdata/v1/union/test-union-0359.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: union/union_2_sets + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + s1 = {1, 2, 3} + s2 = {2} + union({s1, s2}, x) + } + data: {} + want_result: + - x: + - 1 + - 2 + - 3 diff --git a/test/cases/testdata/v1/union/test-union-0360.yaml b/test/cases/testdata/v1/union/test-union-0360.yaml new file mode 100644 index 0000000000..e1441747c6 --- /dev/null +++ b/test/cases/testdata/v1/union/test-union-0360.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: union/union_3_sets + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + s1 = {1, 2, 3} + s2 = {2, 3, 4} + s3 = {4, 5, 6} + union({s1, s2, s3}, x) + } + data: {} + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + sort_bindings: true diff --git a/test/cases/testdata/v1/union/test-union-0361.yaml b/test/cases/testdata/v1/union/test-union-0361.yaml new file mode 100644 index 0000000000..2bb4c15901 --- /dev/null +++ b/test/cases/testdata/v1/union/test-union-0361.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: union/union_4_sets + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + s1 = {"a", "b", "c", "d"} + s2 = {"b", "c", "d"} + s3 = {"c", "d"} + s4 = {"d"} + union({s1, s2, s3, s4}, x) + } + data: {} + want_result: + - x: + - a + - b + - c + - d + sort_bindings: true diff --git a/test/cases/testdata/v1/units/test-issue-4856.yaml b/test/cases/testdata/v1/units/test-issue-4856.yaml new file mode 100644 index 0000000000..a7e6a4f4b6 --- /dev/null +++ b/test/cases/testdata/v1/units/test-issue-4856.yaml @@ -0,0 +1,35 @@ +--- +cases: + - note: units_parse/exact comparison - regression case 1 + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("500m") == 0.5 + } + want_result: + - x: true + - note: units_parse/exact comparison - regression case 2 + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("0.0005K") == 0.5 + } + want_result: + - x: true + - note: units_parse/exact comparison - regression case 3 + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("0.0000005M") == 0.5 + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/units/test-parse-bytes-comparisons.yaml b/test/cases/testdata/v1/units/test-parse-bytes-comparisons.yaml new file mode 100644 index 0000000000..2e4aaa4f49 --- /dev/null +++ b/test/cases/testdata/v1/units/test-parse-bytes-comparisons.yaml @@ -0,0 +1,112 @@ +--- +cases: + - note: units_parse_bytes/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("8kb") > units.parse_bytes("7kb") + } + want_result: + - x: true + - note: units_parse_bytes/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("8gb") > units.parse_bytes("8mb") + } + want_result: + - x: true + - note: units_parse_bytes/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("1234kb") < units.parse_bytes("1gb") + } + want_result: + - x: true + - note: units_parse_bytes/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("1024") == units.parse_bytes("1KiB") + } + want_result: + - x: true + - note: units_parse_bytes/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("2MiB") == units.parse_bytes("2097152") + } + want_result: + - x: true + - note: units_parse_bytes/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("3MiB") > units.parse_bytes("3MB") + } + want_result: + - x: true + - note: units_parse_bytes/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("2MiB") == units.parse_bytes("2Mi") + } + want_result: + - x: true + - note: units_parse_bytes/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("4Mi") > units.parse_bytes("4M") + } + want_result: + - x: true + - note: units_parse_bytes/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("4.1Mi") > units.parse_bytes("4Mi") + } + want_result: + - x: true + - note: units_parse_bytes/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("128Gi") == units.parse_bytes("137438953472") + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/units/test-parse-bytes-errors.yaml b/test/cases/testdata/v1/units/test-parse-bytes-errors.yaml new file mode 100644 index 0000000000..5afa521397 --- /dev/null +++ b/test/cases/testdata/v1/units/test-parse-bytes-errors.yaml @@ -0,0 +1,86 @@ +--- +cases: + - note: units_parse_bytes/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("") + } + want_error_code: eval_builtin_error + want_error: "units.parse_bytes: no byte amount provided" + strict_error: true + - note: units_parse_bytes/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("GB") + } + want_error_code: eval_builtin_error + want_error: "units.parse_bytes: no byte amount provided" + strict_error: true + - note: units_parse_bytes/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("foo") + } + want_error_code: eval_builtin_error + want_error: "units.parse_bytes: no byte amount provided" + strict_error: true + - note: units_parse_bytes/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("0.0.0") + } + want_error_code: eval_builtin_error + want_error: "units.parse_bytes: could not parse byte amount to a number" + strict_error: true + - note: units_parse_bytes/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes(".5.2") + } + want_error_code: eval_builtin_error + want_error: "units.parse_bytes: could not parse byte amount to a number" + strict_error: true + - note: units_parse_bytes/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100 kb") + } + want_error_code: eval_builtin_error + want_error: "units.parse_bytes: spaces not allowed in resource strings" + strict_error: true + - note: units_parse_bytes/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes(" 327MiB ") + } + want_error_code: eval_builtin_error + want_error: "units.parse_bytes: spaces not allowed in resource strings" + strict_error: true diff --git a/test/cases/testdata/v1/units/test-parse-bytes.yaml b/test/cases/testdata/v1/units/test-parse-bytes.yaml new file mode 100644 index 0000000000..ff6ace9d97 --- /dev/null +++ b/test/cases/testdata/v1/units/test-parse-bytes.yaml @@ -0,0 +1,420 @@ +--- +cases: + - note: units_parse_bytes/removes quotes and lowercases string + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("\"100TIB\"") == 109951162777600 + } + want_result: + - x: true + - note: units_parse_bytes/zero + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("0") == 0 + } + want_result: + - x: true + - note: units_parse_bytes/zero float + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("0.0") == 0 + } + want_result: + - x: true + - note: units_parse_bytes/zero bare float + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes(".0") == 0 + } + want_result: + - x: true + - note: units_parse_bytes/raw number + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("12345") == 12345 + } + want_result: + - x: true + - note: units_parse_bytes/10 kilobytes uppercase + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("10KB") == 10000 + } + want_result: + - x: true + - note: units_parse_bytes/10 KiB uppercase + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("10KIB") == 10240 + } + want_result: + - x: true + - note: units_parse_bytes/10 KB lowercase + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("10kb") == 10000 + } + want_result: + - x: true + - note: units_parse_bytes/10 KiB mixed case + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("10Kib") == 10240 + } + want_result: + - x: true + - note: units_parse_bytes/200 megabytes as mb + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("200mb") == 200000000 + } + want_result: + - x: true + - note: units_parse_bytes/300 GiB + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("300GiB") == 322122547200 + } + want_result: + - x: true + - note: units_parse_bytes/1.1 KB floating point + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("1.1KB") == 1100 + } + want_result: + - x: true + - note: units_parse_bytes/1.1 KiB floating point rounded + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("1.1KiB") == 1126 + } + want_result: + - x: true + - note: units_parse_bytes/.5 KB bare floating point + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes(".5KB") == 500 + } + want_result: + - x: true + - note: units_parse_bytes/100 kilobytes as k + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100k") == 100000 + } + want_result: + - x: true + - note: units_parse_bytes/100 kilobytes as kb + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100kb") == 100000 + } + want_result: + - x: true + - note: units_parse_bytes/100 kibibytes as ki + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100ki") == 102400 + } + want_result: + - x: true + - note: units_parse_bytes/100 kibibytes as kib + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100kib") == 102400 + } + want_result: + - x: true + - note: units_parse_bytes/100 megabytes as m + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100m") == 100000000 + } + want_result: + - x: true + - note: units_parse_bytes/100 megabytes as mb + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100mb") == 100000000 + } + want_result: + - x: true + - note: units_parse_bytes/100 mebibytes as mi + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100mi") == 104857600 + } + want_result: + - x: true + - note: units_parse_bytes/100 mebibytes as mib + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100mib") == 104857600 + } + want_result: + - x: true + - note: units_parse_bytes/100 gigabytes as g + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100g") == 100000000000 + } + want_result: + - x: true + - note: units_parse_bytes/100 gigabytes as gb + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100gb") == 100000000000 + } + want_result: + - x: true + - note: units_parse_bytes/100 gibibytes as gi + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100gi") == 107374182400 + } + want_result: + - x: true + - note: units_parse_bytes/100 gibibytes as gib + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100gib") == 107374182400 + } + want_result: + - x: true + - note: units_parse_bytes/100 terabytes as t + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100t") == 100000000000000 + } + want_result: + - x: true + - note: units_parse_bytes/100 terabytes as tb + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100tb") == 100000000000000 + } + want_result: + - x: true + - note: units_parse_bytes/100 tebibytes as ti + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100ti") == 109951162777600 + } + want_result: + - x: true + - note: units_parse_bytes/100 tebibytes as tib + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100tib") == 109951162777600 + } + want_result: + - x: true + - note: units_parse_bytes/100 petabytes as p + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100p") == 100000000000000000 + } + want_result: + - x: true + - note: units_parse_bytes/100 petabytes as pb + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100pb") == 100000000000000000 + } + want_result: + - x: true + - note: units_parse_bytes/100 pebibytes as pi + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100pi") == 112589990684262400 + } + want_result: + - x: true + - note: units_parse_bytes/100 pebibytes as pib + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("100pib") == 112589990684262400 + } + want_result: + - x: true + - note: units_parse_bytes/10 etabytes as e + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("10e") == 10000000000000000000 + } + want_result: + - x: true + - note: units_parse_bytes/10 etabytes as eb + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("10eb") == 10000000000000000000 + } + want_result: + - x: true + - note: units_parse_bytes/10 ebibytes as ei + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("10ei") == 11529215046068469760 + } + want_result: + - x: true + - note: units_parse_bytes/10 ebibytes as eib + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse_bytes("10eib") == 11529215046068469760 + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/units/test-parse-units-comparisons.yaml b/test/cases/testdata/v1/units/test-parse-units-comparisons.yaml new file mode 100644 index 0000000000..d5b5976630 --- /dev/null +++ b/test/cases/testdata/v1/units/test-parse-units-comparisons.yaml @@ -0,0 +1,112 @@ +--- +cases: + - note: units_parse/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("8k") > units.parse("7k") + } + want_result: + - x: true + - note: units_parse/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("8g") > units.parse("8m") + } + want_result: + - x: true + - note: units_parse/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("1234k") < units.parse("1g") + } + want_result: + - x: true + - note: units_parse/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("1024") == units.parse("1Ki") + } + want_result: + - x: true + - note: units_parse/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("2Mi") == units.parse("2097152") + } + want_result: + - x: true + - note: units_parse/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("3Mi") > units.parse("3M") + } + want_result: + - x: true + - note: units_parse/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("2Mi") == units.parse("2Mi") + } + want_result: + - x: true + - note: units_parse/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("4Mi") > units.parse("4M") + } + want_result: + - x: true + - note: units_parse/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("4.1Mi") > units.parse("4Mi") + } + want_result: + - x: true + - note: units_parse/comparison + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("128Gi") == units.parse("137438953472") + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/units/test-parse-units-errors.yaml b/test/cases/testdata/v1/units/test-parse-units-errors.yaml new file mode 100644 index 0000000000..4ee238f449 --- /dev/null +++ b/test/cases/testdata/v1/units/test-parse-units-errors.yaml @@ -0,0 +1,86 @@ +--- +cases: + - note: units_parse/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("") + } + want_error_code: eval_builtin_error + want_error: "units.parse: no amount provided" + strict_error: true + - note: units_parse/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("G") + } + want_error_code: eval_builtin_error + want_error: "units.parse: no amount provided" + strict_error: true + - note: units_parse/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("foo") + } + want_error_code: eval_builtin_error + want_error: "units.parse: no amount provided" + strict_error: true + - note: units_parse/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("0.0.0") + } + want_error_code: eval_builtin_error + want_error: "units.parse: could not parse amount to a number" + strict_error: true + - note: units_parse/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse(".5.2") + } + want_error_code: eval_builtin_error + want_error: "units.parse: could not parse amount to a number" + strict_error: true + - note: units_parse/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100 k") + } + want_error_code: eval_builtin_error + want_error: "units.parse: spaces not allowed in resource strings" + strict_error: true + - note: units_parse/failure + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse(" 327Mi ") + } + want_error_code: eval_builtin_error + want_error: "units.parse: spaces not allowed in resource strings" + strict_error: true diff --git a/test/cases/testdata/v1/units/test-parse-units.yaml b/test/cases/testdata/v1/units/test-parse-units.yaml new file mode 100644 index 0000000000..d77ac6ebe2 --- /dev/null +++ b/test/cases/testdata/v1/units/test-parse-units.yaml @@ -0,0 +1,398 @@ +--- +cases: + - note: units_parse/removes quotes and lowercases string + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("\"100TI\"") == 109951162777600 + } + want_result: + - x: true + - note: units_parse/zero + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("0") == 0 + } + want_result: + - x: true + - note: units_parse/zero float + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("0.0") == 0 + } + want_result: + - x: true + - note: units_parse/zero bare float + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse(".0") == 0 + } + want_result: + - x: true + - note: units_parse/raw number + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("12345") == 12345 + } + want_result: + - x: true + - note: units_parse/10 kilo uppercase + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("10K") == 10000 + } + want_result: + - x: true + - note: units_parse/10 Ki uppercase + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("10KI") == 10240 + } + want_result: + - x: true + - note: units_parse/10 K lowercase + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("10k") == 10000 + } + want_result: + - x: true + - note: units_parse/10 Ki mixed case + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("10Ki") == 10240 + } + want_result: + - x: true + - note: units_parse/200 mega + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("200M") == 200000000 + } + want_result: + - x: true + - note: units_parse/300 Gi + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("300Gi") == 322122547200 + } + want_result: + - x: true + - note: units_parse/1.1 K floating point + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("1.1K") == 1100 + } + want_result: + - x: true + - note: units_parse/1.1 Ki floating point, not rounded + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("1.1Ki") == 1126.4 + } + want_result: + - x: true + - note: units_parse/.5 K bare floating point + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse(".5K") == 500 + } + want_result: + - x: true + - note: units_parse/100 kilo as k + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100k") == 100000 + } + want_result: + - x: true + - note: units_parse/100 kilo as K + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100K") == 100000 + } + want_result: + - x: true + - note: units_parse/100 kibi as ki + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100ki") == 102400 + } + want_result: + - x: true + - note: units_parse/100 kibi as Ki + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100Ki") == 102400 + } + want_result: + - x: true + - note: units_parse/100 milli as m + query: data.test.p = x + modules: + - | + package test + + p if { + round(units.parse("100m") * 1000) == 100 + } + want_result: + - x: true + - note: units_parse/100 mega as M + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100M") == 100000000 + } + want_result: + - x: true + - note: units_parse/100 mebi as mi + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100mi") == 104857600 + } + want_result: + - x: true + - note: units_parse/100 mebi as Mi + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100Mi") == 104857600 + } + want_result: + - x: true + - note: units_parse/100 giga as g + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100g") == 100000000000 + } + want_result: + - x: true + - note: units_parse/100 gibi as gi + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100gi") == 107374182400 + } + want_result: + - x: true + - note: units_parse/100 tera as t + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100t") == 100000000000000 + } + want_result: + - x: true + - note: units_parse/100 tera as T + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100T") == 100000000000000 + } + want_result: + - x: true + - note: units_parse/100 tebi as ti + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100ti") == 109951162777600 + } + want_result: + - x: true + - note: units_parse/100 tebi as Ti + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100Ti") == 109951162777600 + } + want_result: + - x: true + - note: units_parse/100 peta as p + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100p") == 100000000000000000 + } + want_result: + - x: true + - note: units_parse/100 peta as P + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100P") == 100000000000000000 + } + want_result: + - x: true + - note: units_parse/100 pebi as pi + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100pi") == 112589990684262400 + } + want_result: + - x: true + - note: units_parse/100 pebi as Pi + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("100Pi") == 112589990684262400 + } + want_result: + - x: true + - note: units_parse/10 eta as e + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("10e") == 10000000000000000000 + } + want_result: + - x: true + - note: units_parse/10 eta as E + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("10E") == 10000000000000000000 + } + want_result: + - x: true + - note: units_parse/10 ebi as ei + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("10ei") == 11529215046068469760 + } + want_result: + - x: true + - note: units_parse/10 ebi as Ei + query: data.test.p = x + modules: + - | + package test + + p if { + units.parse("10Ei") == 11529215046068469760 + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/units/test-units-precision.yaml b/test/cases/testdata/v1/units/test-units-precision.yaml new file mode 100644 index 0000000000..7e659c3e0a --- /dev/null +++ b/test/cases/testdata/v1/units/test-units-precision.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: units_parse/no decimal places for integers + query: data.test.p = x + modules: + - | + package test + + p if { + json.marshal(units.parse("1G")) == json.marshal(1000000000) + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0939.yaml b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0939.yaml new file mode 100644 index 0000000000..effe05be8f --- /dev/null +++ b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0939.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: urlbuiltins/encode + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + urlquery.encode("a=b+1", x) + } + data: {} + want_result: + - x: a%3Db%2B1 diff --git a/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0940.yaml b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0940.yaml new file mode 100644 index 0000000000..9198f718a6 --- /dev/null +++ b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0940.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: urlbuiltins/encode empty + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + urlquery.encode("", x) + } + data: {} + want_result: + - x: "" diff --git a/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0941.yaml b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0941.yaml new file mode 100644 index 0000000000..553e8b070f --- /dev/null +++ b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0941.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: urlbuiltins/decode + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + urlquery.decode("a%3Db%2B1", x) + } + data: {} + want_result: + - x: a=b+1 diff --git a/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0942.yaml b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0942.yaml new file mode 100644 index 0000000000..1823fd1265 --- /dev/null +++ b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0942.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: urlbuiltins/encode_object empty + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + urlquery.encode_object({}, x) + } + data: {} + want_result: + - x: "" diff --git a/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0943.yaml b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0943.yaml new file mode 100644 index 0000000000..5b45027c1e --- /dev/null +++ b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0943.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: urlbuiltins/encode_object strings + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + urlquery.encode_object({"a": "b", "c": "d"}, x) + } + data: {} + want_result: + - x: a=b&c=d diff --git a/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0944.yaml b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0944.yaml new file mode 100644 index 0000000000..58e7e25014 --- /dev/null +++ b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0944.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: urlbuiltins/encode_object escape + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + urlquery.encode_object({"a": "c=b+1"}, x) + } + data: {} + want_result: + - x: a=c%3Db%2B1 diff --git a/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0945.yaml b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0945.yaml new file mode 100644 index 0000000000..00801a9f32 --- /dev/null +++ b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0945.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: urlbuiltins/encode_object array + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + urlquery.encode_object({"a": ["b+1", "c+2"]}, x) + } + data: {} + want_result: + - x: a=b%2B1&a=c%2B2 diff --git a/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0946.yaml b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0946.yaml new file mode 100644 index 0000000000..4c36acff76 --- /dev/null +++ b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-0946.yaml @@ -0,0 +1,14 @@ +--- +cases: + - note: urlbuiltins/encode_object set + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + urlquery.encode_object({"a": {"b+1"}}, x) + } + data: {} + want_result: + - x: a=b%2B1 diff --git a/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-1076.yaml b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-1076.yaml new file mode 100644 index 0000000000..71ae4713e7 --- /dev/null +++ b/test/cases/testdata/v1/urlbuiltins/test-urlbuiltins-1076.yaml @@ -0,0 +1,44 @@ +--- +cases: + - note: urlbuiltins/decode_object multiple + query: data.decode_object.p = x + modules: + - | + package decode_object + + p := x if { + x = urlquery.decode_object("a=value_a1&b=value_b&a=value_a2") + } + want_result: + - x: + a: + - value_a1 + - value_a2 + b: + - value_b + - note: urlbuiltins/decode_object empty parameter + query: data.decode_object.p = x + modules: + - | + package decode_object + + p := x if { + x = urlquery.decode_object("a=value_a1&b") + } + want_result: + - x: + a: + - value_a1 + b: + - "" + - note: urlbuiltins/decode_object empty string + query: data.decode_object.p = x + modules: + - | + package decode_object + + p := x if { + x = urlquery.decode_object("") + } + want_result: + - x: {} diff --git a/test/cases/testdata/v1/uuid/test-uuid-input-formats.yaml b/test/cases/testdata/v1/uuid/test-uuid-input-formats.yaml new file mode 100644 index 0000000000..fc148568fc --- /dev/null +++ b/test/cases/testdata/v1/uuid/test-uuid-input-formats.yaml @@ -0,0 +1,50 @@ +--- +cases: + - note: uuid-parse/positive-v4-braces + query: data.test.p = x + modules: + - | + package test + + p := uuid.parse(input.userid) + data: {} + input: + userid: "{00000000-0000-4000-8000-000000000000}" + want_result: + - x: + variant: RFC4122 + version: 4 + - note: uuid-parse/positive-v2-urn + query: data.test.p = x + modules: + - | + package test + + p := uuid.parse(input.userid) + data: {} + input: + userid: urn:uuid:000003e8-48b9-21ee-b200-325096b39f47 + want_result: + - x: + clocksequence: 12800 + domain: Person + id: 1000 + macvariables: local:unicast + nodeid: 32-50-96-b3-9f-47 + time: 1693566990121469600 + variant: RFC4122 + version: 2 + - note: uuid-parse/positive-v3-no-dashes + query: data.test.p = x + modules: + - | + package test + + p := uuid.parse(input.userid) + data: {} + input: + userid: 6bea8ef2d3d33cd184e09bab06a52ece + want_result: + - x: + variant: RFC4122 + version: 3 diff --git a/test/cases/testdata/v1/uuid/test-uuid-parse-rule.yaml b/test/cases/testdata/v1/uuid/test-uuid-parse-rule.yaml new file mode 100644 index 0000000000..e7b22fa21b --- /dev/null +++ b/test/cases/testdata/v1/uuid/test-uuid-parse-rule.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: uuid-parse-rule/positive + query: data.test.validuser = x + modules: + - | + package test + + validuser if { + is_string(input.userid) + parsed_uuid := uuid.parse(input.userid) + parsed_uuid.variant == "RFC4122" + parsed_uuid.version == 4 + } + data: {} + input: + userid: 00000000-0000-4000-8000-000000000000 + want_result: + - x: true diff --git a/test/cases/testdata/v1/uuid/test-uuid-parse.yaml b/test/cases/testdata/v1/uuid/test-uuid-parse.yaml new file mode 100644 index 0000000000..5b426fc033 --- /dev/null +++ b/test/cases/testdata/v1/uuid/test-uuid-parse.yaml @@ -0,0 +1,61 @@ +--- +cases: + - note: uuid-parse/positive-v4 + query: data.test.p = x + modules: + - | + package test + + p := uuid.parse(input.userid) + data: {} + input: + userid: 00000000-0000-4000-8000-000000000000 + want_result: + - x: + variant: RFC4122 + version: 4 + - note: uuid-parse/positive-v2 + query: data.test.p = x + modules: + - | + package test + + p := uuid.parse(input.userid) + data: {} + input: + userid: 000003e8-48b9-21ee-b200-325096b39f47 + want_result: + - x: + clocksequence: 12800 + domain: Person + id: 1000 + macvariables: local:unicast + nodeid: 32-50-96-b3-9f-47 + time: 1693566990121469600 + variant: RFC4122 + version: 2 + - note: uuid-parse/positive-v3 + query: data.test.p = x + modules: + - | + package test + + p := uuid.parse(input.userid) + data: {} + input: + userid: 38074da4-0b00-388d-9c3c-362de965547a + want_result: + - x: + variant: RFC4122 + version: 3 + - note: uuid-parse/negative + query: data.test.p = x + modules: + - | + package test + + p := uuid.parse(input.userid) + data: {} + input: + userid: 123 + want_result: [] diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0726.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0726.yaml new file mode 100644 index 0000000000..89d0d99735 --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0726.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: varreferences/ground + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + v = [[1, 2], [2, 3], [3, 4]] + x = v[2][1] + } + data: {} + want_result: + - x: + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0727.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0727.yaml new file mode 100644 index 0000000000..874ac9285e --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0727.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: varreferences/non-ground + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + v = [[1, 2], [2, 3], [3, 4]] + x = v[i][j] + } + data: {} + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0728.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0728.yaml new file mode 100644 index 0000000000..dc302aa3c7 --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0728.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: varreferences/mixed + query: data.generated.p = x + modules: + - | + package generated + + p[x] := y if { + v = [{"a": 1, "b": 2}, {"c": 3, "z": [4]}] + y = v[i][x][j] + } + data: {} + want_result: + - x: + z: 4 diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0729.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0729.yaml new file mode 100644 index 0000000000..917c803b0f --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0729.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: varreferences/ref binding + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + v = data.c[i][j] + x = v[k] + x = true + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - true + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0730.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0730.yaml new file mode 100644 index 0000000000..6815d2c621 --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0730.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: varreferences/existing ref binding + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + q = data.a + q[0] = x + q[0] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0731.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0731.yaml new file mode 100644 index 0000000000..f215541328 --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0731.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: varreferences/embedded + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + v = [1, 2, 3] + __local0__ = v[i] + x = [{"a": __local0__}] + } + data: {} + want_result: + - x: + - - a: 1 + - - a: 2 + - - a: 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0732.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0732.yaml new file mode 100644 index 0000000000..2b855b6fd0 --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0732.yaml @@ -0,0 +1,34 @@ +--- +cases: + - note: varreferences/embedded ref binding + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + v = data.c[i][j] + __local0__ = v[0] + __local1__ = v[1] + w = [__local0__, __local1__] + x = w[y] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - null + - false + - true + - 3.14159 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0733.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0733.yaml new file mode 100644 index 0000000000..98c3b38105 --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0733.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "varreferences/array: ground var" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + i = [1, 2, 3, 4] + j = [1, 2, 999] + j[k] = y + i[y] = x + } + data: {} + want_result: + - x: + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0734.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0734.yaml new file mode 100644 index 0000000000..226fcbd24b --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0734.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "varreferences/array: ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + i = [1, 2, 3, 4] + x = data.a[_] + i[x] = y + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0735.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0735.yaml new file mode 100644 index 0000000000..73ab01fc03 --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0735.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "varreferences/object: ground var" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + i = {"a": 1, "b": 2, "c": 3} + j = ["a", "c", "deadbeef"] + j[k] = y + i[y] = x + } + data: {} + want_result: + - x: + - 1 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0736.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0736.yaml new file mode 100644 index 0000000000..438855478e --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0736.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "varreferences/object: ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + i = {"1": 1, "2": 2, "4": 4} + x = data.numbers[_] + i[x] = y + } + data: + numbers: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: + - 1 + - 2 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0737.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0737.yaml new file mode 100644 index 0000000000..09c40b1cfa --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0737.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "varreferences/set: ground var" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + i = {1, 2, 3, 4} + j = {1, 2, 99} + j[x] + i[x] + } + data: {} + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0738.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0738.yaml new file mode 100644 index 0000000000..81f4c17c25 --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0738.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "varreferences/set: ref" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + i = {1, 2, 3, 4} + x = data.a[_] + i[x] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0739.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0739.yaml new file mode 100644 index 0000000000..5eb8770c03 --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0739.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "varreferences/set: lookup: base docs" + query: data.generated.p = x + modules: + - | + package generated + + p if { + v = {[1, 999], [3, 4]} + __local0__ = data.a[2] + pair = [__local0__, 4] + v[pair] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0740.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0740.yaml new file mode 100644 index 0000000000..55ff5fd6dc --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0740.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "varreferences/set: lookup: embedded" + query: data.generated.p = x + modules: + - | + package generated + + p if { + x = [{}, {[1, 2], [3, 4]}] + y = [3, 4] + x[i][y] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0741.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0741.yaml new file mode 100644 index 0000000000..fb00750d64 --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0741.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: "varreferences/set: lookup: dereference" + query: data.generated.p = x + modules: + - | + package generated + + p contains [i, z, r] if { + x = [{}, {[1, 2], [3, 4]}] + y = [3, 4] + x[i][y][z] = r + } + data: {} + want_result: + - x: + - - 1 + - 0 + - 3 + - - 1 + - 1 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/varreferences/test-varreferences-0742.yaml b/test/cases/testdata/v1/varreferences/test-varreferences-0742.yaml new file mode 100644 index 0000000000..56fb83376a --- /dev/null +++ b/test/cases/testdata/v1/varreferences/test-varreferences-0742.yaml @@ -0,0 +1,15 @@ +--- +cases: + - note: varreferences/avoids indexer + query: data.generated.p = x + modules: + - | + package generated + + p if { + somevar = [1, 2, 3] + somevar[i] = 2 + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0620.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0620.yaml new file mode 100644 index 0000000000..0f58a9b30a --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0620.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: "virtualdocs/input: set 1" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[1] + } + + q contains x if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0621.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0621.yaml new file mode 100644 index 0000000000..00e2d88076 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0621.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "virtualdocs/input: set 2" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[1] = x + } + + q contains x if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0622.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0622.yaml new file mode 100644 index 0000000000..e660c545a5 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0622.yaml @@ -0,0 +1,27 @@ +--- +cases: + - note: "virtualdocs/input: set embedded" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.generated.q[2] + x = {"b": [__local0__]} + } + + q contains x if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - b: + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0623.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0623.yaml new file mode 100644 index 0000000000..2056325024 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0623.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: "virtualdocs/input: set undefined" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[1000] + } + + q contains x if { + data.a[x] = y + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0624.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0624.yaml new file mode 100644 index 0000000000..6858b7c404 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0624.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: "virtualdocs/input: set dereference" + query: data.generated.p = x + modules: + - | + package generated + + p := y if { + x = [1] + data.generated.q[x][0] = y + } + + q contains [x] if { + data.a[_] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0625.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0625.yaml new file mode 100644 index 0000000000..3e6e216171 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0625.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "virtualdocs/input: set ground var" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + x = 1 + data.generated.q[x] + } + + q contains y if { + data.a[y] = i + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0626.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0626.yaml new file mode 100644 index 0000000000..7e28df7e9d --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0626.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "virtualdocs/input: set ground composite (1)" + query: data.generated.p = x + modules: + - | + package generated + + p if { + z = [[1, 2], 2] + data.generated.q[z] + } + + q contains [x, y] if { + y = 2 + x = [1, y] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0627.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0627.yaml new file mode 100644 index 0000000000..4952572bb2 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0627.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: "virtualdocs/input: set ground composite (2)" + query: data.generated.p = x + modules: + - | + package generated + + p if { + y = 2 + z = [[1, y], y] + data.generated.q[z] + } + + q contains [x, y] if { + y = 2 + x = [1, y] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0628.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0628.yaml new file mode 100644 index 0000000000..efe1e54c8a --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0628.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "virtualdocs/input: set ground composite (3)" + query: data.generated.p = x + modules: + - | + package generated + + p if { + y = 2 + x = [1, y] + z = [x, y] + data.generated.q[z] + } + + q contains [x, y] if { + y = 2 + x = [1, y] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0629.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0629.yaml new file mode 100644 index 0000000000..5692534529 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0629.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: "virtualdocs/input: set partially ground composite" + query: data.generated.p = x + modules: + - | + package generated + + p contains u if { + y = 2 + data.generated.q[z] + z = [x, y] + x = [1, u] + } + + q contains [x, y] if { + y = 2 + x = [1, y] + } + data: {} + want_result: + - x: + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0630.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0630.yaml new file mode 100644 index 0000000000..b3c76d8ad4 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0630.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: "virtualdocs/input: object 1" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[1] = 2 + } + + q[i] := x if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0631.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0631.yaml new file mode 100644 index 0000000000..7fef0d4693 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0631.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: "virtualdocs/input: object 2" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[1] = 0 + } + + q[x] := i if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0632.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0632.yaml new file mode 100644 index 0000000000..6ed8cd515b --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0632.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: "virtualdocs/input: object embedded 1" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.generated.q[3] + __local1__ = data.generated.q[2] + x = [1, __local0__, __local1__] + } + + q[i] := x if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - - 1 + - 4 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0633.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0633.yaml new file mode 100644 index 0000000000..96b8a8ca8e --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0633.yaml @@ -0,0 +1,30 @@ +--- +cases: + - note: "virtualdocs/input: object embedded 2" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.generated.q[3] + __local1__ = data.generated.q[2] + x = {"a": [__local0__], "b": [__local1__]} + } + + q[i] := x if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - a: + - 4 + b: + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0634.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0634.yaml new file mode 100644 index 0000000000..f9d0e886ef --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0634.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "virtualdocs/input: object undefined val" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[1] = 9999 + } + + q[i] := x if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: [] diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0635.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0635.yaml new file mode 100644 index 0000000000..f2146ea2e3 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0635.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "virtualdocs/input: object undefined key 1" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[9999] = 2 + } + + q[i] := x if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: [] diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0636.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0636.yaml new file mode 100644 index 0000000000..011d7f2852 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0636.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "virtualdocs/input: object undefined key 2" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q.foo = 2 + } + + q[i] := x if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: [] diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0637.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0637.yaml new file mode 100644 index 0000000000..a9c4071a27 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0637.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: "virtualdocs/input: object dereference ground" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[0].x[1] = false + } + + q[i] := x if { + x = data.c[i] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0638.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0638.yaml new file mode 100644 index 0000000000..e861fa50df --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0638.yaml @@ -0,0 +1,30 @@ +--- +cases: + - note: "virtualdocs/input: object dereference ground 2" + query: data.generated.p = x + modules: + - | + package generated + + p contains v if { + x = "a" + data.generated.q[x][y] = v + } + + q[k] := v if { + k = "a" + v = data.a + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0639.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0639.yaml new file mode 100644 index 0000000000..95d4c2316d --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0639.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: "virtualdocs/input: object defererence non-ground" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[0][x][y] = false + } + + q[i] := x if { + x = data.c[i] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0640.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0640.yaml new file mode 100644 index 0000000000..f98904ba91 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0640.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "virtualdocs/input: object ground var key" + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + x = "b" + data.generated.q[x] = y + } + + q[k] := v if { + x = {"a": 1, "b": 2} + x[k] = v + } + data: {} + want_result: + - x: + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0641.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0641.yaml new file mode 100644 index 0000000000..114e78f6c5 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0641.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "virtualdocs/input: object non-string key" + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + x = 1 + data.generated.q[x] = y + } + + q[k] := v if { + x = {1: 3, 2: 1} + x[k] = v + } + data: {} + want_result: + - x: + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0642.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0642.yaml new file mode 100644 index 0000000000..0568e54a3b --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0642.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: "virtualdocs/input: variable binding substitution" + query: data.generated.p = x + modules: + - | + package generated + + p[x] := y if { + data.generated.r[z] = y + data.generated.q[x] = z + } + + r[k] := v if { + x = {"a": 1, "b": 2, "c": 3, "d": 4} + x[k] = v + } + + q[y] := x if { + z = {"a": "a", "b": "b", "d": "d"} + z[y] = x + } + data: {} + want_result: + - x: + a: 1 + b: 2 + d: 4 diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0643.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0643.yaml new file mode 100644 index 0000000000..31f2401526 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0643.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: "virtualdocs/output: set" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[x] + } + + q contains y if { + data.a[i] = y + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0644.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0644.yaml new file mode 100644 index 0000000000..8b8649293b --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0644.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "virtualdocs/output: set embedded" + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + __local0__ = data.generated.q[i] + {i: [i]} = {i: [__local0__]} + } + + q contains x if { + data.d.e[i] = x + } + data: + d: + e: + - bar + - baz + want_result: + - x: + - bar + - baz + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0645.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0645.yaml new file mode 100644 index 0000000000..ebcc0320b3 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0645.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: "virtualdocs/output: set var binding" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[x] + } + + q contains y if { + i = 1 + j = 2 + y = [i, j] + } + data: {} + want_result: + - x: + - - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0646.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0646.yaml new file mode 100644 index 0000000000..f84cbedc85 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0646.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: "virtualdocs/output: set dereference" + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + data.generated.q[x][0] = y + } + + q contains [x] if { + data.a[_] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0647.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0647.yaml new file mode 100644 index 0000000000..c9e42b2bfc --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0647.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: "virtualdocs/output: set dereference deep" + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + data.generated.q[i][j][k][x] = y + } + + q contains {{[1], [2]}, {[3], [4]}} + data: {} + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0648.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0648.yaml new file mode 100644 index 0000000000..ac3cc9d0d2 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0648.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "virtualdocs/output: set falsy values" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[x] + } + + q := {0, "", false, null, [], {}, set()} + want_result: + - x: + - null + - 0 + - "" + - [] + - [] + - {} + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0649.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0649.yaml new file mode 100644 index 0000000000..553b99e3ca --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0649.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "virtualdocs/output: object key" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[x] = 4 + } + + q[i] := x if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0650.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0650.yaml new file mode 100644 index 0000000000..9fcec87ce9 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0650.yaml @@ -0,0 +1,27 @@ +--- +cases: + - note: "virtualdocs/output: object non-string key" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[x] = 1 + } + + q[k] := 1 if { + data.a[_] = k + k < 3 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0651.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0651.yaml new file mode 100644 index 0000000000..89c7676c11 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0651.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: "virtualdocs/output: object value" + query: data.generated.p = x + modules: + - | + package generated + + p[x] := y if { + data.generated.q[x] = y + } + + q[k] := v if { + data.b[k] = v + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: + v1: hello + v2: goodbye diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0652.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0652.yaml new file mode 100644 index 0000000000..d159b6fddf --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0652.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: "virtualdocs/output: object embedded" + query: data.generated.p = x + modules: + - | + package generated + + p[k] := v if { + __local0__ = data.generated.q[k] + {k: [__local0__]} = {k: [v]} + } + + q[x] := y if { + data.b[x] = y + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: + v1: hello + v2: goodbye diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0653.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0653.yaml new file mode 100644 index 0000000000..7d9620d085 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0653.yaml @@ -0,0 +1,31 @@ +--- +cases: + - note: "virtualdocs/output: object dereference ground" + query: data.generated.p = x + modules: + - | + package generated + + p contains i if { + data.generated.q[i].x[1] = false + } + + q[i] := x if { + x = data.c[i] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - 0 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0654.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0654.yaml new file mode 100644 index 0000000000..35a8c866c9 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0654.yaml @@ -0,0 +1,37 @@ +--- +cases: + - note: "virtualdocs/output: object defererence non-ground" + query: data.generated.p = x + modules: + - | + package generated + + p contains r if { + data.generated.q[x][y][z] = false + r = [x, y, z] + } + + q[i] := x if { + x = data.c[i] + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: + - - 0 + - x + - 1 + - - 0 + - z + - q + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0655.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0655.yaml new file mode 100644 index 0000000000..36f3fbb080 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0655.yaml @@ -0,0 +1,44 @@ +--- +cases: + - note: "virtualdocs/output: object dereference array of refs" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[_0][0].c[_1] = x + } + + q[k] := v if { + data.d.e[_0] = k + v = [r | r = data.l[_1]] + } + data: + d: + e: + - bar + - baz + l: + - a: bob + b: -1 + c: + - 1 + - 2 + - 3 + - 4 + - a: alice + b: 1 + c: + - 2 + - 3 + - 4 + - 5 + d: null + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0656.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0656.yaml new file mode 100644 index 0000000000..fc221cd46e --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0656.yaml @@ -0,0 +1,45 @@ +--- +cases: + - note: "virtualdocs/output: object dereference array of refs within object" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[_0].x[0].c[_1] = x + } + + q[k] := v if { + data.d.e[_0] = k + __local0__ = [r | r = data.l[_1]] + v = {"x": __local0__} + } + data: + d: + e: + - bar + - baz + l: + - a: bob + b: -1 + c: + - 1 + - 2 + - 3 + - 4 + - a: alice + b: 1 + c: + - 2 + - 3 + - 4 + - 5 + d: null + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0657.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0657.yaml new file mode 100644 index 0000000000..ca63d716f5 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0657.yaml @@ -0,0 +1,39 @@ +--- +cases: + - note: "virtualdocs/output: object dereference object with key refs" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q.bar[1].alice[0] = 1 + } + + q[k] := v if { + data.d.e[_] = k + v = [x | __local0__ = data.l[_].a; x = {__local0__: [1]}] + } + data: + d: + e: + - bar + - baz + l: + - a: bob + b: -1 + c: + - 1 + - 2 + - 3 + - 4 + - a: alice + b: 1 + c: + - 2 + - 3 + - 4 + - 5 + d: null + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0658.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0658.yaml new file mode 100644 index 0000000000..3d942f9851 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0658.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "virtualdocs/output: object var binding" + query: data.generated.p = x + modules: + - | + package generated + + p contains z if { + data.generated.q[x] = y + z = [x, y] + } + + q[k] := v if { + x = "a" + y = "b" + k = "foo" + v = [x, y] + } + data: {} + want_result: + - x: + - - foo + - - a + - b + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0659.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0659.yaml new file mode 100644 index 0000000000..e603b07554 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0659.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "virtualdocs/output: object key var binding" + query: data.generated.p = x + modules: + - | + package generated + + p contains z if { + data.generated.q[x] = y + z = [x, y] + } + + q[k] := v if { + x = "a" + v = "foo" + y = x + k = y + } + data: {} + want_result: + - x: + - - a + - foo + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0660.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0660.yaml new file mode 100644 index 0000000000..9ce8186528 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0660.yaml @@ -0,0 +1,27 @@ +--- +cases: + - note: "virtualdocs/object: self-join" + query: data.generated.p = x + modules: + - | + package generated + + p contains [x, y] if { + data.generated.q[x] = 1 + data.generated.q[y] = x + } + + q[x] := i if { + data.a[i] = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0661.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0661.yaml new file mode 100644 index 0000000000..37272d1664 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0661.yaml @@ -0,0 +1,27 @@ +--- +cases: + - note: "virtualdocs/i/o: objects" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[x] = data.generated.r[x] + } + + q[x] := y if { + z = {"a": 1, "b": 2, "d": 4} + z[x] = y + } + + r[k] := v if { + x = {"a": 1, "b": 2, "c": 4, "d": 3} + x[k] = v + } + data: {} + want_result: + - x: + - a + - b + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0662.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0662.yaml new file mode 100644 index 0000000000..1016fe709d --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0662.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: "virtualdocs/i/o: undefined keys" + query: data.generated.p = x + modules: + - | + package generated + + p contains y if { + data.generated.q[x] + data.generated.r[x] = y + } + + q contains x if { + z = ["a", "b", "c", "d"] + z[y] = x + } + + r[k] := v if { + x = {"a": 1, "b": 2, "d": 4} + x[k] = v + } + data: {} + want_result: + - x: + - 1 + - 2 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0663.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0663.yaml new file mode 100644 index 0000000000..ef159666e6 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0663.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "virtualdocs/input: complete array" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[1] = 2 + } + + q := [1, 2, 3, 4] + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0664.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0664.yaml new file mode 100644 index 0000000000..6c865b912a --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0664.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "virtualdocs/input: complete object" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q.b = 2 + } + + q := {"a": 1, "b": 2} + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0665.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0665.yaml new file mode 100644 index 0000000000..1c6a2d6252 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0665.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "virtualdocs/input: complete set" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[3] + } + + q := {1, 2, 3, 4} + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0666.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0666.yaml new file mode 100644 index 0000000000..f1c92d4647 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0666.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "virtualdocs/input: complete array dereference ground" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[1][1] = 3 + } + + q := [[0, 1], [2, 3]] + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0667.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0667.yaml new file mode 100644 index 0000000000..7d88784080 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0667.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "virtualdocs/input: complete object dereference ground" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q.b[1] = 4 + } + + q := {"a": [1, 2], "b": [3, 4]} + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0668.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0668.yaml new file mode 100644 index 0000000000..097d4b3b40 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0668.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: "virtualdocs/input: complete array ground index" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + z = [1, 2] + z[i] = y + data.generated.q[y] = x + } + + q := [1, 2, 3, 4] + data: {} + want_result: + - x: + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0669.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0669.yaml new file mode 100644 index 0000000000..cbaa385342 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0669.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: "virtualdocs/input: complete object ground key" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + z = ["b", "c"] + z[i] = y + data.generated.q[y] = x + } + + q := {"a": 1, "b": 2, "c": 3, "d": 4} + data: {} + want_result: + - x: + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0670.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0670.yaml new file mode 100644 index 0000000000..6bedaa0d81 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0670.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "virtualdocs/input: complete vars" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q[1][1] = 2 + } + + q := [{"x": x, "y": y}, z] if { + x = 1 + y = 2 + z = [1, 2, 3] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0671.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0671.yaml new file mode 100644 index 0000000000..715647e11b --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0671.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "virtualdocs/output: complete array" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[i] = e + x = [i, e] + } + + q := [1, 2, 3, 4] + data: {} + want_result: + - x: + - - 0 + - 1 + - - 1 + - 2 + - - 2 + - 3 + - - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0672.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0672.yaml new file mode 100644 index 0000000000..e3e1fe11ac --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0672.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "virtualdocs/output: complete object" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[i] = e + x = [i, e] + } + + q := {"a": 1, "b": 2} + data: {} + want_result: + - x: + - - a + - 1 + - - b + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0673.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0673.yaml new file mode 100644 index 0000000000..c21a3db483 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0673.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: "virtualdocs/output: complete set" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[x] + } + + q := {1, 2, 3, 4} + data: {} + want_result: + - x: + - 1 + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0674.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0674.yaml new file mode 100644 index 0000000000..50fa6311f0 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0674.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "virtualdocs/output: complete array dereference non-ground" + query: data.generated.p = x + modules: + - | + package generated + + p contains r if { + data.generated.q[i][j] = 2 + r = [i, j] + } + + q := [[1, 2], [3, 2]] + data: {} + want_result: + - x: + - - 0 + - 1 + - - 1 + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0675.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0675.yaml new file mode 100644 index 0000000000..1f005103ed --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0675.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: "virtualdocs/output: complete object defererence non-ground" + query: data.generated.p = x + modules: + - | + package generated + + p contains r if { + data.generated.q[x][y] = 2 + r = [x, y] + } + + q := {"a": {"x": 1}, "b": {"y": 2}, "c": {"z": 2}} + data: {} + want_result: + - x: + - - b + - "y" + - - c + - z + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0676.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0676.yaml new file mode 100644 index 0000000000..08a6aa10e0 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0676.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: "virtualdocs/output: complete vars" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[_][_] = x + } + + q := [{"x": x, "y": y}, z] if { + x = 1 + y = 2 + z = [1, 2, 3] + } + data: {} + want_result: + - x: + - 1 + - 2 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0677.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0677.yaml new file mode 100644 index 0000000000..3df4a0f731 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0677.yaml @@ -0,0 +1,16 @@ +--- +cases: + - note: "virtualdocs/no suffix: complete" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q + } + + q := true + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0678.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0678.yaml new file mode 100644 index 0000000000..ef82dea634 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0678.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "virtualdocs/no suffix: complete vars" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q + } + + q := x if { + x = true + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0679.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0679.yaml new file mode 100644 index 0000000000..a74a863ed9 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0679.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: "virtualdocs/no suffix: complete incr (error)" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q + } + + q := false + + q := true + data: {} + want_error_code: eval_conflict_error + want_error: complete rules must not produce multiple outputs diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0680.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0680.yaml new file mode 100644 index 0000000000..d1942b910e --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0680.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: "virtualdocs/no suffix: complete incr" + query: data.generated.p = x + modules: + - | + package generated + + p if { + not data.generated.q + } + + q if { + false + } + + q := false + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0681.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0681.yaml new file mode 100644 index 0000000000..0c93c61f6f --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0681.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: "virtualdocs/no suffix: object" + query: data.generated.p = x + modules: + - | + package generated + + p[x] := y if { + data.generated.q = o + o[x] = y + } + + q[x] := y if { + data.b[x] = y + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: + v1: hello + v2: goodbye diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0682.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0682.yaml new file mode 100644 index 0000000000..adf98bb6e7 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0682.yaml @@ -0,0 +1,34 @@ +--- +cases: + - note: "virtualdocs/no suffix: object incr" + query: data.generated.p = x + modules: + - | + package generated + + p[x] := y if { + data.generated.q = o + o[x] = y + } + + q[x] := y if { + data.b[x] = y + } + + q[x1] := y1 if { + data.d.e[y1] = x1 + } + data: + b: + v1: hello + v2: goodbye + d: + e: + - bar + - baz + want_result: + - x: + bar: 0 + baz: 1 + v1: hello + v2: goodbye diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0683.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0683.yaml new file mode 100644 index 0000000000..3ed4882fba --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0683.yaml @@ -0,0 +1,34 @@ +--- +cases: + - note: "virtualdocs/no suffix: chained" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q = x + x[i] = 4 + } + + q[k] := v if { + data.generated.r = x + x[k] = v + } + + r[k] := v if { + data.generated.s = x + x[k] = v + } + + r[k] := v if { + data.generated.t = x + x[v] = k + } + + s := {"a": 1, "b": 2, "c": 4} + + t := ["d", "e", "g"] + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0684.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0684.yaml new file mode 100644 index 0000000000..e497324154 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0684.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: "virtualdocs/no suffix: object var binding" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q = x + } + + q[k] := v if { + i = "a" + j = 1 + v = [i, j] + k = i + } + data: {} + want_result: + - x: + - a: + - a + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0685.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0685.yaml new file mode 100644 index 0000000000..bd62ac7dfd --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0685.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: "virtualdocs/no suffix: object composite value" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q = x + } + + q[k] := {"v": v} if { + i = "a" + j = 1 + v = [i, j] + k = i + } + data: {} + want_result: + - x: + - a: + v: + - a + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0686.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0686.yaml new file mode 100644 index 0000000000..648e1754b3 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0686.yaml @@ -0,0 +1,30 @@ +--- +cases: + - note: "virtualdocs/no suffix: bound ref with long prefix (#238)" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q + data.generated.q + } + + q := x if { + x = data.c[0].z.p + } + data: + c: + - "true": + - null + - 3.14159 + x: + - true + - false + - foo + z: + p: true + q: false + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0687.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0687.yaml new file mode 100644 index 0000000000..198f662edb --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0687.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: "virtualdocs/no suffix: object conflict (error)" + query: data.generated.p = x + modules: + - | + package generated + + p[x] := y if { + xs = ["a", "b", "c", "a"] + x = xs[i] + y = data.a[i] + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_error_code: eval_conflict_error + want_error: object keys must be unique diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0688.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0688.yaml new file mode 100644 index 0000000000..03b4a4b200 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0688.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: "virtualdocs/no suffix: set" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q = s + s[x] + } + + q contains x if { + data.a[i] = x + } + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: + - "1" + - "2" + - "3" + - "4" + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0689.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0689.yaml new file mode 100644 index 0000000000..5a1a6dced3 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0689.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: virtualdocs/empty partial set + query: data.generated.p = x + modules: + - | + package generated + + p contains 1 if { + data.a[0] = 100 + } + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: [] + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0690.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0690.yaml new file mode 100644 index 0000000000..eee3762aea --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0690.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: virtualdocs/empty partial object + query: data.generated.p = x + modules: + - | + package generated + + p["x"] := 1 if { + data.a[0] = 100 + } + data: + a: + - "1" + - "2" + - "3" + - "4" + want_result: + - x: {} diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0691.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0691.yaml new file mode 100644 index 0000000000..32d80f839c --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0691.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: "virtualdocs/input: non-ground object keys" + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + data.generated.q.a.b = x + } + + q := {x: {y: 1}} if { + x = "a" + y = "b" + } + data: {} + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0692.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0692.yaml new file mode 100644 index 0000000000..c9df3aea22 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0692.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: "virtualdocs/input: non-ground set elements" + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.generated.q.c + } + + q := {x, "b", z} if { + x = "a" + z = "c" + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0693.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0693.yaml new file mode 100644 index 0000000000..cf06cc10a3 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0693.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: "virtualdocs/output: non-ground object keys" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[i][j] = x + } + + q := {x: {x1: 1}, y: {y1: 2}} if { + x = "a" + y = "b" + x1 = "a1" + y1 = "b1" + } + data: {} + want_result: + - x: + - 1 + - 2 + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0694.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0694.yaml new file mode 100644 index 0000000000..0b0dfa41ff --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-0694.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: "virtualdocs/output: non-ground set elements" + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.generated.q[x] + } + + q := {x, "b", z} if { + x = "a" + z = "c" + } + data: {} + want_result: + - x: + - a + - b + - c + sort_bindings: true diff --git a/test/cases/testdata/v1/virtualdocs/test-virtualdocs-undefined.yaml b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-undefined.yaml new file mode 100644 index 0000000000..af96544a36 --- /dev/null +++ b/test/cases/testdata/v1/virtualdocs/test-virtualdocs-undefined.yaml @@ -0,0 +1,42 @@ +--- +cases: + - note: "virtualdocs/undefined: in array literal" + query: data.test.p = x + modules: + - | + package test + + p if { + [1, 2, input] + } else := false + want_result: + - x: false + - note: "virtualdocs/undefined: in set literal" + query: data.test.p = x + modules: + - | + package test + + p if { + {1, 2, input} + } else := false + want_result: + - x: false + - note: "virtualdocs/undefined: in set coprehension body" + query: data.test.p = x + modules: + - | + package test + + p := {1 | input} + want_result: + - x: [] + - note: "virtualdocs/undefined: in array coprehension body" + query: data.test.p = x + modules: + - | + package test + + p := [1 | input] + want_result: + - x: [] diff --git a/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0970.yaml b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0970.yaml new file mode 100644 index 0000000000..4f627e0d9c --- /dev/null +++ b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0970.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: walkbuiltin/scalar + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.a[0] + walk(__local0__, x) + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - - [] + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0971.yaml b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0971.yaml new file mode 100644 index 0000000000..65a11cd84d --- /dev/null +++ b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0971.yaml @@ -0,0 +1,34 @@ +--- +cases: + - note: walkbuiltin/arrays + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.a + walk(__local0__, x) + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - - [] + - - 1 + - 2 + - 3 + - 4 + - - - 0 + - 1 + - - - 1 + - 2 + - - - 2 + - 3 + - - - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0972.yaml b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0972.yaml new file mode 100644 index 0000000000..a8059a2b64 --- /dev/null +++ b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0972.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: walkbuiltin/objects + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.b + walk(__local0__, x) + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: + - - [] + - v1: hello + v2: goodbye + - - - v1 + - hello + - - - v2 + - goodbye + sort_bindings: true diff --git a/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0973.yaml b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0973.yaml new file mode 100644 index 0000000000..68d60271f5 --- /dev/null +++ b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0973.yaml @@ -0,0 +1,43 @@ +--- +cases: + - note: walkbuiltin/sets + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + __local0__ = data.generated.q + walk(__local0__, x) + } + + q := {{1, 2, 3}} + data: {} + want_result: + - x: + - - [] + - - - 1 + - 2 + - 3 + - - - - 1 + - 2 + - 3 + - - 1 + - 2 + - 3 + - - - - 1 + - 2 + - 3 + - 1 + - 1 + - - - - 1 + - 2 + - 3 + - 2 + - 2 + - - - - 1 + - 2 + - 3 + - 3 + - 3 + sort_bindings: true diff --git a/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0974.yaml b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0974.yaml new file mode 100644 index 0000000000..f171afb38f --- /dev/null +++ b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0974.yaml @@ -0,0 +1,30 @@ +--- +cases: + - note: walkbuiltin/match and filter + query: data.generated.p = x + modules: + - | + package generated + + p contains [k, x] if { + __local0__ = data.generated.q + walk(__local0__, [k, x]) + __local1__ = k[1] + contains(__local1__, "oo") + } + + q := [{ + "foo": 1, + "bar": 2, + "bazoo": 3, + }] + data: {} + want_result: + - x: + - - - 0 + - bazoo + - 3 + - - - 0 + - foo + - 1 + sort_bindings: true diff --git a/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0975.yaml b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0975.yaml new file mode 100644 index 0000000000..5079bc2ce9 --- /dev/null +++ b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-0975.yaml @@ -0,0 +1,33 @@ +--- +cases: + - note: walkbuiltin/partially ground path + query: data.generated.p = x + modules: + - | + package generated + + p contains [k1, k2, x] if { + __local0__ = data.generated.q + walk(__local0__, [["a", k1, "b", k2], x]) + } + + q := {"a": [ + {"b": {"foo": 1, "bar": 2}}, + {"b": {"baz": 3, "qux": 4}}, + ]} + data: {} + want_result: + - x: + - - 0 + - bar + - 2 + - - 0 + - foo + - 1 + - - 1 + - baz + - 3 + - - 1 + - qux + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-wildcard-path.yaml b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-wildcard-path.yaml new file mode 100644 index 0000000000..2e2e45238a --- /dev/null +++ b/test/cases/testdata/v1/walkbuiltin/test-walkbuiltin-wildcard-path.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: walkbuiltin/wildcard-path same values as when path provided + query: x = data.testing.same_values + modules: + - | + package testing + + obj := { + "bar": "baz", + "qux": [ + 1, + {"p": "rego", "q": "rules"}, + {1, 2, 3, {"a": "b", "c": {"d", "e", 1}}}, + ], + } + + with_path contains value if { + walk(obj, [path, value]) + } + + without_path contains value if { + walk(obj, [_, value]) + } + + same_values := with_path == without_path + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-with-and-ndbcache-issue.yaml b/test/cases/testdata/v1/withkeyword/test-with-and-ndbcache-issue.yaml new file mode 100644 index 0000000000..c407bd364c --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-with-and-ndbcache-issue.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: "with: ndb_cache-issue" + query: data.rules = x + modules: + - | + package rules + + p if { + time.now_ns(now) + } + + q if p with data.x as 7 + want_result: + - x: + p: true + q: true diff --git a/test/cases/testdata/v1/withkeyword/test-with-builtin-mock.yaml b/test/cases/testdata/v1/withkeyword/test-with-builtin-mock.yaml new file mode 100644 index 0000000000..54309a77be --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-with-builtin-mock.yaml @@ -0,0 +1,502 @@ +--- +cases: + - note: "withkeyword/builtin: direct call, arity 0" + query: data.test.p = x + modules: + - | + package test + + f := 1 + + p := y if { + y = time.now_ns() with time.now_ns as f + } + want_result: + - x: 1 + - note: "withkeyword/builtin: direct call, arity 1" + query: data.test.p = x + modules: + - | + package test + + f(_) := 1 + + p := y if { + y = count([1, 2, 3]) with count as f + } + want_result: + - x: 1 + - note: "withkeyword/builtin: indirect call, arity 1" + query: data.test.p = x + modules: + - | + package test + + f(_) := 1 + + p if { + q with count as f + } + + q if { + count([1, 2, 3]) == 1 + } + want_result: + - x: true + - note: "withkeyword/builtin: indirect call, arity 0" + query: data.test.p = x + modules: + - | + package test + + f := 1 + + p if { + q with time.now_ns as f + } + + q if { + time.now_ns() == 1 + } + want_result: + - x: true + - note: "withkeyword/builtin: indirect call, arity 0, rule queried with and without mock" + query: data.test.p = x + modules: + - | + package test + + f := 1 + + p if { + q with time.now_ns as f + not q + } + + q if { + time.now_ns() == 1 + } + want_result: + - x: true + - note: "withkeyword/builtin: indirect call, arity 0, query package" + query: data.test = x + modules: + - | + package test + + f := 1 + + p if { + q with time.now_ns as f + } + + q if { + time.now_ns() == 1 + } + want_result: + - x: + f: 1 + p: true + - note: "withkeyword/builtin: http.send example" + query: data.test.test_allow = x + modules: + - | + package test + + pass_resp := {"body": {"roles": ["admin"]}} + + deny_resp := {"body": {"roles": []}} + + mock_http_send(req) := pass_resp if { + req.body.name == "alice" + } else := deny_resp + + test_allow if { + allow with http.send as mock_http_send with input.name as "alice" + } + + allow if { + "admin" in http.send({"method": "GET", "body": input}).body.roles + } + want_result: + - x: true + - note: "withkeyword/builtin: nested, multiple mocks" + query: data.test.test_allow = x + modules: + - | + package test + + pass_resp := {"body": {"jwt": "myjot"}} + + deny_resp := {"body"} + + mock_http_send(req) := pass_resp if { + req.body.name == "alice" + } else := deny_resp + + mock_decode_verify("myjot", _) := [true, {}, {"owner": "alice"}] + + test_allow if { + allow with data.verification.cert as "cert" + with input.name as "alice" + with http.send as mock_http_send + with io.jwt.decode_verify as mock_decode_verify + } + + allow if { + payload.owner == input.name + } + + claims[k] := v if { + resp := http.send({"method": "GET", "body": input}).body + some k, v in resp + } + + payload := p if { + some p + [true, _, p] = io.jwt.decode_verify(claims.jwt, {"cert": data.verification.cert, "iss": "issuer"}) + } + want_result: + - x: true + - note: "withkeyword/builtin: indirect call through function" + query: data.test.p = x + modules: + - | + package test + + f := 1 + + p if { + q with time.now_ns as f + } + + q if { + valid_time(1) + } + + valid_time(x) if time.now_ns() == x + want_result: + - x: true + - note: "withkeyword/builtin: indirect call through function, rule with and without mock" + query: data.test.p = x + modules: + - | + package test + + f := 1 + + p if { + q with time.now_ns as f + not q + } + + q if { + valid_time(1) + } + + valid_time(x) if time.now_ns() == x + want_result: + - x: true + - note: "withkeyword/builtin: indirect call through function, query package" + query: data.test = x + modules: + - | + package test + + f := 1 + + p if { + q with time.now_ns as f + } + + q if { + valid_time(1) + } + + valid_time(x) if time.now_ns() == x + want_result: + - x: + f: 1 + p: true + - note: "withkeyword/builtin: mock function calls original" + query: data.test.p = x + modules: + - | + package test + + mock_count("one") := 1 + + mock_count(x) := count(x) if { + x != "one" + } + + numbers := {"one", "two", "tree"} + + p := s if { + s := {count(n) | some n in numbers} with count as mock_count + } + want_result: + - x: + - 1 + - 3 + - 4 + - note: "withkeyword/builtin: mock function returns same result for both rule defs" + query: data.test.p = x + modules: + - | + package test + + mock_concat("one", _) := ["one"] + + mock_concat("one", x) := x + + numbers := ["one", "one"] + + p := s if { + s := {concat(n, [n]) | some n in numbers} with concat as mock_concat + } + want_result: + - x: + - - one + - note: "withkeyword/builtin: nested, mock function calls original" + query: data.test.p = x + modules: + - | + package test + + mock_concat("one", _) := ["one"] + + mock_concat("one", x) := x + + count_four(4) := 4 + + count_four(x) := count(x) + + numbers := {"one", "two", "tree"} + + q := s if { + s := {concat(n, [n]) | some n in numbers} with concat as mock_concat + r + } + + r if { + count(input.four) == 4 + } + + p := y if { + y := q with concat as mock_concat + with count as count_four + with input.four as 4 + } + want_result: + - x: + - - one + - note: "withkeyword/builtin: multiple with" + query: data.test.p = x + modules: + - | + package test + + f(_) := 1 + + g(x) := count(x) # replaced with f by inner "with" + + q := y if { + y = count([1, 2, 3]) with count as f + } + + p := y if { + y = q with count as g + } + want_result: + - x: 1 + - note: "withkeyword/builtin: mock will not call other mock" + query: data.test.p = x + modules: + - | + package test + + f(x) := object.union_n(x) if {x: i | x := ["a", "a"][i]} # never called, runtime error + + g(x) := count(x) + + p if { + q with count as f + } + + q if { + r with object.union_n as g + } + + r if { + object.union_n([{}]) + } + want_result: + - x: true + - note: "withkeyword/builtin: nested scope handling" + query: data.test.p = x + modules: + - | + package test + + f(x) := object.union_n(x) # b1 + + g(x) := 123 if { + count(x) # b2 + s with array.reverse as h + } + + h(_) := ["replaced"] + + p if q with object.union_n as f + + q if r with count as g + + r if { + x := [{"foo": 4}, {"baz": 5}] + count(x) == 123 + object.union_n(x) == {"foo": 4, "baz": 5} + } + + s if { + x := [{}] + array.reverse(x) == ["replaced"] + } + want_result: + - x: true + - note: "withkeyword/builtin-value: arity-0, captured output" + query: data.test.p = x + modules: + - | + package test + + p := y if { + y = time.now_ns() with time.now_ns as 12300 + } + want_result: + - x: 12300 + - note: "withkeyword/builtin-value: arity-0, false" + query: data.test.p = x + modules: + - | + package test + + p if { + time.now_ns() with time.now_ns as false + } + want_result: [] + - note: "withkeyword/builtin-value: arity-0" + query: data.test.p = x + modules: + - | + package test + + p if { + time.now_ns() with time.now_ns as true + } + want_result: + - x: true + - note: "withkeyword/builtin-value: arity-0, var" + query: data.test.p = x + modules: + - | + package test + + p if { + x := true + time.now_ns() with time.now_ns as x + } + want_result: + - x: true + - note: "withkeyword/builtin-value: arity-1" + query: data.test.p = x + modules: + - | + package test + + p if { + count([]) == 1 with count as 1 + } + want_result: + - x: true + - note: "withkeyword/builtin-value: arity-1, captured" + query: data.test.p = x + modules: + - | + package test + + p if { + count([], 1) with count as 1 + } + want_result: + - x: true + - note: "withkeyword/builtin-value: arity-1, input must still be defined" + query: data.test.p = x + modules: + - | + package test + + p if { + count(input) == 1 with count as 1 + } + want_result: [] + - note: "withkeyword/builtin-builtin: arity 0" + query: data.test.p = x + modules: + - | + package test + + p := x if { + x = time.now_ns() with time.now_ns as opa.runtime + } + want_result: + - x: {} + - note: "withkeyword/builtin-builtin: arity 1, replacement is compound" + query: data.test.p = x + modules: + - | + package test + + p := x if { + x = count([{}, {"foo": 3}]) with count as object.union_n + } + want_result: + - x: + foo: 3 + - note: "withkeyword/builtin-builtin: arity 1, replacement is simple" + query: data.test.p = x + modules: + - | + package test + + p := x if { + x = object.union_n([{}, {"foo": 3}]) with object.union_n as count + } + want_result: + - x: 2 + - note: "withkeyword/builtin: direct call, arity 1, replacement is value that needs eval (array comprehension)" + query: data.test.p = x + modules: + - | + package test + + p if { + count([1, 2, 3]) == 1 with count as [1 | true][0] + } + want_result: + - x: true + - note: "withkeyword/builtin: indirect call, arity 1, replacement is value that needs eval (array comprehension)" + query: data.test.p = x + modules: + - | + package test + + p if { + q with count as [1 | true][0] + } + + q if { + count([1, 2, 3]) == 1 + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-with-function-mock.yaml b/test/cases/testdata/v1/withkeyword/test-with-function-mock.yaml new file mode 100644 index 0000000000..af46395b65 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-with-function-mock.yaml @@ -0,0 +1,164 @@ +--- +cases: + - note: "withkeyword/function: direct call, value replacement, arity 1" + query: data.test.p = x + modules: + - | + package test + + f(_) := 2 + + p := y if { + y = f(true) with f as 1 + } + want_result: + - x: 1 + - note: "withkeyword/function: direct call, function replacement, arity 1" + query: data.test.p = x + modules: + - | + package test + + f(_) := 2 + + g(_) := 1 + + p := y if { + y = f(true) with f as g + } + want_result: + - x: 1 + - note: "withkeyword/function: direct call, function replacement, arity 1, result captured" + query: data.test.p = x + modules: + - | + package test + + f(_) := 2 + + g(_) := 1 + + p if { + f(true, 1) with f as g + } + want_result: + - x: true + - note: "withkeyword/function: direct call, built-in replacement, arity 1" + query: data.test.p = x + modules: + - | + package test + + f(_) := 2 + + p := y if { + y = f([1]) with f as count + } + want_result: + - x: 1 + - note: "withkeyword/function: direct call, built-in replacement, arity 1, result captured" + query: data.test.p = x + modules: + - | + package test + + f(_) := 2 + + p if { + f([1], 1) with f as count + } + want_result: + - x: true + - note: "withkeyword/function: nested scope handling" + query: data.test.p = x + modules: + - | + package test + + f1(x) := object.union_n(x) + + f2(x) := count(x) + + f3(x) := array.reverse(x) + + f(x) := f1(x) + + g(x) := 123 if { + f2(x) + s with f3 as h + } + + h(_) := ["replaced"] + + p if q with f1 as f + + q if r with f2 as g + + r if { + x := [{"foo": 4}, {"baz": 5}] + f2(x) == 123 + f1(x) == {"foo": 4, "baz": 5} + } + + s if { + x := [{}] + f3(x) == ["replaced"] + } + want_result: + - x: true + - note: "withkeyword/function: simple scope handling (no recursion here)" + query: data.test.p = x + modules: + - | + package test + + f(x) := 2 + + g(x) := f(x) + + p := y if y := f(1) with f as g + want_result: + - x: 2 + - note: "withkeyword/function: rule indexing irrelevant" + query: data.test.p = x + modules: + - | + package test + + f(_) := 1 if { + input.x = "x" + } + + p := y if y := f(1) with f as 2 + want_result: + - x: 2 + - note: "withkeyword/function: direct call, arity 1, replacement is value that needs eval (array comprehension)" + query: data.test.p = x + modules: + - | + package test + + f(_) := 1 + + p if { + f([1, 2, 3]) == 1 with f as [1 | true][0] + } + want_result: + - x: true + - note: "withkeyword/function: indirect call, arity 1, replacement is value that needs eval (array comprehension)" + query: data.test.p = x + modules: + - | + package test + + f(_) := 1 + + p if { + q with f as [1 | true][0] + } + + q if { + f([1, 2, 3]) == 1 + } + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-with-function-mocks-issue-5299.yaml b/test/cases/testdata/v1/withkeyword/test-with-function-mocks-issue-5299.yaml new file mode 100644 index 0000000000..dc73f64e28 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-with-function-mocks-issue-5299.yaml @@ -0,0 +1,73 @@ +--- +cases: + - note: "withkeyword/function: direct call, rule replacement" + query: data.test.p = x + modules: + - | + package test + + f(_) := 2 + + f0 := 1 # a rule + + p := y if { + y = f(true) with f as f0 + } + want_result: + - x: 1 + - note: "withkeyword/function: captured result, rule replacement" + query: data.test.p = x + modules: + - | + package test + + f(_) := 2 + + f0 := 1 # a rule + + p if { + f(true, 1) with f as f0 + } + want_result: + - x: true + - note: "withkeyword/builtin: direct call, arity 0, rule replacement" + query: data.test.p = x + modules: + - | + package test + + f := 1 # a rule + + p := y if { + y = time.now_ns() with time.now_ns as f + } + want_result: + - x: 1 + - note: "withkeyword/builtin: direct call, arity 1, rule replacement" + query: data.test.p = x + modules: + - | + package test + + f := 1 # a rule + + p := y if { + y = count([1, 2, 3]) with count as f + } + want_result: + - x: 1 + - note: "withkeyword/builtin: indirect call, arity 1, rule replacement" + query: data.test.p = x + modules: + - | + package test + + f := 1 # a rule + + g(x) := count(x) + + p := y if { + y = g([1, 2, 3]) with count as f + } + want_result: + - x: 1 diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1015.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1015.yaml new file mode 100644 index 0000000000..9d3d268195 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1015.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: withkeyword/with + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.ex.loopback with input as true + data.ex.loopback = false with input as false + } + - | + package ex + + loopback := __local0__ if { + true + __local0__ = input + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1016.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1016.yaml new file mode 100644 index 0000000000..4f51353059 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1016.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: withkeyword/with not + query: data.generated.p = x + modules: + - | + package generated + + p if { + not data.ex.loopback with input as false + data.ex.loopback with input as true + } + - | + package ex + + loopback := __local0__ if { + true + __local0__ = input + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1017.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1017.yaml new file mode 100644 index 0000000000..8493951be1 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1017.yaml @@ -0,0 +1,24 @@ +--- +cases: + - note: withkeyword/with composite + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.ex.composite[x] with input.foo as [1, 2, 3, 4] + } + - | + package ex + + composite contains x if { + input.foo[_] = x + x > 2 + } + data: {} + want_result: + - x: + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1018.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1018.yaml new file mode 100644 index 0000000000..8457528a13 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1018.yaml @@ -0,0 +1,26 @@ +--- +cases: + - note: withkeyword/with vars + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + foo = "hello" + bar = "world" + x = data.ex.vars with input.foo as foo with input.bar as bar + } + - | + package ex + + vars := x if { + y = input.bar + z = input.foo + x = {"bar": y, "foo": z} + } + data: {} + want_result: + - x: + bar: world + foo: hello diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1019.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1019.yaml new file mode 100644 index 0000000000..5c62c269c8 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1019.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: withkeyword/with conflict + query: data.generated.p = x + modules: + - | + package generated + + p := x if { + x := data.ex.loopback with input.foo as "x" with input.foo.bar as "y" + } + - | + package ex + + loopback := y if { + true + y = input + } + want_result: + - x: + foo: + bar: "y" diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1020.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1020.yaml new file mode 100644 index 0000000000..ab7ddd9d21 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1020.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: withkeyword/with stack + query: data.generated.p = x + modules: + - | + package generated + + r := __local0__ if { + true + __local0__ = input + } + + q := x if { + data.generated.r = x with input.a.c as 2 + } + + p := x if { + data.generated.q = x with input.a.b as 1 + } + data: {} + input_term: '{"a": {"d": 3}, "e": 4}' + want_result: + - x: + a: + b: 1 + c: 2 + d: 3 + e: 4 diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1021.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1021.yaml new file mode 100644 index 0000000000..a87210c612 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1021.yaml @@ -0,0 +1,30 @@ +--- +cases: + - note: withkeyword/with not stack + query: data.generated.p = x + modules: + - | + package generated + + r := __local0__ if { + true + __local0__ = input + } + + q := x if { + not false with input as {} + data.generated.r = x with input.a.c as 2 + } + + p := x if { + data.generated.q = x with input.a.b as 1 + } + data: {} + input_term: '{"a": {"d": 3}, "e": 4}' + want_result: + - x: + a: + b: 1 + c: 2 + d: 3 + e: 4 diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1022.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1022.yaml new file mode 100644 index 0000000000..b508d8ca9d --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1022.yaml @@ -0,0 +1,36 @@ +--- +cases: + - note: withkeyword/with stack (data) + query: data.generated.p = x + modules: + - | + package generated + + r := __local0__ if { + true + __local0__ = data.test + } + + q := x if { + data.generated.r = x with data.test.a.c as 2 + } + + p := x if { + data.generated.q = x with data.test.a.b as 1 + } + - | + package test.a + + d := 3 + - | + package test + + e := 4 + data: {} + want_result: + - x: + a: + b: 1 + c: 2 + d: 3 + e: 4 diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1023.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1023.yaml new file mode 100644 index 0000000000..bcf2cc632b --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1023.yaml @@ -0,0 +1,45 @@ +--- +cases: + - note: withkeyword/with not stack (data) + query: data.generated.p = x + modules: + - | + package test.a + + d := 3 + - | + package test + + e := 4 + - | + package generated + + r := __local0__ if { + true + __local0__ = data.test + } + + n1 if { + data.test.a.z = 7 + } + + n if { + not data.generated.n1 + } + + q := x if { + not data.generated.n with data.test.a.z as 7 + data.generated.r = x with data.test.a.c as 2 + } + + p := x if { + data.generated.q = x with data.test.a.b as 1 + } + data: {} + want_result: + - x: + a: + b: 1 + c: 2 + d: 3 + e: 4 diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1024.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1024.yaml new file mode 100644 index 0000000000..acea151ea2 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1024.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: withkeyword/with stack overwrites + query: data.generated.p = x + modules: + - | + package generated + + q := __local0__ if { + true + __local0__ = input + } + + p := x if { + data.generated.q = x with input.a as {"d": 3} + } + data: {} + input_term: '{"a": {"b": 1, "c": 2}}' + want_result: + - x: + a: + d: 3 diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1025.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1025.yaml new file mode 100644 index 0000000000..74c323d62e --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1025.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: withkeyword/with stack overwrites (data) + query: data.generated.p = x + modules: + - | + package generated + + q := __local0__ if { + true + __local0__ = data.test + } + + p := x if { + data.generated.q = x with data.test.a as {"d": 3} + } + - | + package test + + a := {"b": 1, "c": 2} + data: {} + want_result: + - x: + a: + d: 3 diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1026.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1026.yaml new file mode 100644 index 0000000000..5d0ff2a9ce --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1026.yaml @@ -0,0 +1,30 @@ +--- +cases: + - note: withkeyword/with invalidate + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.a[_] = x + not data.ex.input_eq with input.x as x + } + - | + package ex + + input_eq if { + input.x = 1 + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: + - 2 + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1027.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1027.yaml new file mode 100644 index 0000000000..71e76f68f6 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1027.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: withkeyword/with invalidate input stack + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y] if { + x = input with input as "a" + y = input + } + data: {} + input_term: '"b"' + want_result: + - x: + - a + - b diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1028.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1028.yaml new file mode 100644 index 0000000000..df5c48721a --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1028.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: withkeyword/with invalidate input stack iteration + query: data.generated.p = x + modules: + - | + package generated + + q contains x if { + input[_] = x + } + + p contains [x, y] if { + data.generated.q[x] with input as ["a", "b"] + y = input + } + data: {} + input_term: '"c"' + want_result: + - x: + - - a + - c + - - b + - c + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1029.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1029.yaml new file mode 100644 index 0000000000..5d867567fd --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1029.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: withkeyword/with invalidate virtual cache + query: data.generated.p = x + modules: + - | + package generated + + q := "a" if { + input = x + x = 1 + } + + q := "b" if { + input = x + x = 2 + } + + p := [x, y] if { + data.generated.q = x with input as 1 + data.generated.q = y + } + data: {} + input_term: "2" + want_result: + - x: + - a + - b diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1030.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1030.yaml new file mode 100644 index 0000000000..851d3119c6 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1030.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: withkeyword/with invalidate data stack + query: data.generated.p = x + modules: + - | + package generated + + q := "b" + + p := [x, y] if { + data.generated.q = x with data.generated.q as "a" + data.generated.q = y + } + data: {} + want_result: + - x: + - a + - b diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1031.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1031.yaml new file mode 100644 index 0000000000..f9023ed8b6 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1031.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: withkeyword/with invalidate data stack iteration + query: data.generated.p = x + modules: + - | + package generated + + q contains "c" + + p contains [x, y] if { + data.generated.q[x] with data.generated.q as {"a", "b"} + y = data.generated.q + } + data: {} + want_result: + - x: + - - a + - - c + - - b + - - c + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1032.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1032.yaml new file mode 100644 index 0000000000..f0b78a7431 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1032.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: withkeyword/with basic data + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.ex.allow_basic = true with data.a as "testdata" + } + - | + package ex + + allow_basic if { + data.a = "testdata" + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1033.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1033.yaml new file mode 100644 index 0000000000..3952f289a7 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1033.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: withkeyword/with map data overwrite + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.ex.allow_merge_1 = true with data.b.v2 as "world" + } + - | + package ex + + allow_merge_1 if { + data.b = {"v1": "hello", "v2": "world"} + } + data: + b: + v1: hello + v2: goodbye + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1034.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1034.yaml new file mode 100644 index 0000000000..7daf1ef9f1 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1034.yaml @@ -0,0 +1,28 @@ +--- +cases: + - note: withkeyword/with map data new key + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.ex.allow_merge_2 = true with data.b.v2 as "world" with data.b.v3 as "again" + } + - | + package ex + + allow_merge_2 if { + data.b = {"v1": "hello", "v2": "world", "v3": "again"} + } + data: + a: + - 1 + - 2 + - 3 + - 4 + b: + v1: hello + v2: goodbye + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1035.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1035.yaml new file mode 100644 index 0000000000..c25980cc66 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1035.yaml @@ -0,0 +1,22 @@ +--- +cases: + - note: withkeyword/with data conflict + query: data.generated.p = x + modules: + - | + package generated + + default p := false + + p if { + data.ex.allow_basic = true with data.a.b as 5 + } + - | + package ex + + allow_basic if { + data.a = "testdata" + } + data: {} + want_result: + - x: false diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1036.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1036.yaml new file mode 100644 index 0000000000..d044986877 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1036.yaml @@ -0,0 +1,17 @@ +--- +cases: + - note: withkeyword/with base doc exact value + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.a.b[x] = 1 with data.a.b as {"c": 1, "d": 2, "e": 1} + } + data: {} + want_result: + - x: + - c + - e + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1037.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1037.yaml new file mode 100644 index 0000000000..99495f4d1b --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1037.yaml @@ -0,0 +1,18 @@ +--- +cases: + - note: withkeyword/with base doc any index + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.a.b[x] with data.a.b as {"c": 1, "d": 2, "e": 1} + } + data: {} + want_result: + - x: + - c + - d + - e + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1038.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1038.yaml new file mode 100644 index 0000000000..8f02e9344d --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1038.yaml @@ -0,0 +1,13 @@ +--- +cases: + - note: withkeyword/undefined_1 + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.a.b.c with data.a.b as 1 + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1039.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1039.yaml new file mode 100644 index 0000000000..cb8110bf39 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1039.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: withkeyword/undefined_2 + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.l.a with data.l as 1 + } + data: + l: + - a: bob + b: -1 + c: + - 1 + - 2 + - 3 + - 4 + - a: alice + b: 1 + c: + - 2 + - 3 + - 4 + - 5 + d: null + want_result: [] diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1040.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1040.yaml new file mode 100644 index 0000000000..7769d894db --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1040.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: withkeyword/with virtual doc exact value + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.ex.virtual = x with data.a.b as {"c": 1, "d": 2, "e": 1} + } + - | + package ex + + virtual contains x if { + data.a.b[x] = 1 + } + data: {} + want_result: + - x: + - - c + - e + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1041.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1041.yaml new file mode 100644 index 0000000000..804c3b178f --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1041.yaml @@ -0,0 +1,23 @@ +--- +cases: + - note: withkeyword/with virtual doc any index + query: data.generated.p = x + modules: + - | + package generated + + p contains x if { + data.ex.virtual[x] with data.a.b as {"c": 1, "d": 2, "e": 1} + } + - | + package ex + + virtual contains x if { + data.a.b[x] = 1 + } + data: {} + want_result: + - x: + - c + - e + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1042.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1042.yaml new file mode 100644 index 0000000000..89c7eab772 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1042.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: withkeyword/with virtual doc specific index + query: data.generated.p = x + modules: + - | + package generated + + p := y if { + y = data.ex.virtual.c with data.a.b as {"c": 1, "d": 2, "e": 1} + } + - | + package ex + + virtual contains x if { + data.a.b[x] = 1 + } + data: {} + want_result: + - x: c diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1043.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1043.yaml new file mode 100644 index 0000000000..4c8ac91790 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1043.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: withkeyword/with virtual doc not specific index + query: data.generated.p = x + modules: + - | + package generated + + p if { + not data.ex.virtual.d with data.a.b as {"c": 1, "d": 2, "e": 1} + } + - | + package ex + + virtual contains x if { + data.a.b[x] = 1 + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1044.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1044.yaml new file mode 100644 index 0000000000..6067dd64b9 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1044.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: withkeyword/with mock var + query: data.generated.p = x + modules: + - | + package generated + + p := y if { + y = data.ex.mock_var with data.ex.mock_var as {"c": 1, "d": 2} + } + - | + package ex + + mock_var := {"a": 0, "b": 0} + data: {} + want_result: + - x: + c: 1 + d: 2 diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1045.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1045.yaml new file mode 100644 index 0000000000..1853af891a --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1045.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: withkeyword/with mock rule + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.ex.mock_rule with data.ex.mock_rule as true + } + - | + package ex + + mock_rule := false if { + 1 = 2 + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1046.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1046.yaml new file mode 100644 index 0000000000..be9446cd6c --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1046.yaml @@ -0,0 +1,39 @@ +--- +cases: + - note: withkeyword/with rule chain + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.ex.allow with data.label.b.c as [1, 2, 3] + } + - | + package ex + + allow1 if { + data.label.b.c = [1, 2, 3] + } + + allow2 if { + data.label.b.c[x] = 2 + } + + allow3 if { + data.label.b[x] = 1 + } + + allow4 if { + data.label.b.c.d[x] = 1 + } + + allow if { + data.ex.allow1 + data.ex.allow2 + not data.ex.allow3 + not data.ex.allow4 + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1047.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1047.yaml new file mode 100644 index 0000000000..3215271bfd --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1047.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: withkeyword/with mock iteration on sets + query: data.generated.p = x + modules: + - | + package generated + + q contains 1 + + q contains 2 + + p contains x if { + data.generated.q[x] with data.generated.q as {3, 4} + } + data: {} + want_result: + - x: + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1048.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1048.yaml new file mode 100644 index 0000000000..3bec30d0c9 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1048.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: withkeyword/with mock iteration on objects + query: data.generated.p = x + modules: + - | + package generated + + q["a"] := 1 + + q["b"] := 2 + + p[x] := y if { + data.generated.q[x] = y with data.generated.q as {"a": 3, "c": 4} + } + data: {} + want_result: + - x: + a: 3 + c: 4 diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1049.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1049.yaml new file mode 100644 index 0000000000..39c68bd2e6 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1049.yaml @@ -0,0 +1,21 @@ +--- +cases: + - note: withkeyword/with mock iteration on arrays + query: data.generated.p = x + modules: + - | + package generated + + q contains 1 + + q contains 2 + + p contains x if { + data.generated.q[_] = x with data.generated.q as [3, 4] + } + data: {} + want_result: + - x: + - 3 + - 4 + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1050.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1050.yaml new file mode 100644 index 0000000000..c97e766aba --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1050.yaml @@ -0,0 +1,19 @@ +--- +cases: + - note: withkeyword/bug 1083 + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.ex.input_eq with data.foo as 1 + } + - | + package ex + + input_eq if { + input.x = 1 + } + data: {} + want_result: [] diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1051.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1051.yaml new file mode 100644 index 0000000000..3a600aec38 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1051.yaml @@ -0,0 +1,25 @@ +--- +cases: + - note: withkeyword/bug 1100 + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.ex.data_eq with input as {} + } + - | + package ex + + data_eq if { + data.a = x + } + data: + a: + - 1 + - 2 + - 3 + - 4 + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1052.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1052.yaml new file mode 100644 index 0000000000..12203814d8 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1052.yaml @@ -0,0 +1,20 @@ +--- +cases: + - note: withkeyword/set lookup + query: data.generated.p = x + modules: + - | + package generated + + p if { + data.ex.setl[1] with data.foo as {1} + } + - | + package ex + + setl contains x if { + data.foo[x] + } + data: {} + want_result: + - x: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1053.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1053.yaml new file mode 100644 index 0000000000..8df0dd0d01 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1053.yaml @@ -0,0 +1,29 @@ +--- +cases: + - note: withkeyword/invalidate comprehension cache + query: data.generated.p = x + modules: + - | + package generated + + p := [x, y] if { + x = data.ex.s with input as {"a": "b", "c": "b"} + y = data.ex.s with input as {"a": "b"} + } + - | + package ex + + s contains x if { + x = {v: ks | + v = input[i] + ks = {k | v = input[k]} + } + } + want_result: + - x: + - - b: + - a + - - b: + - a + - c + sort_bindings: true diff --git a/test/cases/testdata/v1/withkeyword/test-withkeyword-1054.yaml b/test/cases/testdata/v1/withkeyword/test-withkeyword-1054.yaml new file mode 100644 index 0000000000..98d115fe51 --- /dev/null +++ b/test/cases/testdata/v1/withkeyword/test-withkeyword-1054.yaml @@ -0,0 +1,72 @@ +--- +cases: + - note: withkeyword/rewrite declared variables in with value + query: data.test.allow = x + modules: + - | + package test + + allow if { + a := {"x": 0} + + input.x == 0 with input as a + } + want_result: + - x: true + - note: withkeyword/rewrite declared variables nested in function call in with value + query: data.test.allow = x + modules: + - | + package test + + allow if { + a := {"x": 0} + + input.x == 1 with input as object.union(a, {"x": 1}) + input.x == -1 with input as object.union(a, {"x": -1}) + + input.x == 2 with input as object.union(a, object.union(a, {"x": 2})) + input.x == -2 with input as object.union(a, object.union(a, {"x": -2})) + } + want_result: + - x: true + - note: withkeyword/rewrite declared variables nested in array in with value + query: data.test.allow = x + modules: + - | + package test + + allow if { + a := 1 + input[0] == 1 with input as [a] + input[0][0] == 1 with input as [[a]] + } + want_result: + - x: true + - note: withkeyword/rewrite declared variables nested in object in with value + query: data.test.allow = x + modules: + - | + package test + + allow if { + a := 1 + input.a == 1 with input as {"a": a} + input.nested.a == 1 with input as {"nested": {"a": a}} + } + want_result: + - x: true + - note: withkeyword/rewrite declared variables nested in function/array/object in with value + query: data.test.allow = x + modules: + - | + package test + + allow if { + a := 1 + b := 2 + + input.min == 1 with input as object.union({"min": 0}, {"min": min([a, b])}) + } + want_result: + - x: true diff --git a/topdown/exported_test.go b/topdown/exported_test.go index 82b6f52576..b676d9413b 100644 --- a/topdown/exported_test.go +++ b/topdown/exported_test.go @@ -20,9 +20,14 @@ import ( ) func TestRego(t *testing.T) { - for _, tc := range cases.MustLoad("../test/cases/testdata").Sorted().Cases { - t.Run(tc.Note, func(t *testing.T) { - testRun(t, tc) + for _, tc := range cases.MustLoad("../test/cases/testdata/v0").Sorted().Cases { + t.Run(fmt.Sprintf("v0/%s", tc.Note), func(t *testing.T) { + testRun(t, tc, ast.RegoV0) + }) + } + for _, tc := range cases.MustLoad("../test/cases/testdata/v1").Sorted().Cases { + t.Run(fmt.Sprintf("v1/%s", tc.Note), func(t *testing.T) { + testRun(t, tc, ast.RegoV1) }) } } @@ -30,15 +35,22 @@ func TestRego(t *testing.T) { func TestOPARego(t *testing.T) { for _, tc := range cases.MustLoad("testdata/cases").Sorted().Cases { t.Run(tc.Note, func(t *testing.T) { - testRun(t, tc) + testRun(t, tc, ast.RegoV0) }) } } func TestRegoWithNDBCache(t *testing.T) { - for _, tc := range cases.MustLoad("../test/cases/testdata").Sorted().Cases { - t.Run(tc.Note, func(t *testing.T) { - testRun(t, tc, func(q *Query) *Query { + for _, tc := range cases.MustLoad("../test/cases/testdata/v0").Sorted().Cases { + t.Run(fmt.Sprintf("v0/%s", tc.Note), func(t *testing.T) { + testRun(t, tc, ast.RegoV0, func(q *Query) *Query { + return q.WithNDBuiltinCache(builtins.NDBCache{}) + }) + }) + } + for _, tc := range cases.MustLoad("../test/cases/testdata/v1").Sorted().Cases { + t.Run(fmt.Sprintf("v1/%s", tc.Note), func(t *testing.T) { + testRun(t, tc, ast.RegoV1, func(q *Query) *Query { return q.WithNDBuiltinCache(builtins.NDBCache{}) }) }) @@ -47,7 +59,7 @@ func TestRegoWithNDBCache(t *testing.T) { type opt func(*Query) *Query -func testRun(t *testing.T, tc cases.TestCase, opts ...opt) { +func testRun(t *testing.T, tc cases.TestCase, regoVersion ast.RegoVersion, opts ...opt) { for k, v := range tc.Env { t.Setenv(k, v) @@ -60,7 +72,11 @@ func testRun(t *testing.T, tc cases.TestCase, opts ...opt) { modules[fmt.Sprintf("test-%d.rego", i)] = module } - compiler := ast.MustCompileModules(modules) + compiler := ast.MustCompileModulesWithOpts(modules, ast.CompileOpts{ + ParserOptions: ast.ParserOptions{ + RegoVersion: regoVersion, + }, + }) query, err := compiler.QueryCompiler().Compile(ast.MustParseBody(tc.Query)) if err != nil {