From 6f93deba88eba7463860d4c854aa7ac5f08e9140 Mon Sep 17 00:00:00 2001
From: Neil Pankey <npankey@gmail.com>
Date: Thu, 17 Sep 2020 19:37:28 -0700
Subject: [PATCH] test: generate utf-16 testdata and bom variants

---
 gen_testdata.go                       |  57 +++++++++++++++++++++++++
 main_test.go                          |  59 +++++++++++++-------------
 testdata/utf-16be/data-error.json     | Bin 0 -> 30 bytes
 testdata/utf-16be/data-error.yml      | Bin 0 -> 108 bytes
 testdata/utf-16be/data-fail.json      | Bin 0 -> 58 bytes
 testdata/utf-16be/data-fail.yml       | Bin 0 -> 42 bytes
 testdata/utf-16be/data-pass.json      | Bin 0 -> 82 bytes
 testdata/utf-16be/data-pass.yml       | Bin 0 -> 48 bytes
 testdata/utf-16be/schema.json         | Bin 0 -> 220 bytes
 testdata/utf-16be/schema.yml          | Bin 0 -> 156 bytes
 testdata/utf-16be_bom/data-error.json | Bin 0 -> 32 bytes
 testdata/utf-16be_bom/data-error.yml  | Bin 0 -> 110 bytes
 testdata/utf-16be_bom/data-fail.json  | Bin 0 -> 60 bytes
 testdata/utf-16be_bom/data-fail.yml   | Bin 0 -> 44 bytes
 testdata/utf-16be_bom/data-pass.json  | Bin 0 -> 84 bytes
 testdata/utf-16be_bom/data-pass.yml   | Bin 0 -> 50 bytes
 testdata/utf-16be_bom/schema.json     | Bin 0 -> 222 bytes
 testdata/utf-16be_bom/schema.yml      | Bin 0 -> 158 bytes
 testdata/utf-16le/data-error.json     | Bin 0 -> 30 bytes
 testdata/utf-16le/data-error.yml      | Bin 0 -> 108 bytes
 testdata/utf-16le/data-fail.json      | Bin 0 -> 58 bytes
 testdata/utf-16le/data-fail.yml       | Bin 0 -> 42 bytes
 testdata/utf-16le/data-pass.json      | Bin 0 -> 82 bytes
 testdata/utf-16le/data-pass.yml       | Bin 0 -> 48 bytes
 testdata/utf-16le/schema.json         | Bin 0 -> 220 bytes
 testdata/utf-16le/schema.yml          | Bin 0 -> 156 bytes
 testdata/utf-16le_bom/data-error.json | Bin 0 -> 32 bytes
 testdata/utf-16le_bom/data-error.yml  | Bin 0 -> 110 bytes
 testdata/utf-16le_bom/data-fail.json  | Bin 0 -> 60 bytes
 testdata/utf-16le_bom/data-fail.yml   | Bin 0 -> 44 bytes
 testdata/utf-16le_bom/data-pass.json  | Bin 0 -> 84 bytes
 testdata/utf-16le_bom/data-pass.yml   | Bin 0 -> 50 bytes
 testdata/utf-16le_bom/schema.json     | Bin 0 -> 222 bytes
 testdata/utf-16le_bom/schema.yml      | Bin 0 -> 158 bytes
 testdata/{ => utf-8}/data-error.json  |   0
 testdata/{ => utf-8}/data-error.yml   |   0
 testdata/{ => utf-8}/data-fail.json   |   0
 testdata/{ => utf-8}/data-fail.yml    |   0
 testdata/{ => utf-8}/data-pass.json   |   0
 testdata/{ => utf-8}/data-pass.yml    |   0
 testdata/{ => utf-8}/schema.json      |   0
 testdata/{ => utf-8}/schema.yml       |   0
 testdata/utf-8_bom/data-error.json    |   1 +
 testdata/utf-8_bom/data-error.yml     |   1 +
 testdata/utf-8_bom/data-fail.json     |   3 ++
 testdata/utf-8_bom/data-fail.yml      |   2 +
 testdata/utf-8_bom/data-pass.json     |   4 ++
 testdata/utf-8_bom/data-pass.yml      |   3 ++
 testdata/utf-8_bom/schema.json        |   7 +++
 testdata/utf-8_bom/schema.yml         |   7 +++
 50 files changed, 114 insertions(+), 30 deletions(-)
 create mode 100644 gen_testdata.go
 create mode 100644 testdata/utf-16be/data-error.json
 create mode 100644 testdata/utf-16be/data-error.yml
 create mode 100644 testdata/utf-16be/data-fail.json
 create mode 100644 testdata/utf-16be/data-fail.yml
 create mode 100644 testdata/utf-16be/data-pass.json
 create mode 100644 testdata/utf-16be/data-pass.yml
 create mode 100644 testdata/utf-16be/schema.json
 create mode 100644 testdata/utf-16be/schema.yml
 create mode 100644 testdata/utf-16be_bom/data-error.json
 create mode 100644 testdata/utf-16be_bom/data-error.yml
 create mode 100644 testdata/utf-16be_bom/data-fail.json
 create mode 100644 testdata/utf-16be_bom/data-fail.yml
 create mode 100644 testdata/utf-16be_bom/data-pass.json
 create mode 100644 testdata/utf-16be_bom/data-pass.yml
 create mode 100644 testdata/utf-16be_bom/schema.json
 create mode 100644 testdata/utf-16be_bom/schema.yml
 create mode 100644 testdata/utf-16le/data-error.json
 create mode 100644 testdata/utf-16le/data-error.yml
 create mode 100644 testdata/utf-16le/data-fail.json
 create mode 100644 testdata/utf-16le/data-fail.yml
 create mode 100644 testdata/utf-16le/data-pass.json
 create mode 100644 testdata/utf-16le/data-pass.yml
 create mode 100644 testdata/utf-16le/schema.json
 create mode 100644 testdata/utf-16le/schema.yml
 create mode 100644 testdata/utf-16le_bom/data-error.json
 create mode 100644 testdata/utf-16le_bom/data-error.yml
 create mode 100644 testdata/utf-16le_bom/data-fail.json
 create mode 100644 testdata/utf-16le_bom/data-fail.yml
 create mode 100644 testdata/utf-16le_bom/data-pass.json
 create mode 100644 testdata/utf-16le_bom/data-pass.yml
 create mode 100644 testdata/utf-16le_bom/schema.json
 create mode 100644 testdata/utf-16le_bom/schema.yml
 rename testdata/{ => utf-8}/data-error.json (100%)
 rename testdata/{ => utf-8}/data-error.yml (100%)
 rename testdata/{ => utf-8}/data-fail.json (100%)
 rename testdata/{ => utf-8}/data-fail.yml (100%)
 rename testdata/{ => utf-8}/data-pass.json (100%)
 rename testdata/{ => utf-8}/data-pass.yml (100%)
 rename testdata/{ => utf-8}/schema.json (100%)
 rename testdata/{ => utf-8}/schema.yml (100%)
 create mode 100644 testdata/utf-8_bom/data-error.json
 create mode 100644 testdata/utf-8_bom/data-error.yml
 create mode 100644 testdata/utf-8_bom/data-fail.json
 create mode 100644 testdata/utf-8_bom/data-fail.yml
 create mode 100644 testdata/utf-8_bom/data-pass.json
 create mode 100644 testdata/utf-8_bom/data-pass.yml
 create mode 100644 testdata/utf-8_bom/schema.json
 create mode 100644 testdata/utf-8_bom/schema.yml

