diff options
author | Vincent Ambo <mail@tazj.in> | 2021-09-21T10·03+0300 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2021-09-21T11·29+0300 |
commit | 43b1791ec601732ac31195df96781a848360a9ac (patch) | |
tree | daae8d638343295d2f1f7da955e556ef4c958864 /third_party/git/t/t0019-json-writer.sh | |
parent | 2d8e7dc9d9c38127ec4ebd13aee8e8f586a43318 (diff) |
chore(3p/git): Unvendor git and track patches instead r/2903
This was vendored a long time ago under the expectation that keeping it in sync with cgit would be easier this way, but it has proven not to be a big issue. On the other hand, a vendored copy of git is an annoying maintenance burden. It is much easier to rebase the single (dottime) patch that we have. This removes the vendored copy of git and instead passes the git source code to cgit via `pkgs.srcOnly`, which includes the applied patch so that cgit can continue rendering dottime. Change-Id: If31f62dea7ce688fd1b9050204e9378019775f2b
Diffstat (limited to 'third_party/git/t/t0019-json-writer.sh')
-rwxr-xr-x | third_party/git/t/t0019-json-writer.sh | 331 |
1 files changed, 0 insertions, 331 deletions
diff --git a/third_party/git/t/t0019-json-writer.sh b/third_party/git/t/t0019-json-writer.sh deleted file mode 100755 index 3b0c336b38e4..000000000000 --- a/third_party/git/t/t0019-json-writer.sh +++ /dev/null @@ -1,331 +0,0 @@ -#!/bin/sh - -test_description='test json-writer JSON generation' -. ./test-lib.sh - -test_expect_success 'unit test of json-writer routines' ' - test-tool json-writer -u -' - -test_expect_success 'trivial object' ' - cat >expect <<-\EOF && - {} - EOF - cat >input <<-\EOF && - object - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'trivial array' ' - cat >expect <<-\EOF && - [] - EOF - cat >input <<-\EOF && - array - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'simple object' ' - cat >expect <<-\EOF && - {"a":"abc","b":42,"c":3.14,"d":true,"e":false,"f":null} - EOF - cat >input <<-\EOF && - object - object-string a abc - object-int b 42 - object-double c 2 3.140 - object-true d - object-false e - object-null f - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'simple array' ' - cat >expect <<-\EOF && - ["abc",42,3.14,true,false,null] - EOF - cat >input <<-\EOF && - array - array-string abc - array-int 42 - array-double 2 3.140 - array-true - array-false - array-null - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'escape quoting string' ' - cat >expect <<-\EOF && - {"a":"abc\\def"} - EOF - cat >input <<-\EOF && - object - object-string a abc\def - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'escape quoting string 2' ' - cat >expect <<-\EOF && - {"a":"abc\"def"} - EOF - cat >input <<-\EOF && - object - object-string a abc"def - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'nested inline object' ' - cat >expect <<-\EOF && - {"a":"abc","b":42,"sub1":{"c":3.14,"d":true,"sub2":{"e":false,"f":null}}} - EOF - cat >input <<-\EOF && - object - object-string a abc - object-int b 42 - object-object sub1 - object-double c 2 3.140 - object-true d - object-object sub2 - object-false e - object-null f - end - end - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'nested inline array' ' - cat >expect <<-\EOF && - ["abc",42,[3.14,true,[false,null]]] - EOF - cat >input <<-\EOF && - array - array-string abc - array-int 42 - array-array - array-double 2 3.140 - array-true - array-array - array-false - array-null - end - end - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'nested inline object and array' ' - cat >expect <<-\EOF && - {"a":"abc","b":42,"sub1":{"c":3.14,"d":true,"sub2":[false,null]}} - EOF - cat >input <<-\EOF && - object - object-string a abc - object-int b 42 - object-object sub1 - object-double c 2 3.140 - object-true d - object-array sub2 - array-false - array-null - end - end - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'nested inline object and array 2' ' - cat >expect <<-\EOF && - {"a":"abc","b":42,"sub1":{"c":3.14,"d":true,"sub2":[false,{"g":0,"h":1},null]}} - EOF - cat >input <<-\EOF && - object - object-string a abc - object-int b 42 - object-object sub1 - object-double c 2 3.140 - object-true d - object-array sub2 - array-false - array-object - object-int g 0 - object-int h 1 - end - array-null - end - end - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'pretty nested inline object and array 2' ' - sed -e "s/^|//" >expect <<-\EOF && - |{ - | "a": "abc", - | "b": 42, - | "sub1": { - | "c": 3.14, - | "d": true, - | "sub2": [ - | false, - | { - | "g": 0, - | "h": 1 - | }, - | null - | ] - | } - |} - EOF - cat >input <<-\EOF && - object - object-string a abc - object-int b 42 - object-object sub1 - object-double c 2 3.140 - object-true d - object-array sub2 - array-false - array-object - object-int g 0 - object-int h 1 - end - array-null - end - end - end - EOF - test-tool json-writer -p <input >actual && - test_cmp expect actual -' - -test_expect_success 'inline object with no members' ' - cat >expect <<-\EOF && - {"a":"abc","empty":{},"b":42} - EOF - cat >input <<-\EOF && - object - object-string a abc - object-object empty - end - object-int b 42 - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'inline array with no members' ' - cat >expect <<-\EOF && - {"a":"abc","empty":[],"b":42} - EOF - cat >input <<-\EOF && - object - object-string a abc - object-array empty - end - object-int b 42 - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_expect_success 'larger empty example' ' - cat >expect <<-\EOF && - {"a":"abc","empty":[{},{},{},[],{}],"b":42} - EOF - cat >input <<-\EOF && - object - object-string a abc - object-array empty - array-object - end - array-object - end - array-object - end - array-array - end - array-object - end - end - object-int b 42 - end - EOF - test-tool json-writer <input >actual && - test_cmp expect actual -' - -test_lazy_prereq PERLJSON ' - perl -MJSON -e "exit 0" -' - -# As a sanity check, ask Perl to parse our generated JSON and recursively -# dump the resulting data in sorted order. Confirm that that matches our -# expectations. -test_expect_success PERLJSON 'parse JSON using Perl' ' - cat >expect <<-\EOF && - row[0].a abc - row[0].b 42 - row[0].sub1 hash - row[0].sub1.c 3.14 - row[0].sub1.d 1 - row[0].sub1.sub2 array - row[0].sub1.sub2[0] 0 - row[0].sub1.sub2[1] hash - row[0].sub1.sub2[1].g 0 - row[0].sub1.sub2[1].h 1 - row[0].sub1.sub2[2] null - EOF - cat >input <<-\EOF && - object - object-string a abc - object-int b 42 - object-object sub1 - object-double c 2 3.140 - object-true d - object-array sub2 - array-false - array-object - object-int g 0 - object-int h 1 - end - array-null - end - end - end - EOF - test-tool json-writer <input >output.json && - perl "$TEST_DIRECTORY"/t0019/parse_json.perl <output.json >actual && - test_cmp expect actual -' - -test_done |