From a2652d3853f226e265cf516be6f0564af73d4ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20B=C3=BClte?= Date: Tue, 1 Feb 2022 17:00:22 +0100 Subject: [PATCH] Add test for moving a field to its own subfield https://github.com/metafacture/metafacture-fix/issues/104 --- data/testing/moveToNewOwnSubfield/animalsStrings.json | 3 +++ data/testing/moveToNewOwnSubfield/expected_string.json | 5 +++++ .../moveToNewOwnSubfield/moveToNewOwnSubfield.fix | 1 + .../moveToNewOwnSubfield/moveToNewOwnSubfield.flux | 10 ++++++++++ data/testing/moveToNewOwnSubfield/result_string.json | 0 5 files changed, 19 insertions(+) create mode 100644 data/testing/moveToNewOwnSubfield/animalsStrings.json create mode 100644 data/testing/moveToNewOwnSubfield/expected_string.json create mode 100644 data/testing/moveToNewOwnSubfield/moveToNewOwnSubfield.fix create mode 100644 data/testing/moveToNewOwnSubfield/moveToNewOwnSubfield.flux create mode 100644 data/testing/moveToNewOwnSubfield/result_string.json diff --git a/data/testing/moveToNewOwnSubfield/animalsStrings.json b/data/testing/moveToNewOwnSubfield/animalsStrings.json new file mode 100644 index 0000000..0d2d2be --- /dev/null +++ b/data/testing/moveToNewOwnSubfield/animalsStrings.json @@ -0,0 +1,3 @@ +{ + "fictional": "unicorn" +} \ No newline at end of file diff --git a/data/testing/moveToNewOwnSubfield/expected_string.json b/data/testing/moveToNewOwnSubfield/expected_string.json new file mode 100644 index 0000000..152a5e8 --- /dev/null +++ b/data/testing/moveToNewOwnSubfield/expected_string.json @@ -0,0 +1,5 @@ +{ + "fictional": { + "animal": "unicorn" + } +} \ No newline at end of file diff --git a/data/testing/moveToNewOwnSubfield/moveToNewOwnSubfield.fix b/data/testing/moveToNewOwnSubfield/moveToNewOwnSubfield.fix new file mode 100644 index 0000000..b896366 --- /dev/null +++ b/data/testing/moveToNewOwnSubfield/moveToNewOwnSubfield.fix @@ -0,0 +1 @@ +move_field("fictional", "fictional.animal") \ No newline at end of file diff --git a/data/testing/moveToNewOwnSubfield/moveToNewOwnSubfield.flux b/data/testing/moveToNewOwnSubfield/moveToNewOwnSubfield.flux new file mode 100644 index 0000000..28c5a63 --- /dev/null +++ b/data/testing/moveToNewOwnSubfield/moveToNewOwnSubfield.flux @@ -0,0 +1,10 @@ +infile = FLUX_DIR + "animalsStrings.json"; + +infile +| open-file +| as-records +| decode-json +| fix(FLUX_DIR + "moveToNewOwnSubfield.fix") +| encode-json(prettyPrinting="true") +| write(FLUX_DIR + "result_string.json") +; \ No newline at end of file diff --git a/data/testing/moveToNewOwnSubfield/result_string.json b/data/testing/moveToNewOwnSubfield/result_string.json new file mode 100644 index 0000000..e69de29