diff --git a/gen_testdata.go b/gen_testdata.go
new file mode 100644
index 0000000..062497b
--- /dev/null
+++ b/gen_testdata.go
@@ -0,0 +1,57 @@
+// +build ignore
+
+// generates clones the utf-8 tests data to the other
+// unicode encodings and adds BOM variants of each.
+package main
+
+import (
+    "io/ioutil"
+    "log"
+    "os"
+    "path/filepath"
+
+    "golang.org/x/text/encoding"
+    "golang.org/x/text/encoding/unicode"
+)
+
+
+func main() {
+    var xforms = []struct {
+        dir, bom string
+        enc encoding.Encoding
+    } {
+        { "testdata/utf-16be", "\xFE\xFF", unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM) },
+        { "testdata/utf-16le", "\xFF\xFE", unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM) },
+    }
+
+    paths, _ := filepath.Glob("testdata/utf-8/*")
+    for _, p := range paths {
+        src, err := ioutil.ReadFile(p)
+        if err != nil {
+            log.Fatal(err)
+        }
+
+        write("testdata/utf-8_bom", p, "\xEF\xBB\xBF", src)
+        for _, xform := range xforms {
+            dst, err := xform.enc.NewEncoder().Bytes(src)
+            if err != nil {
+                log.Fatal(err)
+            }
+            write(xform.dir, p, "", dst)
+            write(xform.dir + "_bom", p, xform.bom, dst)
+        }
+    }
+}
+
+func write(dir, orig, bom string, buf []byte) {
+    f, err := os.Create(filepath.Join(dir, filepath.Base(orig)))
+    if err != nil {
+        log.Fatal(err)
+    }
+    if _, err = f.Write([]byte(bom)); err != nil {
+        log.Fatal(err)
+    }
+    if _, err = f.Write(buf); err != nil {
+        log.Fatal(err)
+    }
+}
diff --git a/main_test.go b/main_test.go
index b4475ff..878fe8b 100644
--- a/main_test.go
+++ b/main_test.go
@@ -9,61 +9,61 @@ import (
 
 func TestMain(t *testing.T) {
 	tests := []struct {
-		in string
-		out []string
+		in   string
+		out  []string
 		exit int
-	} {
+	}{
 		{
-			"-s testdata/schema.yml testdata/data-pass.yml",
-			[]string{"testdata/data-pass.yml: pass"},
+			"-s testdata/utf-8/schema.yml testdata/utf-8/data-pass.yml",
+			[]string{"testdata/utf-8/data-pass.yml: pass"},
 			0,
 		}, {
-			"-s testdata/schema.json testdata/data-pass.yml",
-			[]string{"testdata/data-pass.yml: pass"},
+			"-s testdata/utf-8/schema.json testdata/utf-8/data-pass.yml",
+			[]string{"testdata/utf-8/data-pass.yml: pass"},
 			0,
 		}, {
-			"-s testdata/schema.json testdata/data-pass.json",
-			[]string{"testdata/data-pass.json: pass"},
+			"-s testdata/utf-8/schema.json testdata/utf-8/data-pass.json",
+			[]string{"testdata/utf-8/data-pass.json: pass"},
 			0,
 		}, {
-			"-s testdata/schema.yml testdata/data-pass.json",
-			[]string{"testdata/data-pass.json: pass"},
+			"-s testdata/utf-8/schema.yml testdata/utf-8/data-pass.json",
+			[]string{"testdata/utf-8/data-pass.json: pass"},
 			0,
 		}, {
-			"-q -s testdata/schema.yml testdata/data-fail.yml",
-			[]string{"testdata/data-fail.yml: fail: (root): foo is required"},
+			"-q -s testdata/utf-8/schema.yml testdata/utf-8/data-fail.yml",
+			[]string{"testdata/utf-8/data-fail.yml: fail: (root): foo is required"},
 			1,
 		}, {
-			"-q -s testdata/schema.json testdata/data-fail.yml",
-			[]string{"testdata/data-fail.yml: fail: (root): foo is required"},
+			"-q -s testdata/utf-8/schema.json testdata/utf-8/data-fail.yml",
+			[]string{"testdata/utf-8/data-fail.yml: fail: (root): foo is required"},
 			1,
 		}, {
-			"-q -s testdata/schema.json testdata/data-fail.json",
-			[]string{"testdata/data-fail.json: fail: (root): foo is required"},
+			"-q -s testdata/utf-8/schema.json testdata/utf-8/data-fail.json",
+			[]string{"testdata/utf-8/data-fail.json: fail: (root): foo is required"},
 			1,
 		}, {
-			"-q -s testdata/schema.yml testdata/data-fail.json",
-			[]string{"testdata/data-fail.json: fail: (root): foo is required"},
+			"-q -s testdata/utf-8/schema.yml testdata/utf-8/data-fail.json",
+			[]string{"testdata/utf-8/data-fail.json: fail: (root): foo is required"},
 			1,
 		}, {
-			"-q -s testdata/schema.json testdata/data-error.json",
-			[]string{"testdata/data-error.json: error: validate: invalid character 'o' in literal null (expecting 'u')"},
+			"-q -s testdata/utf-8/schema.json testdata/utf-8/data-error.json",
+			[]string{"testdata/utf-8/data-error.json: error: validate: invalid character 'o' in literal null (expecting 'u')"},
 			2,
 		}, {
-			"-q -s testdata/schema.yml testdata/data-error.yml",
-			[]string{"testdata/data-error.yml: error: load doc: yaml: found unexpected end of stream"},
+			"-q -s testdata/utf-8/schema.yml testdata/utf-8/data-error.yml",
+			[]string{"testdata/utf-8/data-error.yml: error: load doc: yaml: found unexpected end of stream"},
 			2,
 		}, {
-			"-q -s testdata/schema.json testdata/data-*.json",
+			"-q -s testdata/utf-8/schema.json testdata/utf-8/data-*.json",
 			[]string{
-				"testdata/data-fail.json: fail: (root): foo is required",
-				"testdata/data-error.json: error: validate: invalid character 'o' in literal null (expecting 'u')",
+				"testdata/utf-8/data-fail.json: fail: (root): foo is required",
+				"testdata/utf-8/data-error.json: error: validate: invalid character 'o' in literal null (expecting 'u')",
 			}, 3,
 		}, {
-			"-q -s testdata/schema.yml testdata/data-*.yml",
+			"-q -s testdata/utf-8/schema.yml testdata/utf-8/data-*.yml",
 			[]string{
-				"testdata/data-error.yml: error: load doc: yaml: found unexpected end of stream",
-				"testdata/data-fail.yml: fail: (root): foo is required",
+				"testdata/utf-8/data-error.yml: error: load doc: yaml: found unexpected end of stream",
+				"testdata/utf-8/data-fail.yml: fail: (root): foo is required",
 			}, 3,
 		},
 	}
@@ -89,4 +89,3 @@ func TestMain(t *testing.T) {
 		})
 	}
 }
