Skip to content

Commit

Permalink
encoding/jsonschema: add docs about test file conventions
Browse files Browse the repository at this point in the history
This makes it clearer how to write jsonschema test cases.
It was intended to be part of https://cuelang.org/cl/1199743
but was accidentally omitted from that CL.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I2e5f92526ace4949551b0976cdf9c3d9313e0502
Dispatch-Trailer: {"type":"trybot","CL":1200066,"patchset":2,"ref":"refs/changes/66/1200066/2","targetBranch":"master"}
  • Loading branch information
rogpeppe authored and cueckoo committed Aug 27, 2024
1 parent 9f620c2 commit 19e9dae
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions encoding/jsonschema/decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ import (
// JSON schema to CUE and compares it against the output.
//
// Set CUE_UPDATE=1 to update test files with the corresponding output.
//
// Each test extracts the JSON Schema from a schema file (either
// schema.json or schema.yaml) and writes the result to
// out/decode/extract.
//
// If there are any files in the "test" directory in the txtar, each one
// is extracted and validated against the extracted schema. If the file
// name starts with "err-" it is expected to fail, otherwise it is
// expected to succeed.
//
// The #noverify tag in the txtar header causes verification and
// instance tests to be skipped.
//
// The #openapi tag in the txtar header enables OpenAPI extraction mode.
func TestDecode(t *testing.T) {
test := cuetxtar.TxTarTest{
Root: "./testdata",
Expand Down

0 comments on commit 19e9dae

Please sign in to comment.