From f436376c61f96e2862a5208515aef5565f3817ca Mon Sep 17 00:00:00 2001 From: Tony Worm Date: Sat, 16 Oct 2021 15:27:17 -0400 Subject: [PATCH] move cue tests Signed-off-by: Tony Worm --- test/cli/testdata/pick_006.txt | 29 ++++++++++++++++++++++ {structural/tests => test/cue}/count.cue | 0 {structural/tests => test/cue}/depth.cue | 0 {structural/tests => test/cue}/diff.cue | 0 {structural/tests => test/cue}/mask.cue | 0 {structural/tests => test/cue}/patch.cue | 0 {structural/tests => test/cue}/pick.cue | 26 ++++++++++++++++++- {structural/tests => test/cue}/replace.cue | 0 {structural/tests => test/cue}/upsert.cue | 0 test/pick.cue | 7 ++++++ test/tree.json | 14 +++++++++++ 11 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 test/cli/testdata/pick_006.txt rename {structural/tests => test/cue}/count.cue (100%) rename {structural/tests => test/cue}/depth.cue (100%) rename {structural/tests => test/cue}/diff.cue (100%) rename {structural/tests => test/cue}/mask.cue (100%) rename {structural/tests => test/cue}/patch.cue (100%) rename {structural/tests => test/cue}/pick.cue (62%) rename {structural/tests => test/cue}/replace.cue (100%) rename {structural/tests => test/cue}/upsert.cue (100%) create mode 100644 test/pick.cue create mode 100644 test/tree.json diff --git a/test/cli/testdata/pick_006.txt b/test/cli/testdata/pick_006.txt new file mode 100644 index 0000000..28b21fe --- /dev/null +++ b/test/cli/testdata/pick_006.txt @@ -0,0 +1,29 @@ +exec cuetils pick pick.cue tree.json +cmp stdout golden.stdout + +-- pick.cue -- +{ + tree: { + cow: string + } +} +-- tree.json -- +{ + "tree": { + "a": { + "foo": "bar", + "a": { + "b": { + "c": "d" + } + } + }, + "cow": "moo" + } +} +-- golden.stdout -- +{ + tree: { + cow: "moo" + } +} diff --git a/structural/tests/count.cue b/test/cue/count.cue similarity index 100% rename from structural/tests/count.cue rename to test/cue/count.cue diff --git a/structural/tests/depth.cue b/test/cue/depth.cue similarity index 100% rename from structural/tests/depth.cue rename to test/cue/depth.cue diff --git a/structural/tests/diff.cue b/test/cue/diff.cue similarity index 100% rename from structural/tests/diff.cue rename to test/cue/diff.cue diff --git a/structural/tests/mask.cue b/test/cue/mask.cue similarity index 100% rename from structural/tests/mask.cue rename to test/cue/mask.cue diff --git a/structural/tests/patch.cue b/test/cue/patch.cue similarity index 100% rename from structural/tests/patch.cue rename to test/cue/patch.cue diff --git a/structural/tests/pick.cue b/test/cue/pick.cue similarity index 62% rename from structural/tests/pick.cue rename to test/cue/pick.cue index dca59f8..125e9a1 100644 --- a/structural/tests/pick.cue +++ b/test/cue/pick.cue @@ -34,6 +34,30 @@ pick_tests: [ } } same: #real & #pick - } + }, + { + x: { + c: { + a: "a" + b: "b" + c: { + a: "a" + b: "b" + } + } + } + p: { + c: { + a: _ + } + } + #pick: (st.#Pick & { #X: x, #P: p }).pick + #real: { + c: { + a: "a" + } + } + same: #real & #pick + }, ] diff --git a/structural/tests/replace.cue b/test/cue/replace.cue similarity index 100% rename from structural/tests/replace.cue rename to test/cue/replace.cue diff --git a/structural/tests/upsert.cue b/test/cue/upsert.cue similarity index 100% rename from structural/tests/upsert.cue rename to test/cue/upsert.cue diff --git a/test/pick.cue b/test/pick.cue new file mode 100644 index 0000000..0be176e --- /dev/null +++ b/test/pick.cue @@ -0,0 +1,7 @@ +{ + tree: { + a: { + a: _ + } + } +} diff --git a/test/tree.json b/test/tree.json new file mode 100644 index 0000000..ab81426 --- /dev/null +++ b/test/tree.json @@ -0,0 +1,14 @@ +{ + "tree": { + "a": { + "foo": "bar", + "a": { + "b": { + "c": "d" + } + } + }, + "cow": "moo" + } +} +