-
diff --git a/testdata/utf-16be/data-error.json b/testdata/utf-16be/data-error.json
new file mode 100644
index 0000000000000000000000000000000000000000..74920f2f29711d04beca75a244f0ce3310c1ea19
GIT binary patch
literal 30
lcmZR`W5{PHVNhTwV@PDkVaQ}iVNhVmVkl<FXUJpV0svKm1!e#M

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be/data-error.yml b/testdata/utf-16be/data-error.yml
new file mode 100644
index 0000000000000000000000000000000000000000..b0c91f19b96f9d6bd513c0b368e800395b6cbec0
GIT binary patch
literal 108
zcmZR`WXNMEV@PDkVaQ}iVX$IQU{GR6WXNMsU`S;sW=Lj8WGG-rWk_LAV2EK*XHZ}$
s2J1*?$YDrjP+%xzC}qfJC;_uG8HyPc81le;1tc>S7%CYO8FCqN0Q}_>D*ylh

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be/data-fail.json b/testdata/utf-16be/data-fail.json
new file mode 100644
index 0000000000000000000000000000000000000000..646c6c55c3ae37730d6f7c019adec120c90d43b0
GIT binary patch
literal 58
zcmZRmX5eB_fI=mPB!)zWA_gS}D+UDyC5BvvOon2HVunnHJce`z1%@<+e1?1mB?c~r
HS_Uov+9e1K

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be/data-fail.yml b/testdata/utf-16be/data-fail.yml
new file mode 100644
index 0000000000000000000000000000000000000000..b0dc72605189e83b51522bfe72e89229e0528011
GIT binary patch
literal 42
tcmZS31w$@|B!)zWA_gl41%_OPOon2HVunnHJce`z1%@<+e1?1mE&zVa28jRw

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be/data-pass.json b/testdata/utf-16be/data-pass.json
new file mode 100644
index 0000000000000000000000000000000000000000..b0d7261160409b9cd2670c27a276460b2f5a08d5
GIT binary patch
literal 82
zcmZRmX5eB_fI=mPG=_YJd<G>3D+UDyC5A+XVulokGzKLG9TZhb42cXya8*?d6%5G?
NWeiFTTnx1gTmXs13G)B|

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be/data-pass.yml b/testdata/utf-16be/data-pass.yml
new file mode 100644
index 0000000000000000000000000000000000000000..80b8d780aced3b101b73f3712b377d7872341f1e
GIT binary patch
literal 48
wcmZS31w$@|G=_YJd<H891%^b1VulokGzKn)B!)zWBCuE$Lj^-JLm2}X0HPxYJOBUy

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be/schema.json b/testdata/utf-16be/schema.json
new file mode 100644
index 0000000000000000000000000000000000000000..ed742390b4f5d72837cf95dcf3d3826140eafba5
GIT binary patch
literal 220
zcmZRmX5eB_fI=mP0)`@ne1-ysRE8pk5{68MREA;(B?c=71r&7%^=S<G4Eb;s3JgjN
zB@C5d{SaMB48;s33`Go?40#Oc3`z_N47Ch8NH!u&N@7T4D1w_*i=+lshY~{(Ln=cd
aLn%Whn3V$66V0H+0CP<&0~bRr0~Y{0NE}%J

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be/schema.yml b/testdata/utf-16be/schema.yml
new file mode 100644
index 0000000000000000000000000000000000000000..420e8ba4bb742f8abc77d5a95bfce16379e9040f
GIT binary patch
literal 156
zcmZS31w$@|0)`@ne1-ysRE8pk5{68MREA;(D+VqG1t?5o$Y;n$5rN5+FjRu|SurRu
z6f=}C6ftBn<T0cp=}lrtWGG?)$yYPfGH@{zF{CmSGL$l8f>|jjrs^^%FhK0$0sy3@
B6}bQa

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be_bom/data-error.json b/testdata/utf-16be_bom/data-error.json
new file mode 100644
index 0000000000000000000000000000000000000000..240156890c7692c7f7d9e5df49eeb34c01bb5a8e
GIT binary patch
literal 32
ncmezOpCOMSpP__7fuW2cks*g6lOcscfgy{bm?57bkAVvSlqLsb

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be_bom/data-error.yml b/testdata/utf-16be_bom/data-error.yml
new file mode 100644
index 0000000000000000000000000000000000000000..499fc64eb61610a5b5c666a0cabe8ee5847a4843
GIT binary patch
literal 110
zcmezOpCOYWkD-hqks*g6lOct{ia~)vi6N08k3oSUm7$m+nIVy(fFYG3g+YNKhC!V{
vfuR_zBb_0KA(cUap^%}JA)lcH%+6#eW>8?r1M?M-%v4~gWJqMlWyk>l)~yvN

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be_bom/data-fail.json b/testdata/utf-16be_bom/data-fail.json
new file mode 100644
index 0000000000000000000000000000000000000000..bf74c385e84b688ef534d86071612fa20aa19703
GIT binary patch
literal 60
zcmezOpP`z8i$MVjl^Bv35*dmZlo+fS6d05kav3riiW!O-G8yt1(is#O(irj?@)?vE
JxEN{~xByUt3JCxJ

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be_bom/data-fail.yml b/testdata/utf-16be_bom/data-fail.yml
new file mode 100644
index 0000000000000000000000000000000000000000..f7f8d1f41cb944a238aff90bf1c9dd910d5572d3
GIT binary patch
literal 44
vcmezOpFtN4xfqfd5*dmZtQZs+av3riiW!O-G8yt1(is#O(irj?@)@`Q)k_G5

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be_bom/data-pass.json b/testdata/utf-16be_bom/data-pass.json
new file mode 100644
index 0000000000000000000000000000000000000000..d3b34921be45a5157e095bda65bbdd8a2fade476
GIT binary patch
literal 84
zcmezOpP`z8i$MVjl^D_(@)`0Olo+fS6d05k5*dmaQW(-0lo)hSR3$MaG8Dm8RWVdB
QBr}vTC^2v`)G}}Z0597M@Bjb+

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be_bom/data-pass.yml b/testdata/utf-16be_bom/data-pass.yml
new file mode 100644
index 0000000000000000000000000000000000000000..277d96d955afa1c42549643f587d3d60e098e880
GIT binary patch
literal 50
ycmezOpFtN4xfs$I@)`0OtQZs+5*dmaQW(-0xEPWc5*doXVpR+k49N^-3|s&Np9wht

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be_bom/schema.json b/testdata/utf-16be_bom/schema.json
new file mode 100644
index 0000000000000000000000000000000000000000..6f743f624e4ecebc55caf778b717305509cf44c4
GIT binary patch
literal 222
zcmezOpP`z8i$MVjl^6;biWu@43K&uuiWo{5G8s}CiW!s`tQZtf)FITTG2}Dk!&N9S
zC^3{URD$(GbSW_uGn6nCF=R62F{CpnF(@$9GUy=Lh%hOMA(5d7Zc;6h8dM!h3`Gp7
c422A(44Gh73RF)tgAxPGHL(m_47Chg0Q0~eRsaA1

literal 0
HcmV?d00001

diff --git a/testdata/utf-16be_bom/schema.yml b/testdata/utf-16be_bom/schema.yml
new file mode 100644
index 0000000000000000000000000000000000000000..d8cbaffeda48c1b1e1d9adbdaaaa136767a75184
GIT binary patch
literal 158
zcmezOpFtN4xflu<iWu@43K&uuiWo{5G8s}CiW#gJxEK_mFpVLfAs<BqCR4&t3D#%D
zpukYfP{L5ekjaq8kdCA`i6N1phyf&D%}~q0#ZbhM%23Eq%8&_WrJ$Iq%b>sjv5N};
D-QE|r

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le/data-error.json b/testdata/utf-16le/data-error.json
new file mode 100644
index 0000000000000000000000000000000000000000..c7ff59b25585042ad5ce4859610b6ef60bbe1b23
GIT binary patch
literal 30
lcmc~}$Y&^FP+%xyNMy)i$Ye-iP+-VnC}zlK$YbDQ003I(1!e#M

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le/data-error.yml b/testdata/utf-16le/data-error.yml
new file mode 100644
index 0000000000000000000000000000000000000000..89121bcb737e4fe9cd908ac08625bb805ee2a393
GIT binary patch
literal 108
zcmc~~$YUsDNMy)i$Ye-iuwqbPP+~}A$YW4oNM$HyNM=Z6C}2osNMTT5h+$A?P+%x#
t0O?3)$YDrjP+%xzC}qfJC;_uG8HyPc81le;1tc>S7%CYO8FCqN7yu9+6Dt4!

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le/data-fail.json b/testdata/utf-16le/data-fail.json
new file mode 100644
index 0000000000000000000000000000000000000000..fad1c917597c78ee47e743e14d84d01176bd772d
GIT binary patch
literal 58
zcmb<s;9^jKLM4VIhD3%U1|<e71_cHshFpeBhGK?dhD?S$hI9r6hBStJhI|Gk1}=tL
H1}+8w;xGsd

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le/data-fail.yml b/testdata/utf-16le/data-fail.yml
new file mode 100644
index 0000000000000000000000000000000000000000..64a5cc187a8ee92ae9e677054cd0d1fd1c86cfdc
GIT binary patch
literal 42
ucmdO806{K>B!)zWA_gl41%_OPOon2HVunnHJce`z1%@<+e1?1mE(QRFR0fFv

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le/data-pass.json b/testdata/utf-16le/data-pass.json
new file mode 100644
index 0000000000000000000000000000000000000000..28357344bee9e5cc940a51cc7e9d7e36ba644573
GIT binary patch
literal 82
zcmb<s;9^jKLM4VYhJ1#61|<e71_cHshD3&9h7^W01|<d^6jezKi3~+>RaFcX49N^-
N3`z`K47Chg3;>h23G)B|

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le/data-pass.yml b/testdata/utf-16le/data-pass.yml
new file mode 100644
index 0000000000000000000000000000000000000000..ebb8581e4f4f41e334045d3dbe11af0809d2bd3d
GIT binary patch
literal 48
xcmdO806{K>G=_YJd<H891%^b1VulokGzKn)B!)zWBCuE$Lj^-JLm2}X0|2RB2Rr}(

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le/schema.json b/testdata/utf-16le/schema.json
new file mode 100644
index 0000000000000000000000000000000000000000..2b84fea7e19373707542feccfccd560ad2166318
GIT binary patch
literal 220
zcmb<s;9^jKLM4U*h9ZW1h609Eh9ZU%hD?T3hGGUK1}g>y24r;z^=S<G4Eb;s3JgjN
zB@C5d{SaMB48;s33`Go?40#Oc3`z_N47Ch8NH!u&N@7T4D1w_*i=+lshY~{(Ln=cd
ZLn%Whn3V$66V0H+0CP<&0~Z6x1OQi{99aMW

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le/schema.yml b/testdata/utf-16le/schema.yml
new file mode 100644
index 0000000000000000000000000000000000000000..e235f85ec6f2ba862675cae8b4bf3ec369cb134a
GIT binary patch
literal 156
zcmdO806{K>0)`@ne1-ysRE8pk5{68MREA;(D+VqG1t?5o$Y;n$5rN5+FjRu|SurRu
z6f=}C6ftBn<T0cp=}lrtWGG?)$yYPfGH@{zF{CmSGL$l8f>|jjrs^^%FhK0$VgLZT
CUKP0j

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le_bom/data-error.json b/testdata/utf-16le_bom/data-error.json
new file mode 100644
index 0000000000000000000000000000000000000000..4f103343818acdbcda160e0dda735ab53391ded3
GIT binary patch
literal 32
ncmezWFOMOgp@cz!p^PDsA%`K8A%#JKA&a4yA)g_Sfr|kEnT!Wx

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le_bom/data-error.yml b/testdata/utf-16le_bom/data-error.yml
new file mode 100644
index 0000000000000000000000000000000000000000..838a4a95543495aefd1a483dd541179c6ae2def2
GIT binary patch
literal 110
zcmezWFOwmUp^PDsA%`K8A%($;L4iSuA(0`EL4hHap_n0=A(5egA(bJ8L4hHLL7hQ?
wp_l=rBb_0KA(cUap^%}JA)lcH%+6#eW>8?r1M?M-%v4~gWJqMlWyoOw0O{BjC;$Ke

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le_bom/data-fail.json b/testdata/utf-16le_bom/data-fail.json
new file mode 100644
index 0000000000000000000000000000000000000000..f5030d96f83b7edb35e8132b448b90acfef2c645
GIT binary patch
literal 60
zcmezWubP32K>-St7?Kzg8HyN`7_1l+7?c=t88R7)8HyP)8S)s?859`O81fnN8I%~f
J7-|`~7yww03JCxJ

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le_bom/data-fail.yml b/testdata/utf-16le_bom/data-fail.yml
new file mode 100644
index 0000000000000000000000000000000000000000..90d4179e98f5ddfa8b6138fd2f654542461cc7cb
GIT binary patch
literal 44
wcmezWPnQ7%xfqfd5*dmZtQZs+av3riiW!O-G8yt1(is#O(irj?@)@`o0Nd0Eh5!Hn

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le_bom/data-pass.json b/testdata/utf-16le_bom/data-pass.json
new file mode 100644
index 0000000000000000000000000000000000000000..04c3ad0db6025affd7921db24988c2f593fc7938
GIT binary patch
literal 84
zcmezWubP32K>-St7}6N>8S)vF7_1l+7?c<i8HyQF7}6M&7<5onB{3v26v0(hF;p-l
QGn6qXF>o=|GH@{f06ESJ@Bjb+

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le_bom/data-pass.yml b/testdata/utf-16le_bom/data-pass.yml
new file mode 100644
index 0000000000000000000000000000000000000000..5f8246f7a287a74d96393d161c2db0bee264afb2
GIT binary patch
literal 50
zcmezWPnQ7%xfs$I@)`0OtQZs+5*dmaQW(-0xEPWc5*doXVpR+k49N^-3|tHV3)=}f

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le_bom/schema.json b/testdata/utf-16le_bom/schema.json
new file mode 100644
index 0000000000000000000000000000000000000000..eb89b0044c97e48efad7b024b333420b67061031
GIT binary patch
literal 222
zcmezWubP32K>-St7z!AQ81fkk7*ZLE7)ls28B!UF8I%~T7!(+g)gjcUG2}Dk!&N9S
zC^3{URD$(GbSW_uGn6nCF=R62F{CpnF(@$9GUy=Lh%hOMA(5d7Zc;6h8dM!h3`Gp7
b422A(44Gh73RF)tgAxPGHL(m_3?LH#5GWp2

literal 0
HcmV?d00001

diff --git a/testdata/utf-16le_bom/schema.yml b/testdata/utf-16le_bom/schema.yml
new file mode 100644
index 0000000000000000000000000000000000000000..43fc6b438ed49ca5f56cae6b22b6de8cd1bed4aa
GIT binary patch
literal 158
zcmezWPnQ7%xflu<iWu@43K&uuiWo{5G8s}CiW#gJxEK_mFpVLfAs<BqCR4&t3D#%D
zpukYfP{L5ekjaq8kdCA`i6N1phyf&D%}~q0#ZbhM%23Eq%8&_WrJ$Iq%b>sjv5SiV
E0P~j@wg3PC

literal 0
HcmV?d00001

diff --git a/testdata/data-error.json b/testdata/utf-8/data-error.json
similarity index 100%
rename from testdata/data-error.json
rename to testdata/utf-8/data-error.json
diff --git a/testdata/data-error.yml b/testdata/utf-8/data-error.yml
similarity index 100%
rename from testdata/data-error.yml
rename to testdata/utf-8/data-error.yml
diff --git a/testdata/data-fail.json b/testdata/utf-8/data-fail.json
similarity index 100%
rename from testdata/data-fail.json
rename to testdata/utf-8/data-fail.json
diff --git a/testdata/data-fail.yml b/testdata/utf-8/data-fail.yml
similarity index 100%
rename from testdata/data-fail.yml
rename to testdata/utf-8/data-fail.yml
diff --git a/testdata/data-pass.json b/testdata/utf-8/data-pass.json
similarity index 100%
rename from testdata/data-pass.json
rename to testdata/utf-8/data-pass.json
diff --git a/testdata/data-pass.yml b/testdata/utf-8/data-pass.yml
similarity index 100%
rename from testdata/data-pass.yml
rename to testdata/utf-8/data-pass.yml
diff --git a/testdata/schema.json b/testdata/utf-8/schema.json
similarity index 100%
rename from testdata/schema.json
rename to testdata/utf-8/schema.json
diff --git a/testdata/schema.yml b/testdata/utf-8/schema.yml
similarity index 100%
rename from testdata/schema.yml
rename to testdata/utf-8/schema.yml
diff --git a/testdata/utf-8_bom/data-error.json b/testdata/utf-8_bom/data-error.json
new file mode 100644
index 0000000..6e61837
--- /dev/null
+++ b/testdata/utf-8_bom/data-error.json
@@ -0,0 +1 @@
+not valid json
diff --git a/testdata/utf-8_bom/data-error.yml b/testdata/utf-8_bom/data-error.yml
new file mode 100644
index 0000000..f9b03bc
--- /dev/null
+++ b/testdata/utf-8_bom/data-error.yml
@@ -0,0 +1 @@
+invalid: "an escaped \' single quote is not valid yaml
\ No newline at end of file
diff --git a/testdata/utf-8_bom/data-fail.json b/testdata/utf-8_bom/data-fail.json
new file mode 100644
index 0000000..053cc03
--- /dev/null
+++ b/testdata/utf-8_bom/data-fail.json
@@ -0,0 +1,3 @@
+{
+    "bar": "missing foo"
+}
diff --git a/testdata/utf-8_bom/data-fail.yml b/testdata/utf-8_bom/data-fail.yml
new file mode 100644
index 0000000..b07635a
--- /dev/null
+++ b/testdata/utf-8_bom/data-fail.yml
@@ -0,0 +1,2 @@
+---
+bar: missing foo
diff --git a/testdata/utf-8_bom/data-pass.json b/testdata/utf-8_bom/data-pass.json
new file mode 100644
index 0000000..e091c96
--- /dev/null
+++ b/testdata/utf-8_bom/data-pass.json
@@ -0,0 +1,4 @@
+{
+    "foo": "asdf",
+    "bar": "zxcv"
+}
diff --git a/testdata/utf-8_bom/data-pass.yml b/testdata/utf-8_bom/data-pass.yml
new file mode 100644
index 0000000..d7e16a7
--- /dev/null
+++ b/testdata/utf-8_bom/data-pass.yml
@@ -0,0 +1,3 @@
+---
+foo: asdf
+bar: zxcv
diff --git a/testdata/utf-8_bom/schema.json b/testdata/utf-8_bom/schema.json
new file mode 100644
index 0000000..5e26417
--- /dev/null
+++ b/testdata/utf-8_bom/schema.json
@@ -0,0 +1,7 @@
+{
+    "properties": {
+        "foo": { "type": "string" },
+        "bar": {}
+    },
+    "required": ["foo"]
+}
diff --git a/testdata/utf-8_bom/schema.yml b/testdata/utf-8_bom/schema.yml
new file mode 100644
index 0000000..f2c99d5
--- /dev/null
+++ b/testdata/utf-8_bom/schema.yml
@@ -0,0 +1,7 @@
+---
+properties:
+    foo:
+        type: string
+    bar: {}
+required:
+    - foo
-- 
GitLab