Move pyyaml3000 to a separate directory.
diff --git a/tests/data/bool.data b/tests/data/bool.data
new file mode 100644
index 0000000..0988b63
--- /dev/null
+++ b/tests/data/bool.data
@@ -0,0 +1,4 @@
+- yes
+- NO
+- True
+- on
diff --git a/tests/data/bool.detect b/tests/data/bool.detect
new file mode 100644
index 0000000..947ebbb
--- /dev/null
+++ b/tests/data/bool.detect
@@ -0,0 +1 @@
+tag:yaml.org,2002:bool
diff --git a/tests/data/construct-binary.code b/tests/data/construct-binary.code
new file mode 100644
index 0000000..67ac0d5
--- /dev/null
+++ b/tests/data/construct-binary.code
@@ -0,0 +1,7 @@
+{
+    "canonical":
+        "GIF89a\x0c\x00\x0c\x00\x84\x00\x00\xff\xff\xf7\xf5\xf5\xee\xe9\xe9\xe5fff\x00\x00\x00\xe7\xe7\xe7^^^\xf3\xf3\xed\x8e\x8e\x8e\xe0\xe0\xe0\x9f\x9f\x9f\x93\x93\x93\xa7\xa7\xa7\x9e\x9e\x9eiiiccc\xa3\xa3\xa3\x84\x84\x84\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9!\xfe\x0eMade with GIMP\x00,\x00\x00\x00\x00\x0c\x00\x0c\x00\x00\x05,  \x8e\x810\x9e\xe3@\x14\xe8i\x10\xc4\xd1\x8a\x08\x1c\xcf\x80M$z\xef\xff0\x85p\xb8\xb01f\r\x1b\xce\x01\xc3\x01\x1e\x10' \x82\n\x01\x00;",
+    "generic":
+        "GIF89a\x0c\x00\x0c\x00\x84\x00\x00\xff\xff\xf7\xf5\xf5\xee\xe9\xe9\xe5fff\x00\x00\x00\xe7\xe7\xe7^^^\xf3\xf3\xed\x8e\x8e\x8e\xe0\xe0\xe0\x9f\x9f\x9f\x93\x93\x93\xa7\xa7\xa7\x9e\x9e\x9eiiiccc\xa3\xa3\xa3\x84\x84\x84\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9!\xfe\x0eMade with GIMP\x00,\x00\x00\x00\x00\x0c\x00\x0c\x00\x00\x05,  \x8e\x810\x9e\xe3@\x14\xe8i\x10\xc4\xd1\x8a\x08\x1c\xcf\x80M$z\xef\xff0\x85p\xb8\xb01f\r\x1b\xce\x01\xc3\x01\x1e\x10' \x82\n\x01\x00;",
+    "description": "The binary value above is a tiny arrow encoded as a gif image.",
+}
diff --git a/tests/data/construct-binary.data b/tests/data/construct-binary.data
new file mode 100644
index 0000000..dcdb16f
--- /dev/null
+++ b/tests/data/construct-binary.data
@@ -0,0 +1,12 @@
+canonical: !!binary "\
+ R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\
+ OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\
+ +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\
+ AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs="
+generic: !!binary |
+ R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5
+ OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+
+ +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC
+ AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
+description:
+ The binary value above is a tiny arrow encoded as a gif image.
diff --git a/tests/data/construct-bool.code b/tests/data/construct-bool.code
new file mode 100644
index 0000000..389d2c0
--- /dev/null
+++ b/tests/data/construct-bool.code
@@ -0,0 +1,6 @@
+{
+    "canonical": True,
+    "answer": False,
+    "logical": True,
+    "option": True,
+}
diff --git a/tests/data/construct-bool.data b/tests/data/construct-bool.data
new file mode 100644
index 0000000..e751222
--- /dev/null
+++ b/tests/data/construct-bool.data
@@ -0,0 +1,4 @@
+canonical: yes
+answer: NO
+logical: True
+option: on
diff --git a/tests/data/construct-custom.code b/tests/data/construct-custom.code
new file mode 100644
index 0000000..bcc283f
--- /dev/null
+++ b/tests/data/construct-custom.code
@@ -0,0 +1,9 @@
+[
+    MyTestClass1(x=1),
+    MyTestClass1(x=1, y=2, z=3),
+    MyTestClass2(x=10),
+    MyTestClass2(x=10, y=20, z=30),
+    MyTestClass3(x=1),
+    MyTestClass3(x=1, y=2, z=3),
+    MyTestClass3(x=1, y=2, z=3),
+]
diff --git a/tests/data/construct-custom.data b/tests/data/construct-custom.data
new file mode 100644
index 0000000..053d028
--- /dev/null
+++ b/tests/data/construct-custom.data
@@ -0,0 +1,23 @@
+---
+- !tag1
+  x: 1
+- !tag1
+  x: 1
+  'y': 2
+  z: 3
+- !tag2
+  10
+- !tag2
+  =: 10
+  'y': 20
+  z: 30
+- !tag3
+  x: 1
+- !tag3
+  x: 1
+  'y': 2
+  z: 3
+- !tag3
+  =: 1
+  'y': 2
+  z: 3
diff --git a/tests/data/construct-float.code b/tests/data/construct-float.code
new file mode 100644
index 0000000..8493bf2
--- /dev/null
+++ b/tests/data/construct-float.code
@@ -0,0 +1,8 @@
+{
+    "canonical": 685230.15,
+    "exponential": 685230.15,
+    "fixed": 685230.15,
+    "sexagesimal": 685230.15,
+    "negative infinity": -1e300000,
+    "not a number": 1e300000/1e300000,
+}
diff --git a/tests/data/construct-float.data b/tests/data/construct-float.data
new file mode 100644
index 0000000..b662c62
--- /dev/null
+++ b/tests/data/construct-float.data
@@ -0,0 +1,6 @@
+canonical: 6.8523015e+5
+exponential: 685.230_15e+03
+fixed: 685_230.15
+sexagesimal: 190:20:30.15
+negative infinity: -.inf
+not a number: .NaN
diff --git a/tests/data/construct-int.code b/tests/data/construct-int.code
new file mode 100644
index 0000000..1058f7b
--- /dev/null
+++ b/tests/data/construct-int.code
@@ -0,0 +1,8 @@
+{
+    "canonical": 685230,
+    "decimal": 685230,
+    "octal": 685230,
+    "hexadecimal": 685230,
+    "binary": 685230,
+    "sexagesimal": 685230,
+}
diff --git a/tests/data/construct-int.data b/tests/data/construct-int.data
new file mode 100644
index 0000000..852c314
--- /dev/null
+++ b/tests/data/construct-int.data
@@ -0,0 +1,6 @@
+canonical: 685230
+decimal: +685_230
+octal: 02472256
+hexadecimal: 0x_0A_74_AE
+binary: 0b1010_0111_0100_1010_1110
+sexagesimal: 190:20:30
diff --git a/tests/data/construct-map.code b/tests/data/construct-map.code
new file mode 100644
index 0000000..736ba48
--- /dev/null
+++ b/tests/data/construct-map.code
@@ -0,0 +1,6 @@
+{
+    "Block style":
+        { "Clark" : "Evans", "Brian" : "Ingerson", "Oren" : "Ben-Kiki" },
+    "Flow style":
+        { "Clark" : "Evans", "Brian" : "Ingerson", "Oren" : "Ben-Kiki" },
+}
diff --git a/tests/data/construct-map.data b/tests/data/construct-map.data
new file mode 100644
index 0000000..022446d
--- /dev/null
+++ b/tests/data/construct-map.data
@@ -0,0 +1,6 @@
+# Unordered set of key: value pairs.
+Block style: !!map
+  Clark : Evans
+  Brian : Ingerson
+  Oren  : Ben-Kiki
+Flow style: !!map { Clark: Evans, Brian: Ingerson, Oren: Ben-Kiki }
diff --git a/tests/data/construct-merge.code b/tests/data/construct-merge.code
new file mode 100644
index 0000000..6cd419d
--- /dev/null
+++ b/tests/data/construct-merge.code
@@ -0,0 +1,10 @@
+[
+    { "x": 1, "y": 2 },
+    { "x": 0, "y": 2 },
+    { "r": 10 },
+    { "r": 1 },
+    { "x": 1, "y": 2, "r": 10, "label": "center/big" },
+    { "x": 1, "y": 2, "r": 10, "label": "center/big" },
+    { "x": 1, "y": 2, "r": 10, "label": "center/big" },
+    { "x": 1, "y": 2, "r": 10, "label": "center/big" },
+]
diff --git a/tests/data/construct-merge.data b/tests/data/construct-merge.data
new file mode 100644
index 0000000..3fdb2e2
--- /dev/null
+++ b/tests/data/construct-merge.data
@@ -0,0 +1,27 @@
+---
+- &CENTER { x: 1, 'y': 2 }
+- &LEFT { x: 0, 'y': 2 }
+- &BIG { r: 10 }
+- &SMALL { r: 1 }
+
+# All the following maps are equal:
+
+- # Explicit keys
+  x: 1
+  'y': 2
+  r: 10
+  label: center/big
+
+- # Merge one map
+  << : *CENTER
+  r: 10
+  label: center/big
+
+- # Merge multiple maps
+  << : [ *CENTER, *BIG ]
+  label: center/big
+
+- # Override
+  << : [ *BIG, *LEFT, *SMALL ]
+  x: 1
+  label: center/big
diff --git a/tests/data/construct-null.code b/tests/data/construct-null.code
new file mode 100644
index 0000000..a895eaa
--- /dev/null
+++ b/tests/data/construct-null.code
@@ -0,0 +1,13 @@
+[
+    None,
+    { "empty": None, "canonical": None, "english": None, None: "null key" },
+    {
+        "sparse": [
+            None,
+            "2nd entry",
+            None,
+            "4th entry",
+            None,
+        ],
+    },
+]
diff --git a/tests/data/construct-null.data b/tests/data/construct-null.data
new file mode 100644
index 0000000..9ad0344
--- /dev/null
+++ b/tests/data/construct-null.data
@@ -0,0 +1,18 @@
+# A document may be null.
+---
+---
+# This mapping has four keys,
+# one has a value.
+empty:
+canonical: ~
+english: null
+~: null key
+---
+# This sequence has five
+# entries, two have values.
+sparse:
+  - ~
+  - 2nd entry
+  -
+  - 4th entry
+  - Null
diff --git a/tests/data/construct-omap.code b/tests/data/construct-omap.code
new file mode 100644
index 0000000..f4cf1b8
--- /dev/null
+++ b/tests/data/construct-omap.code
@@ -0,0 +1,8 @@
+{
+    "Bestiary": [
+        ("aardvark", "African pig-like ant eater. Ugly."),
+        ("anteater", "South-American ant eater. Two species."),
+        ("anaconda", "South-American constrictor snake. Scaly."),
+    ],
+    "Numbers": [ ("one", 1), ("two", 2), ("three", 3) ],
+}
diff --git a/tests/data/construct-omap.data b/tests/data/construct-omap.data
new file mode 100644
index 0000000..4fa0f45
--- /dev/null
+++ b/tests/data/construct-omap.data
@@ -0,0 +1,8 @@
+# Explicitly typed ordered map (dictionary).
+Bestiary: !!omap
+  - aardvark: African pig-like ant eater. Ugly.
+  - anteater: South-American ant eater. Two species.
+  - anaconda: South-American constrictor snake. Scaly.
+  # Etc.
+# Flow style
+Numbers: !!omap [ one: 1, two: 2, three : 3 ]
diff --git a/tests/data/construct-pairs.code b/tests/data/construct-pairs.code
new file mode 100644
index 0000000..64f86ee
--- /dev/null
+++ b/tests/data/construct-pairs.code
@@ -0,0 +1,9 @@
+{
+    "Block tasks": [
+        ("meeting", "with team."),
+        ("meeting", "with boss."),
+        ("break", "lunch."),
+        ("meeting", "with client."),
+    ],
+    "Flow tasks": [ ("meeting", "with team"), ("meeting", "with boss") ],
+}
diff --git a/tests/data/construct-pairs.data b/tests/data/construct-pairs.data
new file mode 100644
index 0000000..05f55b9
--- /dev/null
+++ b/tests/data/construct-pairs.data
@@ -0,0 +1,7 @@
+# Explicitly typed pairs.
+Block tasks: !!pairs
+  - meeting: with team.
+  - meeting: with boss.
+  - break: lunch.
+  - meeting: with client.
+Flow tasks: !!pairs [ meeting: with team, meeting: with boss ]
diff --git a/tests/data/construct-seq.code b/tests/data/construct-seq.code
new file mode 100644
index 0000000..0c90c05
--- /dev/null
+++ b/tests/data/construct-seq.code
@@ -0,0 +1,4 @@
+{
+    "Block style": ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"],
+    "Flow style": ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"],
+}
diff --git a/tests/data/construct-seq.data b/tests/data/construct-seq.data
new file mode 100644
index 0000000..bb92fd1
--- /dev/null
+++ b/tests/data/construct-seq.data
@@ -0,0 +1,15 @@
+# Ordered sequence of nodes
+Block style: !!seq
+- Mercury   # Rotates - no light/dark sides.
+- Venus     # Deadliest. Aptly named.
+- Earth     # Mostly dirt.
+- Mars      # Seems empty.
+- Jupiter   # The king.
+- Saturn    # Pretty.
+- Uranus    # Where the sun hardly shines.
+- Neptune   # Boring. No rings.
+- Pluto     # You call this a planet?
+Flow style: !!seq [ Mercury, Venus, Earth, Mars,      # Rocks
+                    Jupiter, Saturn, Uranus, Neptune, # Gas
+                    Pluto ]                           # Overrated
+
diff --git a/tests/data/construct-set.code b/tests/data/construct-set.code
new file mode 100644
index 0000000..aa090e8
--- /dev/null
+++ b/tests/data/construct-set.code
@@ -0,0 +1,4 @@
+{
+    "baseball players": set(["Mark McGwire", "Sammy Sosa", "Ken Griffey"]),
+    "baseball teams": set(["Boston Red Sox", "Detroit Tigers", "New York Yankees"]),
+}
diff --git a/tests/data/construct-set.data b/tests/data/construct-set.data
new file mode 100644
index 0000000..e05dc88
--- /dev/null
+++ b/tests/data/construct-set.data
@@ -0,0 +1,7 @@
+# Explicitly typed set.
+baseball players: !!set
+  ? Mark McGwire
+  ? Sammy Sosa
+  ? Ken Griffey
+# Flow style
+baseball teams: !!set { Boston Red Sox, Detroit Tigers, New York Yankees }
diff --git a/tests/data/construct-str.code b/tests/data/construct-str.code
new file mode 100644
index 0000000..8d57214
--- /dev/null
+++ b/tests/data/construct-str.code
@@ -0,0 +1 @@
+{ "string": "abcd" }
diff --git a/tests/data/construct-str.data b/tests/data/construct-str.data
new file mode 100644
index 0000000..606ac6b
--- /dev/null
+++ b/tests/data/construct-str.data
@@ -0,0 +1 @@
+string: abcd
diff --git a/tests/data/construct-timestamp.code b/tests/data/construct-timestamp.code
new file mode 100644
index 0000000..288022e
--- /dev/null
+++ b/tests/data/construct-timestamp.code
@@ -0,0 +1,7 @@
+{
+    "canonical": datetime.datetime(2001, 12, 15, 2, 59, 43, 100000),
+    "valid iso8601": datetime.datetime(2001, 12, 15, 2, 59, 43, 100000),
+    "space separated": datetime.datetime(2001, 12, 15, 2, 59, 43, 100000),
+    "no time zone (Z)": datetime.datetime(2001, 12, 15, 2, 59, 43, 100000),
+    "date (00:00:00Z)": datetime.datetime(2002, 12, 14),
+}
diff --git a/tests/data/construct-timestamp.data b/tests/data/construct-timestamp.data
new file mode 100644
index 0000000..c5f3840
--- /dev/null
+++ b/tests/data/construct-timestamp.data
@@ -0,0 +1,5 @@
+canonical:        2001-12-15T02:59:43.1Z
+valid iso8601:    2001-12-14t21:59:43.10-05:00
+space separated:  2001-12-14 21:59:43.10 -5
+no time zone (Z): 2001-12-15 2:59:43.10
+date (00:00:00Z): 2002-12-14
diff --git a/tests/data/construct-value.code b/tests/data/construct-value.code
new file mode 100644
index 0000000..f1f015e
--- /dev/null
+++ b/tests/data/construct-value.code
@@ -0,0 +1,9 @@
+[
+    { "link with": [ "library1.dll", "library2.dll" ] },
+    {
+        "link with": [
+            { "=": "library1.dll", "version": 1.2 },
+            { "=": "library2.dll", "version": 2.3 },
+        ],
+    },
+]
diff --git a/tests/data/construct-value.data b/tests/data/construct-value.data
new file mode 100644
index 0000000..3eb7919
--- /dev/null
+++ b/tests/data/construct-value.data
@@ -0,0 +1,10 @@
+---     # Old schema
+link with:
+  - library1.dll
+  - library2.dll
+---     # New schema
+link with:
+  - = : library1.dll
+    version: 1.2
+  - = : library2.dll
+    version: 2.3
diff --git a/tests/data/duplicate-anchor-1.error-message b/tests/data/duplicate-anchor-1.error-message
new file mode 100644
index 0000000..906cf29
--- /dev/null
+++ b/tests/data/duplicate-anchor-1.error-message
@@ -0,0 +1,3 @@
+- &foo bar
+- &bar bar
+- &foo bar
diff --git a/tests/data/duplicate-anchor-2.error-message b/tests/data/duplicate-anchor-2.error-message
new file mode 100644
index 0000000..62b4389
--- /dev/null
+++ b/tests/data/duplicate-anchor-2.error-message
@@ -0,0 +1 @@
+&foo [1, 2, 3, &foo 4]
diff --git a/tests/data/duplicate-key.error-message b/tests/data/duplicate-key.error-message
new file mode 100644
index 0000000..84deb8f
--- /dev/null
+++ b/tests/data/duplicate-key.error-message
@@ -0,0 +1,3 @@
+---
+foo: bar
+foo: baz
diff --git a/tests/data/duplicate-mapping-key.error-message b/tests/data/duplicate-mapping-key.error-message
new file mode 100644
index 0000000..7e7b4d1
--- /dev/null
+++ b/tests/data/duplicate-mapping-key.error-message
@@ -0,0 +1,6 @@
+---
+&anchor foo:
+    foo: bar
+    *anchor: duplicate key
+    baz: bat
+    *anchor: duplicate key
diff --git a/tests/data/duplicate-merge-key.error-message b/tests/data/duplicate-merge-key.error-message
new file mode 100644
index 0000000..cebc3a1
--- /dev/null
+++ b/tests/data/duplicate-merge-key.error-message
@@ -0,0 +1,4 @@
+---
+<<: {x: 1, y: 2}
+foo: bar
+<<: {z: 3, t: 4}
diff --git a/tests/data/duplicate-tag-directive.error-message b/tests/data/duplicate-tag-directive.error-message
new file mode 100644
index 0000000..50c81a0
--- /dev/null
+++ b/tests/data/duplicate-tag-directive.error-message
@@ -0,0 +1,3 @@
+%TAG    !foo!   bar
+%TAG    !foo!   baz
+--- foo
diff --git a/tests/data/duplicate-value-key.error-message b/tests/data/duplicate-value-key.error-message
new file mode 100644
index 0000000..b34a1d6
--- /dev/null
+++ b/tests/data/duplicate-value-key.error-message
@@ -0,0 +1,4 @@
+---
+=: 1
+foo: bar
+=: 2
diff --git a/tests/data/duplicate-yaml-directive.error-message b/tests/data/duplicate-yaml-directive.error-message
new file mode 100644
index 0000000..9b72390
--- /dev/null
+++ b/tests/data/duplicate-yaml-directive.error-message
@@ -0,0 +1,3 @@
+%YAML   1.1
+%YAML   1.1
+--- foo
diff --git a/tests/data/expected-mapping.error-message b/tests/data/expected-mapping.error-message
new file mode 100644
index 0000000..82aed98
--- /dev/null
+++ b/tests/data/expected-mapping.error-message
@@ -0,0 +1 @@
+--- !!map [not, a, map]
diff --git a/tests/data/expected-scalar.error-message b/tests/data/expected-scalar.error-message
new file mode 100644
index 0000000..7b3171e
--- /dev/null
+++ b/tests/data/expected-scalar.error-message
@@ -0,0 +1 @@
+--- !!str [not a scalar]
diff --git a/tests/data/expected-sequence.error-message b/tests/data/expected-sequence.error-message
new file mode 100644
index 0000000..08074ea
--- /dev/null
+++ b/tests/data/expected-sequence.error-message
@@ -0,0 +1 @@
+--- !!seq {foo, bar, baz}
diff --git a/tests/data/float.data b/tests/data/float.data
new file mode 100644
index 0000000..524d5db
--- /dev/null
+++ b/tests/data/float.data
@@ -0,0 +1,6 @@
+- 6.8523015e+5
+- 685.230_15e+03
+- 685_230.15
+- 190:20:30.15
+- -.inf
+- .NaN
diff --git a/tests/data/float.detect b/tests/data/float.detect
new file mode 100644
index 0000000..1e12343
--- /dev/null
+++ b/tests/data/float.detect
@@ -0,0 +1 @@
+tag:yaml.org,2002:float
diff --git a/tests/data/forbidden-entry.error-message b/tests/data/forbidden-entry.error-message
new file mode 100644
index 0000000..f2e3079
--- /dev/null
+++ b/tests/data/forbidden-entry.error-message
@@ -0,0 +1,2 @@
+test: - foo
+      - bar
diff --git a/tests/data/forbidden-key.error-message b/tests/data/forbidden-key.error-message
new file mode 100644
index 0000000..da9b471
--- /dev/null
+++ b/tests/data/forbidden-key.error-message
@@ -0,0 +1,2 @@
+test: ? foo
+      : bar
diff --git a/tests/data/forbidden-value.error-message b/tests/data/forbidden-value.error-message
new file mode 100644
index 0000000..efd7ce5
--- /dev/null
+++ b/tests/data/forbidden-value.error-message
@@ -0,0 +1 @@
+test: key: value
diff --git a/tests/data/int.data b/tests/data/int.data
new file mode 100644
index 0000000..d44d376
--- /dev/null
+++ b/tests/data/int.data
@@ -0,0 +1,6 @@
+- 685230
+- +685_230
+- 02472256
+- 0x_0A_74_AE
+- 0b1010_0111_0100_1010_1110
+- 190:20:30
diff --git a/tests/data/int.detect b/tests/data/int.detect
new file mode 100644
index 0000000..575c9eb
--- /dev/null
+++ b/tests/data/int.detect
@@ -0,0 +1 @@
+tag:yaml.org,2002:int
diff --git a/tests/data/invalid-anchor-1.error-message b/tests/data/invalid-anchor-1.error-message
new file mode 100644
index 0000000..fcf7d0f
--- /dev/null
+++ b/tests/data/invalid-anchor-1.error-message
@@ -0,0 +1 @@
+--- &?  foo # we allow only ascii and numeric characters in anchor names.
diff --git a/tests/data/invalid-anchor-2.error-message b/tests/data/invalid-anchor-2.error-message
new file mode 100644
index 0000000..bfc4ff0
--- /dev/null
+++ b/tests/data/invalid-anchor-2.error-message
@@ -0,0 +1,8 @@
+---
+- [
+    &correct foo,
+    *correct,
+    *correct]   # still correct
+- *correct: still correct
+- &correct-or-not[foo, bar]
+
diff --git a/tests/data/invalid-base64-data.error-message b/tests/data/invalid-base64-data.error-message
new file mode 100644
index 0000000..798abba
--- /dev/null
+++ b/tests/data/invalid-base64-data.error-message
@@ -0,0 +1,2 @@
+--- !!binary
+    binary data encoded in base64 should be here.
diff --git a/tests/data/invalid-block-scalar-indicator.error-message b/tests/data/invalid-block-scalar-indicator.error-message
new file mode 100644
index 0000000..16a6db1
--- /dev/null
+++ b/tests/data/invalid-block-scalar-indicator.error-message
@@ -0,0 +1,2 @@
+--- > what is this?  # a comment
+data
diff --git a/tests/data/invalid-character.error-message b/tests/data/invalid-character.error-message
new file mode 100644
index 0000000..03687b0
--- /dev/null
+++ b/tests/data/invalid-character.error-message
Binary files differ
diff --git a/tests/data/invalid-character.stream-error b/tests/data/invalid-character.stream-error
new file mode 100644
index 0000000..03687b0
--- /dev/null
+++ b/tests/data/invalid-character.stream-error
Binary files differ
diff --git a/tests/data/invalid-directive-line.error-message b/tests/data/invalid-directive-line.error-message
new file mode 100644
index 0000000..0892eb6
--- /dev/null
+++ b/tests/data/invalid-directive-line.error-message
@@ -0,0 +1,2 @@
+%YAML   1.1 ?   # extra symbol
+---
diff --git a/tests/data/invalid-directive-name-1.error-message b/tests/data/invalid-directive-name-1.error-message
new file mode 100644
index 0000000..153fd88
--- /dev/null
+++ b/tests/data/invalid-directive-name-1.error-message
@@ -0,0 +1,2 @@
+%   # no name at all
+---
diff --git a/tests/data/invalid-directive-name-2.error-message b/tests/data/invalid-directive-name-2.error-message
new file mode 100644
index 0000000..3732a06
--- /dev/null
+++ b/tests/data/invalid-directive-name-2.error-message
@@ -0,0 +1,2 @@
+%invalid-characters:in-directive name
+---
diff --git a/tests/data/invalid-escape-character.error-message b/tests/data/invalid-escape-character.error-message
new file mode 100644
index 0000000..a95ab76
--- /dev/null
+++ b/tests/data/invalid-escape-character.error-message
@@ -0,0 +1 @@
+"some escape characters are \ncorrect, but this one \?\nis not\n"
diff --git a/tests/data/invalid-escape-numbers.error-message b/tests/data/invalid-escape-numbers.error-message
new file mode 100644
index 0000000..614ec9f
--- /dev/null
+++ b/tests/data/invalid-escape-numbers.error-message
@@ -0,0 +1 @@
+"hm.... \u123?"
diff --git a/tests/data/invalid-indentation-for-quoted-scalar.error-message b/tests/data/invalid-indentation-for-quoted-scalar.error-message
new file mode 100644
index 0000000..b885db3
--- /dev/null
+++ b/tests/data/invalid-indentation-for-quoted-scalar.error-message
@@ -0,0 +1,2 @@
+test: "foo
+bar"
diff --git a/tests/data/invalid-indentation-indicator-1.error-message b/tests/data/invalid-indentation-indicator-1.error-message
new file mode 100644
index 0000000..a3cd12f
--- /dev/null
+++ b/tests/data/invalid-indentation-indicator-1.error-message
@@ -0,0 +1,2 @@
+--- >0  # not valid
+data
diff --git a/tests/data/invalid-indentation-indicator-2.error-message b/tests/data/invalid-indentation-indicator-2.error-message
new file mode 100644
index 0000000..eefb6ec
--- /dev/null
+++ b/tests/data/invalid-indentation-indicator-2.error-message
@@ -0,0 +1,2 @@
+--- >-0
+data
diff --git a/tests/data/invalid-merge-1.error-message b/tests/data/invalid-merge-1.error-message
new file mode 100644
index 0000000..fc3c284
--- /dev/null
+++ b/tests/data/invalid-merge-1.error-message
@@ -0,0 +1,2 @@
+foo: bar
+<<: baz
diff --git a/tests/data/invalid-merge-2.error-message b/tests/data/invalid-merge-2.error-message
new file mode 100644
index 0000000..8e88615
--- /dev/null
+++ b/tests/data/invalid-merge-2.error-message
@@ -0,0 +1,2 @@
+foo: bar
+<<: [x: 1, y: 2, z, t: 4]
diff --git a/tests/data/invalid-omap-1.error-message b/tests/data/invalid-omap-1.error-message
new file mode 100644
index 0000000..2863392
--- /dev/null
+++ b/tests/data/invalid-omap-1.error-message
@@ -0,0 +1,3 @@
+--- !!omap
+foo: bar
+baz: bat
diff --git a/tests/data/invalid-omap-2.error-message b/tests/data/invalid-omap-2.error-message
new file mode 100644
index 0000000..c377dfb
--- /dev/null
+++ b/tests/data/invalid-omap-2.error-message
@@ -0,0 +1,3 @@
+--- !!omap
+- foo: bar
+- baz
diff --git a/tests/data/invalid-omap-3.error-message b/tests/data/invalid-omap-3.error-message
new file mode 100644
index 0000000..2a4f50d
--- /dev/null
+++ b/tests/data/invalid-omap-3.error-message
@@ -0,0 +1,4 @@
+--- !!omap
+- foo: bar
+- baz: bar
+  bar: bar
diff --git a/tests/data/invalid-pairs-1.error-message b/tests/data/invalid-pairs-1.error-message
new file mode 100644
index 0000000..42d19ae
--- /dev/null
+++ b/tests/data/invalid-pairs-1.error-message
@@ -0,0 +1,3 @@
+--- !!pairs
+foo: bar
+baz: bat
diff --git a/tests/data/invalid-pairs-2.error-message b/tests/data/invalid-pairs-2.error-message
new file mode 100644
index 0000000..31389ea
--- /dev/null
+++ b/tests/data/invalid-pairs-2.error-message
@@ -0,0 +1,3 @@
+--- !!pairs
+- foo: bar
+- baz
diff --git a/tests/data/invalid-pairs-3.error-message b/tests/data/invalid-pairs-3.error-message
new file mode 100644
index 0000000..f8d7704
--- /dev/null
+++ b/tests/data/invalid-pairs-3.error-message
@@ -0,0 +1,4 @@
+--- !!pairs
+- foo: bar
+- baz: bar
+  bar: bar
diff --git a/tests/data/invalid-simple-key.error-message b/tests/data/invalid-simple-key.error-message
new file mode 100644
index 0000000..a58deec
--- /dev/null
+++ b/tests/data/invalid-simple-key.error-message
@@ -0,0 +1,3 @@
+key: value
+invalid simple key
+next key: next value
diff --git a/tests/data/invalid-starting-character.error-message b/tests/data/invalid-starting-character.error-message
new file mode 100644
index 0000000..bb81c60
--- /dev/null
+++ b/tests/data/invalid-starting-character.error-message
@@ -0,0 +1 @@
+@@@@@@@@@@@@@@@@@@@
diff --git a/tests/data/invalid-tag-1.error-message b/tests/data/invalid-tag-1.error-message
new file mode 100644
index 0000000..a68cd38
--- /dev/null
+++ b/tests/data/invalid-tag-1.error-message
@@ -0,0 +1 @@
+- !<foo#bar> baz
diff --git a/tests/data/invalid-tag-2.error-message b/tests/data/invalid-tag-2.error-message
new file mode 100644
index 0000000..3a36700
--- /dev/null
+++ b/tests/data/invalid-tag-2.error-message
@@ -0,0 +1 @@
+- !prefix!foo#bar baz
diff --git a/tests/data/invalid-tag-directive-handle.error-message b/tests/data/invalid-tag-directive-handle.error-message
new file mode 100644
index 0000000..42b5d7e
--- /dev/null
+++ b/tests/data/invalid-tag-directive-handle.error-message
@@ -0,0 +1,2 @@
+%TAG !!! !!!
+---
diff --git a/tests/data/invalid-tag-directive-prefix.error-message b/tests/data/invalid-tag-directive-prefix.error-message
new file mode 100644
index 0000000..0cb482c
--- /dev/null
+++ b/tests/data/invalid-tag-directive-prefix.error-message
@@ -0,0 +1,2 @@
+%TAG    !   tag:zz.com/foo#bar  # '#' is not allowed in URLs
+---
diff --git a/tests/data/invalid-tag-handle-1.error-message b/tests/data/invalid-tag-handle-1.error-message
new file mode 100644
index 0000000..ef0d143
--- /dev/null
+++ b/tests/data/invalid-tag-handle-1.error-message
@@ -0,0 +1,2 @@
+%TAG    foo bar
+---
diff --git a/tests/data/invalid-tag-handle-2.error-message b/tests/data/invalid-tag-handle-2.error-message
new file mode 100644
index 0000000..06c7f0e
--- /dev/null
+++ b/tests/data/invalid-tag-handle-2.error-message
@@ -0,0 +1,2 @@
+%TAG    !foo    bar
+---
diff --git a/tests/data/invalid-uri-escapes-1.error-message b/tests/data/invalid-uri-escapes-1.error-message
new file mode 100644
index 0000000..a6ecb36
--- /dev/null
+++ b/tests/data/invalid-uri-escapes-1.error-message
@@ -0,0 +1 @@
+--- !<tag:%x?y> foo
diff --git a/tests/data/invalid-uri-escapes-2.error-message b/tests/data/invalid-uri-escapes-2.error-message
new file mode 100644
index 0000000..b89e8f6
--- /dev/null
+++ b/tests/data/invalid-uri-escapes-2.error-message
@@ -0,0 +1 @@
+--- !<%FF> foo
diff --git a/tests/data/invalid-uri-escapes-3.error-message b/tests/data/invalid-uri-escapes-3.error-message
new file mode 100644
index 0000000..f2e4cb8
--- /dev/null
+++ b/tests/data/invalid-uri-escapes-3.error-message
@@ -0,0 +1 @@
+--- !<foo%d0%af%d0%af%d0bar> baz
diff --git a/tests/data/invalid-uri.error-message b/tests/data/invalid-uri.error-message
new file mode 100644
index 0000000..06307e0
--- /dev/null
+++ b/tests/data/invalid-uri.error-message
@@ -0,0 +1 @@
+--- !foo!   bar
diff --git a/tests/data/invalid-utf8-byte.error-message b/tests/data/invalid-utf8-byte.error-message
new file mode 100644
index 0000000..15111c3
--- /dev/null
+++ b/tests/data/invalid-utf8-byte.error-message
@@ -0,0 +1,18 @@
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+Invalid byte ('\xFF'): ÿ <--
+-------------------------------------------------------------------------------------------------------------------------------
diff --git a/tests/data/invalid-utf8-byte.stream-error b/tests/data/invalid-utf8-byte.stream-error
new file mode 100644
index 0000000..15111c3
--- /dev/null
+++ b/tests/data/invalid-utf8-byte.stream-error
@@ -0,0 +1,18 @@
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------
+Invalid byte ('\xFF'): ÿ <--
+-------------------------------------------------------------------------------------------------------------------------------
diff --git a/tests/data/invalid-yaml-directive-version-1.error-message b/tests/data/invalid-yaml-directive-version-1.error-message
new file mode 100644
index 0000000..e9b4e3a
--- /dev/null
+++ b/tests/data/invalid-yaml-directive-version-1.error-message
@@ -0,0 +1,3 @@
+# No version at all.
+%YAML
+---
diff --git a/tests/data/invalid-yaml-directive-version-2.error-message b/tests/data/invalid-yaml-directive-version-2.error-message
new file mode 100644
index 0000000..6aa7740
--- /dev/null
+++ b/tests/data/invalid-yaml-directive-version-2.error-message
@@ -0,0 +1,2 @@
+%YAML   1e-5
+---
diff --git a/tests/data/invalid-yaml-directive-version-3.error-message b/tests/data/invalid-yaml-directive-version-3.error-message
new file mode 100644
index 0000000..345e784
--- /dev/null
+++ b/tests/data/invalid-yaml-directive-version-3.error-message
@@ -0,0 +1,2 @@
+%YAML 1.
+---
diff --git a/tests/data/invalid-yaml-directive-version-4.error-message b/tests/data/invalid-yaml-directive-version-4.error-message
new file mode 100644
index 0000000..b35ca82
--- /dev/null
+++ b/tests/data/invalid-yaml-directive-version-4.error-message
@@ -0,0 +1,2 @@
+%YAML 1.132.435
+---
diff --git a/tests/data/invalid-yaml-directive-version-5.error-message b/tests/data/invalid-yaml-directive-version-5.error-message
new file mode 100644
index 0000000..7c2b49f
--- /dev/null
+++ b/tests/data/invalid-yaml-directive-version-5.error-message
@@ -0,0 +1,2 @@
+%YAML A.0
+---
diff --git a/tests/data/invalid-yaml-directive-version-6.error-message b/tests/data/invalid-yaml-directive-version-6.error-message
new file mode 100644
index 0000000..bae714f
--- /dev/null
+++ b/tests/data/invalid-yaml-directive-version-6.error-message
@@ -0,0 +1,2 @@
+%YAML 123.C
+---
diff --git a/tests/data/invalid-yaml-version.error-message b/tests/data/invalid-yaml-version.error-message
new file mode 100644
index 0000000..dd01948
--- /dev/null
+++ b/tests/data/invalid-yaml-version.error-message
@@ -0,0 +1,2 @@
+%YAML   2.0
+--- foo
diff --git a/tests/data/merge.data b/tests/data/merge.data
new file mode 100644
index 0000000..e455bbc
--- /dev/null
+++ b/tests/data/merge.data
@@ -0,0 +1 @@
+- <<
diff --git a/tests/data/merge.detect b/tests/data/merge.detect
new file mode 100644
index 0000000..1672d0d
--- /dev/null
+++ b/tests/data/merge.detect
@@ -0,0 +1 @@
+tag:yaml.org,2002:merge
diff --git a/tests/data/no-block-collection-end.error-message b/tests/data/no-block-collection-end.error-message
new file mode 100644
index 0000000..02d4d37
--- /dev/null
+++ b/tests/data/no-block-collection-end.error-message
@@ -0,0 +1,3 @@
+- foo
+- bar
+baz: bar
diff --git a/tests/data/no-block-mapping-end.error-message b/tests/data/no-block-mapping-end.error-message
new file mode 100644
index 0000000..1ea921c
--- /dev/null
+++ b/tests/data/no-block-mapping-end.error-message
@@ -0,0 +1 @@
+foo: "bar" "baz"
diff --git a/tests/data/no-document-start.error-message b/tests/data/no-document-start.error-message
new file mode 100644
index 0000000..c725ec8
--- /dev/null
+++ b/tests/data/no-document-start.error-message
@@ -0,0 +1,3 @@
+%YAML   1.1
+# no ---
+foo: bar
diff --git a/tests/data/no-flow-mapping-end.error-message b/tests/data/no-flow-mapping-end.error-message
new file mode 100644
index 0000000..8bd1403
--- /dev/null
+++ b/tests/data/no-flow-mapping-end.error-message
@@ -0,0 +1 @@
+{ foo: bar ]
diff --git a/tests/data/no-flow-sequence-end.error-message b/tests/data/no-flow-sequence-end.error-message
new file mode 100644
index 0000000..750d973
--- /dev/null
+++ b/tests/data/no-flow-sequence-end.error-message
@@ -0,0 +1 @@
+[foo, bar}
diff --git a/tests/data/no-node-1.error-message b/tests/data/no-node-1.error-message
new file mode 100644
index 0000000..07b1500
--- /dev/null
+++ b/tests/data/no-node-1.error-message
@@ -0,0 +1 @@
+- !foo ]
diff --git a/tests/data/no-node-2.error-message b/tests/data/no-node-2.error-message
new file mode 100644
index 0000000..563e3b3
--- /dev/null
+++ b/tests/data/no-node-2.error-message
@@ -0,0 +1 @@
+- [ !foo } ]
diff --git a/tests/data/null.data b/tests/data/null.data
new file mode 100644
index 0000000..ad12528
--- /dev/null
+++ b/tests/data/null.data
@@ -0,0 +1,3 @@
+-
+- ~
+- null
diff --git a/tests/data/null.detect b/tests/data/null.detect
new file mode 100644
index 0000000..19110c7
--- /dev/null
+++ b/tests/data/null.detect
@@ -0,0 +1 @@
+tag:yaml.org,2002:null
diff --git a/tests/data/odd-utf16.stream-error b/tests/data/odd-utf16.stream-error
new file mode 100644
index 0000000..37da060
--- /dev/null
+++ b/tests/data/odd-utf16.stream-error
Binary files differ
diff --git a/tests/data/recursive-anchor.error-message b/tests/data/recursive-anchor.error-message
new file mode 100644
index 0000000..661166c
--- /dev/null
+++ b/tests/data/recursive-anchor.error-message
@@ -0,0 +1,4 @@
+- &foo [1
+    2,
+    3,
+    *foo]
diff --git a/tests/data/scan-line-break-bug.canonical b/tests/data/scan-line-break-bug.canonical
new file mode 100644
index 0000000..79f08b7
--- /dev/null
+++ b/tests/data/scan-line-break-bug.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!!map { ? !!str "foo" : !!str "bar baz" }
diff --git a/tests/data/scan-line-break-bug.data b/tests/data/scan-line-break-bug.data
new file mode 100644
index 0000000..c974fab
--- /dev/null
+++ b/tests/data/scan-line-break-bug.data
@@ -0,0 +1,3 @@
+foo:

+    bar

+    baz

diff --git a/tests/data/spec-02-01.data b/tests/data/spec-02-01.data
new file mode 100644
index 0000000..d12e671
--- /dev/null
+++ b/tests/data/spec-02-01.data
@@ -0,0 +1,3 @@
+- Mark McGwire
+- Sammy Sosa
+- Ken Griffey
diff --git a/tests/data/spec-02-01.structure b/tests/data/spec-02-01.structure
new file mode 100644
index 0000000..f532f4a
--- /dev/null
+++ b/tests/data/spec-02-01.structure
@@ -0,0 +1 @@
+[True, True, True]
diff --git a/tests/data/spec-02-01.tokens b/tests/data/spec-02-01.tokens
new file mode 100644
index 0000000..ce44cac
--- /dev/null
+++ b/tests/data/spec-02-01.tokens
@@ -0,0 +1 @@
+[[ , _ , _ , _ ]}
diff --git a/tests/data/spec-02-02.data b/tests/data/spec-02-02.data
new file mode 100644
index 0000000..7b7ec94
--- /dev/null
+++ b/tests/data/spec-02-02.data
@@ -0,0 +1,3 @@
+hr:  65    # Home runs
+avg: 0.278 # Batting average
+rbi: 147   # Runs Batted In
diff --git a/tests/data/spec-02-02.structure b/tests/data/spec-02-02.structure
new file mode 100644
index 0000000..aba1ced
--- /dev/null
+++ b/tests/data/spec-02-02.structure
@@ -0,0 +1 @@
+[(True, True), (True, True), (True, True)]
diff --git a/tests/data/spec-02-02.tokens b/tests/data/spec-02-02.tokens
new file mode 100644
index 0000000..e4e381b
--- /dev/null
+++ b/tests/data/spec-02-02.tokens
@@ -0,0 +1,5 @@
+{{
+? _ : _
+? _ : _
+? _ : _
+]}
diff --git a/tests/data/spec-02-03.data b/tests/data/spec-02-03.data
new file mode 100644
index 0000000..656d628
--- /dev/null
+++ b/tests/data/spec-02-03.data
@@ -0,0 +1,8 @@
+american:
+  - Boston Red Sox
+  - Detroit Tigers
+  - New York Yankees
+national:
+  - New York Mets
+  - Chicago Cubs
+  - Atlanta Braves
diff --git a/tests/data/spec-02-03.structure b/tests/data/spec-02-03.structure
new file mode 100644
index 0000000..25de5d2
--- /dev/null
+++ b/tests/data/spec-02-03.structure
@@ -0,0 +1 @@
+[(True, [True, True, True]), (True, [True, True, True])]
diff --git a/tests/data/spec-02-03.tokens b/tests/data/spec-02-03.tokens
new file mode 100644
index 0000000..89815f2
--- /dev/null
+++ b/tests/data/spec-02-03.tokens
@@ -0,0 +1,4 @@
+{{
+? _ : [[ , _ , _ , _ ]}
+? _ : [[ , _ , _ , _ ]}
+]}
diff --git a/tests/data/spec-02-04.data b/tests/data/spec-02-04.data
new file mode 100644
index 0000000..430f6b3
--- /dev/null
+++ b/tests/data/spec-02-04.data
@@ -0,0 +1,8 @@
+-
+  name: Mark McGwire
+  hr:   65
+  avg:  0.278
+-
+  name: Sammy Sosa
+  hr:   63
+  avg:  0.288
diff --git a/tests/data/spec-02-04.structure b/tests/data/spec-02-04.structure
new file mode 100644
index 0000000..e7b526c
--- /dev/null
+++ b/tests/data/spec-02-04.structure
@@ -0,0 +1,4 @@
+[
+    [(True, True), (True, True), (True, True)],
+    [(True, True), (True, True), (True, True)],
+]
diff --git a/tests/data/spec-02-04.tokens b/tests/data/spec-02-04.tokens
new file mode 100644
index 0000000..9cb9815
--- /dev/null
+++ b/tests/data/spec-02-04.tokens
@@ -0,0 +1,4 @@
+[[
+, {{ ? _ : _ ? _ : _ ? _ : _ ]}
+, {{ ? _ : _ ? _ : _ ? _ : _ ]}
+]}
diff --git a/tests/data/spec-02-05.data b/tests/data/spec-02-05.data
new file mode 100644
index 0000000..cdd7770
--- /dev/null
+++ b/tests/data/spec-02-05.data
@@ -0,0 +1,3 @@
+- [name        , hr, avg  ]
+- [Mark McGwire, 65, 0.278]
+- [Sammy Sosa  , 63, 0.288]
diff --git a/tests/data/spec-02-05.structure b/tests/data/spec-02-05.structure
new file mode 100644
index 0000000..e06b75a
--- /dev/null
+++ b/tests/data/spec-02-05.structure
@@ -0,0 +1,5 @@
+[
+    [True, True, True],
+    [True, True, True],
+    [True, True, True],
+]
diff --git a/tests/data/spec-02-05.tokens b/tests/data/spec-02-05.tokens
new file mode 100644
index 0000000..3f6f1ab
--- /dev/null
+++ b/tests/data/spec-02-05.tokens
@@ -0,0 +1,5 @@
+[[
+, [ _ , _ , _ ]
+, [ _ , _ , _ ]
+, [ _ , _ , _ ]
+]}
diff --git a/tests/data/spec-02-06.data b/tests/data/spec-02-06.data
new file mode 100644
index 0000000..7a957b2
--- /dev/null
+++ b/tests/data/spec-02-06.data
@@ -0,0 +1,5 @@
+Mark McGwire: {hr: 65, avg: 0.278}
+Sammy Sosa: {
+    hr: 63,
+    avg: 0.288
+  }
diff --git a/tests/data/spec-02-06.structure b/tests/data/spec-02-06.structure
new file mode 100644
index 0000000..3ef0f4b
--- /dev/null
+++ b/tests/data/spec-02-06.structure
@@ -0,0 +1,4 @@
+[
+    (True, [(True, True), (True, True)]),
+    (True, [(True, True), (True, True)]),
+]
diff --git a/tests/data/spec-02-06.tokens b/tests/data/spec-02-06.tokens
new file mode 100644
index 0000000..a1a5eef
--- /dev/null
+++ b/tests/data/spec-02-06.tokens
@@ -0,0 +1,4 @@
+{{
+? _ : { ? _ : _ , ? _ : _ }
+? _ : { ? _ : _ , ? _ : _ }
+]}
diff --git a/tests/data/spec-02-07.data b/tests/data/spec-02-07.data
new file mode 100644
index 0000000..bc711d5
--- /dev/null
+++ b/tests/data/spec-02-07.data
@@ -0,0 +1,10 @@
+# Ranking of 1998 home runs
+---
+- Mark McGwire
+- Sammy Sosa
+- Ken Griffey
+
+# Team ranking
+---
+- Chicago Cubs
+- St Louis Cardinals
diff --git a/tests/data/spec-02-07.structure b/tests/data/spec-02-07.structure
new file mode 100644
index 0000000..c5d72a3
--- /dev/null
+++ b/tests/data/spec-02-07.structure
@@ -0,0 +1,4 @@
+[
+[True, True, True],
+[True, True],
+]
diff --git a/tests/data/spec-02-07.tokens b/tests/data/spec-02-07.tokens
new file mode 100644
index 0000000..ed48883
--- /dev/null
+++ b/tests/data/spec-02-07.tokens
@@ -0,0 +1,12 @@
+---
+[[
+, _
+, _
+, _
+]}
+
+---
+[[
+, _
+, _
+]}
diff --git a/tests/data/spec-02-08.data b/tests/data/spec-02-08.data
new file mode 100644
index 0000000..05e102d
--- /dev/null
+++ b/tests/data/spec-02-08.data
@@ -0,0 +1,10 @@
+---
+time: 20:03:20
+player: Sammy Sosa
+action: strike (miss)
+...
+---
+time: 20:03:47
+player: Sammy Sosa
+action: grand slam
+...
diff --git a/tests/data/spec-02-08.structure b/tests/data/spec-02-08.structure
new file mode 100644
index 0000000..24cff73
--- /dev/null
+++ b/tests/data/spec-02-08.structure
@@ -0,0 +1,4 @@
+[
+[(True, True), (True, True), (True, True)],
+[(True, True), (True, True), (True, True)],
+]
diff --git a/tests/data/spec-02-08.tokens b/tests/data/spec-02-08.tokens
new file mode 100644
index 0000000..7d2c03d
--- /dev/null
+++ b/tests/data/spec-02-08.tokens
@@ -0,0 +1,15 @@
+---
+{{
+? _ : _
+? _ : _
+? _ : _
+]}
+...
+
+---
+{{
+? _ : _
+? _ : _
+? _ : _
+]}
+...
diff --git a/tests/data/spec-02-09.data b/tests/data/spec-02-09.data
new file mode 100644
index 0000000..e264180
--- /dev/null
+++ b/tests/data/spec-02-09.data
@@ -0,0 +1,8 @@
+---
+hr: # 1998 hr ranking
+  - Mark McGwire
+  - Sammy Sosa
+rbi:
+  # 1998 rbi ranking
+  - Sammy Sosa
+  - Ken Griffey
diff --git a/tests/data/spec-02-09.structure b/tests/data/spec-02-09.structure
new file mode 100644
index 0000000..b4c9914
--- /dev/null
+++ b/tests/data/spec-02-09.structure
@@ -0,0 +1 @@
+[(True, [True, True]), (True, [True, True])]
diff --git a/tests/data/spec-02-09.tokens b/tests/data/spec-02-09.tokens
new file mode 100644
index 0000000..b2ec10e
--- /dev/null
+++ b/tests/data/spec-02-09.tokens
@@ -0,0 +1,5 @@
+---
+{{
+? _ : [[ , _ , _ ]}
+? _ : [[ , _ , _ ]}
+]}
diff --git a/tests/data/spec-02-10.data b/tests/data/spec-02-10.data
new file mode 100644
index 0000000..61808f6
--- /dev/null
+++ b/tests/data/spec-02-10.data
@@ -0,0 +1,8 @@
+---
+hr:
+  - Mark McGwire
+  # Following node labeled SS
+  - &SS Sammy Sosa
+rbi:
+  - *SS # Subsequent occurrence
+  - Ken Griffey
diff --git a/tests/data/spec-02-10.structure b/tests/data/spec-02-10.structure
new file mode 100644
index 0000000..ff8f4c3
--- /dev/null
+++ b/tests/data/spec-02-10.structure
@@ -0,0 +1 @@
+[(True, [True, True]), (True, ['*', True])]
diff --git a/tests/data/spec-02-10.tokens b/tests/data/spec-02-10.tokens
new file mode 100644
index 0000000..26caa2b
--- /dev/null
+++ b/tests/data/spec-02-10.tokens
@@ -0,0 +1,5 @@
+---
+{{
+? _ : [[ , _ , & _ ]}
+? _ : [[ , * , _ ]}
+]}
diff --git a/tests/data/spec-02-11.data b/tests/data/spec-02-11.data
new file mode 100644
index 0000000..9123ce2
--- /dev/null
+++ b/tests/data/spec-02-11.data
@@ -0,0 +1,9 @@
+? - Detroit Tigers
+  - Chicago cubs
+:
+  - 2001-07-23
+
+? [ New York Yankees,
+    Atlanta Braves ]
+: [ 2001-07-02, 2001-08-12,
+    2001-08-14 ]
diff --git a/tests/data/spec-02-11.structure b/tests/data/spec-02-11.structure
new file mode 100644
index 0000000..3d8f1ff
--- /dev/null
+++ b/tests/data/spec-02-11.structure
@@ -0,0 +1,4 @@
+[
+([True, True], [True]),
+([True, True], [True, True, True]),
+]
diff --git a/tests/data/spec-02-11.tokens b/tests/data/spec-02-11.tokens
new file mode 100644
index 0000000..fe24203
--- /dev/null
+++ b/tests/data/spec-02-11.tokens
@@ -0,0 +1,6 @@
+{{
+? [[ , _ , _ ]}
+: [[ , _ ]}
+? [ _ , _ ]
+: [ _ , _ , _ ]
+]}
diff --git a/tests/data/spec-02-12.data b/tests/data/spec-02-12.data
new file mode 100644
index 0000000..1fc33f9
--- /dev/null
+++ b/tests/data/spec-02-12.data
@@ -0,0 +1,8 @@
+---
+# products purchased
+- item    : Super Hoop
+  quantity: 1
+- item    : Basketball
+  quantity: 4
+- item    : Big Shoes
+  quantity: 1
diff --git a/tests/data/spec-02-12.structure b/tests/data/spec-02-12.structure
new file mode 100644
index 0000000..e9c5359
--- /dev/null
+++ b/tests/data/spec-02-12.structure
@@ -0,0 +1,5 @@
+[
+[(True, True), (True, True)],
+[(True, True), (True, True)],
+[(True, True), (True, True)],
+]
diff --git a/tests/data/spec-02-12.tokens b/tests/data/spec-02-12.tokens
new file mode 100644
index 0000000..ea21e50
--- /dev/null
+++ b/tests/data/spec-02-12.tokens
@@ -0,0 +1,6 @@
+---
+[[
+, {{ ? _ : _ ? _ : _ ]}
+, {{ ? _ : _ ? _ : _ ]}
+, {{ ? _ : _ ? _ : _ ]}
+]}
diff --git a/tests/data/spec-02-13.data b/tests/data/spec-02-13.data
new file mode 100644
index 0000000..13fb656
--- /dev/null
+++ b/tests/data/spec-02-13.data
@@ -0,0 +1,4 @@
+# ASCII Art
+--- |
+  \//||\/||
+  // ||  ||__
diff --git a/tests/data/spec-02-13.structure b/tests/data/spec-02-13.structure
new file mode 100644
index 0000000..0ca9514
--- /dev/null
+++ b/tests/data/spec-02-13.structure
@@ -0,0 +1 @@
+True
diff --git a/tests/data/spec-02-13.tokens b/tests/data/spec-02-13.tokens
new file mode 100644
index 0000000..7456c05
--- /dev/null
+++ b/tests/data/spec-02-13.tokens
@@ -0,0 +1 @@
+--- _
diff --git a/tests/data/spec-02-14.data b/tests/data/spec-02-14.data
new file mode 100644
index 0000000..59943de
--- /dev/null
+++ b/tests/data/spec-02-14.data
@@ -0,0 +1,4 @@
+---
+  Mark McGwire's
+  year was crippled
+  by a knee injury.
diff --git a/tests/data/spec-02-14.structure b/tests/data/spec-02-14.structure
new file mode 100644
index 0000000..0ca9514
--- /dev/null
+++ b/tests/data/spec-02-14.structure
@@ -0,0 +1 @@
+True
diff --git a/tests/data/spec-02-14.tokens b/tests/data/spec-02-14.tokens
new file mode 100644
index 0000000..7456c05
--- /dev/null
+++ b/tests/data/spec-02-14.tokens
@@ -0,0 +1 @@
+--- _
diff --git a/tests/data/spec-02-15.data b/tests/data/spec-02-15.data
new file mode 100644
index 0000000..80b89a6
--- /dev/null
+++ b/tests/data/spec-02-15.data
@@ -0,0 +1,8 @@
+>
+ Sammy Sosa completed another
+ fine season with great stats.
+
+   63 Home Runs
+   0.288 Batting Average
+
+ What a year!
diff --git a/tests/data/spec-02-15.structure b/tests/data/spec-02-15.structure
new file mode 100644
index 0000000..0ca9514
--- /dev/null
+++ b/tests/data/spec-02-15.structure
@@ -0,0 +1 @@
+True
diff --git a/tests/data/spec-02-15.tokens b/tests/data/spec-02-15.tokens
new file mode 100644
index 0000000..31354ec
--- /dev/null
+++ b/tests/data/spec-02-15.tokens
@@ -0,0 +1 @@
+_
diff --git a/tests/data/spec-02-16.data b/tests/data/spec-02-16.data
new file mode 100644
index 0000000..9f66d88
--- /dev/null
+++ b/tests/data/spec-02-16.data
@@ -0,0 +1,7 @@
+name: Mark McGwire
+accomplishment: >
+  Mark set a major league
+  home run record in 1998.
+stats: |
+  65 Home Runs
+  0.278 Batting Average
diff --git a/tests/data/spec-02-16.structure b/tests/data/spec-02-16.structure
new file mode 100644
index 0000000..aba1ced
--- /dev/null
+++ b/tests/data/spec-02-16.structure
@@ -0,0 +1 @@
+[(True, True), (True, True), (True, True)]
diff --git a/tests/data/spec-02-16.tokens b/tests/data/spec-02-16.tokens
new file mode 100644
index 0000000..e4e381b
--- /dev/null
+++ b/tests/data/spec-02-16.tokens
@@ -0,0 +1,5 @@
+{{
+? _ : _
+? _ : _
+? _ : _
+]}
diff --git a/tests/data/spec-02-17.data b/tests/data/spec-02-17.data
new file mode 100644
index 0000000..b2870c5
--- /dev/null
+++ b/tests/data/spec-02-17.data
@@ -0,0 +1,7 @@
+unicode: "Sosa did fine.\u263A"
+control: "\b1998\t1999\t2000\n"
+hexesc:  "\x13\x10 is \r\n"
+
+single: '"Howdy!" he cried.'
+quoted: ' # not a ''comment''.'
+tie-fighter: '|\-*-/|'
diff --git a/tests/data/spec-02-17.structure b/tests/data/spec-02-17.structure
new file mode 100644
index 0000000..933646d
--- /dev/null
+++ b/tests/data/spec-02-17.structure
@@ -0,0 +1 @@
+[(True, True), (True, True), (True, True), (True, True), (True, True), (True, True)]
diff --git a/tests/data/spec-02-17.tokens b/tests/data/spec-02-17.tokens
new file mode 100644
index 0000000..db65540
--- /dev/null
+++ b/tests/data/spec-02-17.tokens
@@ -0,0 +1,8 @@
+{{
+? _ : _
+? _ : _
+? _ : _
+? _ : _
+? _ : _
+? _ : _
+]}
diff --git a/tests/data/spec-02-18.data b/tests/data/spec-02-18.data
new file mode 100644
index 0000000..e0a8bfa
--- /dev/null
+++ b/tests/data/spec-02-18.data
@@ -0,0 +1,6 @@
+plain:
+  This unquoted scalar
+  spans many lines.
+
+quoted: "So does this
+  quoted scalar.\n"
diff --git a/tests/data/spec-02-18.structure b/tests/data/spec-02-18.structure
new file mode 100644
index 0000000..0ca4991
--- /dev/null
+++ b/tests/data/spec-02-18.structure
@@ -0,0 +1 @@
+[(True, True), (True, True)]
diff --git a/tests/data/spec-02-18.tokens b/tests/data/spec-02-18.tokens
new file mode 100644
index 0000000..83b31dc
--- /dev/null
+++ b/tests/data/spec-02-18.tokens
@@ -0,0 +1,4 @@
+{{
+? _ : _
+? _ : _
+]}
diff --git a/tests/data/spec-02-19.data b/tests/data/spec-02-19.data
new file mode 100644
index 0000000..bf69de6
--- /dev/null
+++ b/tests/data/spec-02-19.data
@@ -0,0 +1,5 @@
+canonical: 12345
+decimal: +12,345
+sexagesimal: 3:25:45
+octal: 014
+hexadecimal: 0xC
diff --git a/tests/data/spec-02-19.structure b/tests/data/spec-02-19.structure
new file mode 100644
index 0000000..48ca99d
--- /dev/null
+++ b/tests/data/spec-02-19.structure
@@ -0,0 +1 @@
+[(True, True), (True, True), (True, True), (True, True), (True, True)]
diff --git a/tests/data/spec-02-19.tokens b/tests/data/spec-02-19.tokens
new file mode 100644
index 0000000..5bda68f
--- /dev/null
+++ b/tests/data/spec-02-19.tokens
@@ -0,0 +1,7 @@
+{{
+? _ : _
+? _ : _
+? _ : _
+? _ : _
+? _ : _
+]}
diff --git a/tests/data/spec-02-20.data b/tests/data/spec-02-20.data
new file mode 100644
index 0000000..1d4897f
--- /dev/null
+++ b/tests/data/spec-02-20.data
@@ -0,0 +1,6 @@
+canonical: 1.23015e+3
+exponential: 12.3015e+02
+sexagesimal: 20:30.15
+fixed: 1,230.15
+negative infinity: -.inf
+not a number: .NaN
diff --git a/tests/data/spec-02-20.structure b/tests/data/spec-02-20.structure
new file mode 100644
index 0000000..933646d
--- /dev/null
+++ b/tests/data/spec-02-20.structure
@@ -0,0 +1 @@
+[(True, True), (True, True), (True, True), (True, True), (True, True), (True, True)]
diff --git a/tests/data/spec-02-20.tokens b/tests/data/spec-02-20.tokens
new file mode 100644
index 0000000..db65540
--- /dev/null
+++ b/tests/data/spec-02-20.tokens
@@ -0,0 +1,8 @@
+{{
+? _ : _
+? _ : _
+? _ : _
+? _ : _
+? _ : _
+? _ : _
+]}
diff --git a/tests/data/spec-02-21.data b/tests/data/spec-02-21.data
new file mode 100644
index 0000000..dec6a56
--- /dev/null
+++ b/tests/data/spec-02-21.data
@@ -0,0 +1,4 @@
+null: ~
+true: y
+false: n
+string: '12345'
diff --git a/tests/data/spec-02-21.structure b/tests/data/spec-02-21.structure
new file mode 100644
index 0000000..021635f
--- /dev/null
+++ b/tests/data/spec-02-21.structure
@@ -0,0 +1 @@
+[(True, True), (True, True), (True, True), (True, True)]
diff --git a/tests/data/spec-02-21.tokens b/tests/data/spec-02-21.tokens
new file mode 100644
index 0000000..aeccbaf
--- /dev/null
+++ b/tests/data/spec-02-21.tokens
@@ -0,0 +1,6 @@
+{{
+? _ : _
+? _ : _
+? _ : _
+? _ : _
+]}
diff --git a/tests/data/spec-02-22.data b/tests/data/spec-02-22.data
new file mode 100644
index 0000000..aaac185
--- /dev/null
+++ b/tests/data/spec-02-22.data
@@ -0,0 +1,4 @@
+canonical: 2001-12-15T02:59:43.1Z
+iso8601: 2001-12-14t21:59:43.10-05:00
+spaced: 2001-12-14 21:59:43.10 -5
+date: 2002-12-14
diff --git a/tests/data/spec-02-22.structure b/tests/data/spec-02-22.structure
new file mode 100644
index 0000000..021635f
--- /dev/null
+++ b/tests/data/spec-02-22.structure
@@ -0,0 +1 @@
+[(True, True), (True, True), (True, True), (True, True)]
diff --git a/tests/data/spec-02-22.tokens b/tests/data/spec-02-22.tokens
new file mode 100644
index 0000000..aeccbaf
--- /dev/null
+++ b/tests/data/spec-02-22.tokens
@@ -0,0 +1,6 @@
+{{
+? _ : _
+? _ : _
+? _ : _
+? _ : _
+]}
diff --git a/tests/data/spec-02-23.data b/tests/data/spec-02-23.data
new file mode 100644
index 0000000..5dbd992
--- /dev/null
+++ b/tests/data/spec-02-23.data
@@ -0,0 +1,13 @@
+---
+not-date: !!str 2002-04-28
+
+picture: !!binary |
+ R0lGODlhDAAMAIQAAP//9/X
+ 17unp5WZmZgAAAOfn515eXv
+ Pz7Y6OjuDg4J+fn5OTk6enp
+ 56enmleECcgggoBADs=
+
+application specific tag: !something |
+ The semantics of the tag
+ above may be different for
+ different documents.
diff --git a/tests/data/spec-02-23.structure b/tests/data/spec-02-23.structure
new file mode 100644
index 0000000..aba1ced
--- /dev/null
+++ b/tests/data/spec-02-23.structure
@@ -0,0 +1 @@
+[(True, True), (True, True), (True, True)]
diff --git a/tests/data/spec-02-23.tokens b/tests/data/spec-02-23.tokens
new file mode 100644
index 0000000..9ac54aa
--- /dev/null
+++ b/tests/data/spec-02-23.tokens
@@ -0,0 +1,6 @@
+---
+{{
+? _ : ! _
+? _ : ! _
+? _ : ! _
+]}
diff --git a/tests/data/spec-02-24.data b/tests/data/spec-02-24.data
new file mode 100644
index 0000000..1180757
--- /dev/null
+++ b/tests/data/spec-02-24.data
@@ -0,0 +1,14 @@
+%TAG ! tag:clarkevans.com,2002:
+--- !shape
+  # Use the ! handle for presenting
+  # tag:clarkevans.com,2002:circle
+- !circle
+  center: &ORIGIN {x: 73, y: 129}
+  radius: 7
+- !line
+  start: *ORIGIN
+  finish: { x: 89, y: 102 }
+- !label
+  start: *ORIGIN
+  color: 0xFFEEBB
+  text: Pretty vector drawing.
diff --git a/tests/data/spec-02-24.structure b/tests/data/spec-02-24.structure
new file mode 100644
index 0000000..a800729
--- /dev/null
+++ b/tests/data/spec-02-24.structure
@@ -0,0 +1,5 @@
+[
+[(True, [(True, True), (True, True)]), (True, True)],
+[(True, '*'), (True, [(True, True), (True, True)])],
+[(True, '*'), (True, True), (True, True)],
+]
diff --git a/tests/data/spec-02-24.tokens b/tests/data/spec-02-24.tokens
new file mode 100644
index 0000000..039c385
--- /dev/null
+++ b/tests/data/spec-02-24.tokens
@@ -0,0 +1,20 @@
+%
+--- !
+[[
+, !
+    {{
+    ? _ : & { ? _ : _ , ? _ : _ }
+    ? _ : _
+    ]}
+, !
+    {{
+    ? _ : *
+    ? _ : { ? _ : _ , ? _ : _ }
+    ]}
+, !
+    {{
+    ? _ : *
+    ? _ : _
+    ? _ : _
+    ]}
+]}
diff --git a/tests/data/spec-02-25.data b/tests/data/spec-02-25.data
new file mode 100644
index 0000000..769ac31
--- /dev/null
+++ b/tests/data/spec-02-25.data
@@ -0,0 +1,7 @@
+# sets are represented as a
+# mapping where each key is
+# associated with the empty string
+--- !!set
+? Mark McGwire
+? Sammy Sosa
+? Ken Griff
diff --git a/tests/data/spec-02-25.structure b/tests/data/spec-02-25.structure
new file mode 100644
index 0000000..0b40e61
--- /dev/null
+++ b/tests/data/spec-02-25.structure
@@ -0,0 +1 @@
+[(True, None), (True, None), (True, None)]
diff --git a/tests/data/spec-02-25.tokens b/tests/data/spec-02-25.tokens
new file mode 100644
index 0000000..b700236
--- /dev/null
+++ b/tests/data/spec-02-25.tokens
@@ -0,0 +1,6 @@
+--- !
+{{
+? _
+? _
+? _
+]}
diff --git a/tests/data/spec-02-26.data b/tests/data/spec-02-26.data
new file mode 100644
index 0000000..3143763
--- /dev/null
+++ b/tests/data/spec-02-26.data
@@ -0,0 +1,7 @@
+# ordered maps are represented as
+# a sequence of mappings, with
+# each mapping having one key
+--- !!omap
+- Mark McGwire: 65
+- Sammy Sosa: 63
+- Ken Griffy: 58
diff --git a/tests/data/spec-02-26.structure b/tests/data/spec-02-26.structure
new file mode 100644
index 0000000..cf429b9
--- /dev/null
+++ b/tests/data/spec-02-26.structure
@@ -0,0 +1,5 @@
+[
+[(True, True)],
+[(True, True)],
+[(True, True)],
+]
diff --git a/tests/data/spec-02-26.tokens b/tests/data/spec-02-26.tokens
new file mode 100644
index 0000000..7bee492
--- /dev/null
+++ b/tests/data/spec-02-26.tokens
@@ -0,0 +1,6 @@
+--- !
+[[
+, {{ ? _ : _ ]}
+, {{ ? _ : _ ]}
+, {{ ? _ : _ ]}
+]}
diff --git a/tests/data/spec-02-27.data b/tests/data/spec-02-27.data
new file mode 100644
index 0000000..4625739
--- /dev/null
+++ b/tests/data/spec-02-27.data
@@ -0,0 +1,29 @@
+--- !<tag:clarkevans.com,2002:invoice>
+invoice: 34843
+date   : 2001-01-23
+bill-to: &id001
+    given  : Chris
+    family : Dumars
+    address:
+        lines: |
+            458 Walkman Dr.
+            Suite #292
+        city    : Royal Oak
+        state   : MI
+        postal  : 48046
+ship-to: *id001
+product:
+    - sku         : BL394D
+      quantity    : 4
+      description : Basketball
+      price       : 450.00
+    - sku         : BL4438H
+      quantity    : 1
+      description : Super Hoop
+      price       : 2392.00
+tax  : 251.42
+total: 4443.52
+comments:
+    Late afternoon is best.
+    Backup contact is Nancy
+    Billsmer @ 338-4338.
diff --git a/tests/data/spec-02-27.structure b/tests/data/spec-02-27.structure
new file mode 100644
index 0000000..a2113b9
--- /dev/null
+++ b/tests/data/spec-02-27.structure
@@ -0,0 +1,17 @@
+[
+(True, True),
+(True, True),
+(True, [
+    (True, True),
+    (True, True),
+    (True, [(True, True), (True, True), (True, True), (True, True)]),
+    ]),
+(True, '*'),
+(True, [
+        [(True, True), (True, True), (True, True), (True, True)],
+        [(True, True), (True, True), (True, True), (True, True)],
+    ]),
+(True, True),
+(True, True),
+(True, True),
+]
diff --git a/tests/data/spec-02-27.tokens b/tests/data/spec-02-27.tokens
new file mode 100644
index 0000000..2dc1c25
--- /dev/null
+++ b/tests/data/spec-02-27.tokens
@@ -0,0 +1,20 @@
+--- !
+{{
+? _ : _
+? _ : _
+? _ : &
+    {{
+    ? _ : _
+    ? _ : _
+    ? _ : {{ ? _ : _ ? _ : _ ? _ : _ ? _ : _ ]}
+    ]}
+? _ : *
+? _ :
+    [[
+    , {{ ? _ : _ ? _ : _ ? _ : _ ? _ : _ ]}
+    , {{ ? _ : _ ? _ : _ ? _ : _ ? _ : _ ]}
+    ]}
+? _ : _
+? _ : _
+? _ : _
+]}
diff --git a/tests/data/spec-02-28.data b/tests/data/spec-02-28.data
new file mode 100644
index 0000000..a5c8dc8
--- /dev/null
+++ b/tests/data/spec-02-28.data
@@ -0,0 +1,26 @@
+---
+Time: 2001-11-23 15:01:42 -5
+User: ed
+Warning:
+  This is an error message
+  for the log file
+---
+Time: 2001-11-23 15:02:31 -5
+User: ed
+Warning:
+  A slightly different error
+  message.
+---
+Date: 2001-11-23 15:03:17 -5
+User: ed
+Fatal:
+  Unknown variable "bar"
+Stack:
+  - file: TopClass.py
+    line: 23
+    code: |
+      x = MoreObject("345\n")
+  - file: MoreClass.py
+    line: 58
+    code: |-
+      foo = bar
diff --git a/tests/data/spec-02-28.structure b/tests/data/spec-02-28.structure
new file mode 100644
index 0000000..8ec0b56
--- /dev/null
+++ b/tests/data/spec-02-28.structure
@@ -0,0 +1,10 @@
+[
+[(True, True), (True, True), (True, True)],
+[(True, True), (True, True), (True, True)],
+[(True, True), (True, True), (True, True),
+(True, [
+    [(True, True), (True, True), (True, True)],
+    [(True, True), (True, True), (True, True)],
+    ]),
+]
+]
diff --git a/tests/data/spec-02-28.tokens b/tests/data/spec-02-28.tokens
new file mode 100644
index 0000000..8d5e1bc
--- /dev/null
+++ b/tests/data/spec-02-28.tokens
@@ -0,0 +1,23 @@
+---
+{{
+? _ : _
+? _ : _
+? _ : _
+]}
+---
+{{
+? _ : _
+? _ : _
+? _ : _
+]}
+---
+{{
+? _ : _
+? _ : _
+? _ : _
+? _ :
+    [[
+        , {{ ? _ : _ ? _ : _ ? _ : _ ]}
+        , {{ ? _ : _ ? _ : _ ? _ : _ ]}
+    ]}
+]}
diff --git a/tests/data/spec-05-01-utf16be.data b/tests/data/spec-05-01-utf16be.data
new file mode 100644
index 0000000..3525062
--- /dev/null
+++ b/tests/data/spec-05-01-utf16be.data
Binary files differ
diff --git a/tests/data/spec-05-01-utf16be.empty b/tests/data/spec-05-01-utf16be.empty
new file mode 100644
index 0000000..bfffa8b
--- /dev/null
+++ b/tests/data/spec-05-01-utf16be.empty
@@ -0,0 +1,2 @@
+# This stream contains no
+# documents, only comments.
diff --git a/tests/data/spec-05-01-utf16le.data b/tests/data/spec-05-01-utf16le.data
new file mode 100644
index 0000000..0823f74
--- /dev/null
+++ b/tests/data/spec-05-01-utf16le.data
Binary files differ
diff --git a/tests/data/spec-05-01-utf16le.empty b/tests/data/spec-05-01-utf16le.empty
new file mode 100644
index 0000000..bfffa8b
--- /dev/null
+++ b/tests/data/spec-05-01-utf16le.empty
@@ -0,0 +1,2 @@
+# This stream contains no
+# documents, only comments.
diff --git a/tests/data/spec-05-01-utf8.data b/tests/data/spec-05-01-utf8.data
new file mode 100644
index 0000000..780d25b
--- /dev/null
+++ b/tests/data/spec-05-01-utf8.data
@@ -0,0 +1 @@
+# Comment only.
diff --git a/tests/data/spec-05-01-utf8.empty b/tests/data/spec-05-01-utf8.empty
new file mode 100644
index 0000000..bfffa8b
--- /dev/null
+++ b/tests/data/spec-05-01-utf8.empty
@@ -0,0 +1,2 @@
+# This stream contains no
+# documents, only comments.
diff --git a/tests/data/spec-05-02-utf16be.data b/tests/data/spec-05-02-utf16be.data
new file mode 100644
index 0000000..5ebbb04
--- /dev/null
+++ b/tests/data/spec-05-02-utf16be.data
Binary files differ
diff --git a/tests/data/spec-05-02-utf16be.error b/tests/data/spec-05-02-utf16be.error
new file mode 100644
index 0000000..1df3616
--- /dev/null
+++ b/tests/data/spec-05-02-utf16be.error
@@ -0,0 +1,3 @@
+ERROR:
+ A BOM must not appear
+ inside a document.
diff --git a/tests/data/spec-05-02-utf16le.data b/tests/data/spec-05-02-utf16le.data
new file mode 100644
index 0000000..0cd90a2
--- /dev/null
+++ b/tests/data/spec-05-02-utf16le.data
Binary files differ
diff --git a/tests/data/spec-05-02-utf16le.error b/tests/data/spec-05-02-utf16le.error
new file mode 100644
index 0000000..1df3616
--- /dev/null
+++ b/tests/data/spec-05-02-utf16le.error
@@ -0,0 +1,3 @@
+ERROR:
+ A BOM must not appear
+ inside a document.
diff --git a/tests/data/spec-05-02-utf8.data b/tests/data/spec-05-02-utf8.data
new file mode 100644
index 0000000..fb74866
--- /dev/null
+++ b/tests/data/spec-05-02-utf8.data
@@ -0,0 +1,3 @@
+# Invalid use of BOM
+# inside a
+# document.
diff --git a/tests/data/spec-05-02-utf8.error b/tests/data/spec-05-02-utf8.error
new file mode 100644
index 0000000..1df3616
--- /dev/null
+++ b/tests/data/spec-05-02-utf8.error
@@ -0,0 +1,3 @@
+ERROR:
+ A BOM must not appear
+ inside a document.
diff --git a/tests/data/spec-05-03.canonical b/tests/data/spec-05-03.canonical
new file mode 100644
index 0000000..a143a73
--- /dev/null
+++ b/tests/data/spec-05-03.canonical
@@ -0,0 +1,14 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "sequence"
+  : !!seq [
+    !!str "one", !!str "two"
+  ],
+  ? !!str "mapping"
+  : !!map {
+    ? !!str "sky" : !!str "blue",
+#    ? !!str "sea" : !!str "green",
+    ? !!map { ? !!str "sea" : !!str "green" } : !!null "",
+  }
+}
diff --git a/tests/data/spec-05-03.data b/tests/data/spec-05-03.data
new file mode 100644
index 0000000..4661f33
--- /dev/null
+++ b/tests/data/spec-05-03.data
@@ -0,0 +1,7 @@
+sequence:
+- one
+- two
+mapping:
+  ? sky
+  : blue
+  ? sea : green
diff --git a/tests/data/spec-05-04.canonical b/tests/data/spec-05-04.canonical
new file mode 100644
index 0000000..00c9723
--- /dev/null
+++ b/tests/data/spec-05-04.canonical
@@ -0,0 +1,13 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "sequence"
+  : !!seq [
+    !!str "one", !!str "two"
+  ],
+  ? !!str "mapping"
+  : !!map {
+    ? !!str "sky" : !!str "blue",
+    ? !!str "sea" : !!str "green",
+  }
+}
diff --git a/tests/data/spec-05-04.data b/tests/data/spec-05-04.data
new file mode 100644
index 0000000..df33847
--- /dev/null
+++ b/tests/data/spec-05-04.data
@@ -0,0 +1,2 @@
+sequence: [ one, two, ]
+mapping: { sky: blue, sea: green }
diff --git a/tests/data/spec-05-05.data b/tests/data/spec-05-05.data
new file mode 100644
index 0000000..62524c0
--- /dev/null
+++ b/tests/data/spec-05-05.data
@@ -0,0 +1 @@
+# Comment only.
diff --git a/tests/data/spec-05-05.empty b/tests/data/spec-05-05.empty
new file mode 100644
index 0000000..bfffa8b
--- /dev/null
+++ b/tests/data/spec-05-05.empty
@@ -0,0 +1,2 @@
+# This stream contains no
+# documents, only comments.
diff --git a/tests/data/spec-05-06.canonical b/tests/data/spec-05-06.canonical
new file mode 100644
index 0000000..4f30c11
--- /dev/null
+++ b/tests/data/spec-05-06.canonical
@@ -0,0 +1,8 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "anchored"
+  : &A1 !local "value",
+  ? !!str "alias"
+  : *A1,
+}
diff --git a/tests/data/spec-05-06.data b/tests/data/spec-05-06.data
new file mode 100644
index 0000000..7a1f9b3
--- /dev/null
+++ b/tests/data/spec-05-06.data
@@ -0,0 +1,2 @@
+anchored: !local &anchor value
+alias: *anchor
diff --git a/tests/data/spec-05-07.canonical b/tests/data/spec-05-07.canonical
new file mode 100644
index 0000000..dc3732a
--- /dev/null
+++ b/tests/data/spec-05-07.canonical
@@ -0,0 +1,8 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "literal"
+  : !!str "text\n",
+  ? !!str "folded"
+  : !!str "text\n",
+}
diff --git a/tests/data/spec-05-07.data b/tests/data/spec-05-07.data
new file mode 100644
index 0000000..97eb3a3
--- /dev/null
+++ b/tests/data/spec-05-07.data
@@ -0,0 +1,4 @@
+literal: |
+  text
+folded: >
+  text
diff --git a/tests/data/spec-05-08.canonical b/tests/data/spec-05-08.canonical
new file mode 100644
index 0000000..610bd68
--- /dev/null
+++ b/tests/data/spec-05-08.canonical
@@ -0,0 +1,8 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "single"
+  : !!str "text",
+  ? !!str "double"
+  : !!str "text",
+}
diff --git a/tests/data/spec-05-08.data b/tests/data/spec-05-08.data
new file mode 100644
index 0000000..04ebf69
--- /dev/null
+++ b/tests/data/spec-05-08.data
@@ -0,0 +1,2 @@
+single: 'text'
+double: "text"
diff --git a/tests/data/spec-05-09.canonical b/tests/data/spec-05-09.canonical
new file mode 100644
index 0000000..597e3de
--- /dev/null
+++ b/tests/data/spec-05-09.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!!str "text"
diff --git a/tests/data/spec-05-09.data b/tests/data/spec-05-09.data
new file mode 100644
index 0000000..a43431b
--- /dev/null
+++ b/tests/data/spec-05-09.data
@@ -0,0 +1,2 @@
+%YAML 1.1
+--- text
diff --git a/tests/data/spec-05-10.data b/tests/data/spec-05-10.data
new file mode 100644
index 0000000..a4caf91
--- /dev/null
+++ b/tests/data/spec-05-10.data
@@ -0,0 +1,2 @@
+commercial-at: @text
+grave-accent: `text
diff --git a/tests/data/spec-05-10.error b/tests/data/spec-05-10.error
new file mode 100644
index 0000000..46f776e
--- /dev/null
+++ b/tests/data/spec-05-10.error
@@ -0,0 +1,3 @@
+ERROR:
+ Reserved indicators can't
+ start a plain scalar.
diff --git a/tests/data/spec-05-11.canonical b/tests/data/spec-05-11.canonical
new file mode 100644
index 0000000..fc25bef
--- /dev/null
+++ b/tests/data/spec-05-11.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+--- !!str
+"Generic line break (no glyph)\n\
+ Generic line break (glyphed)\n\
+ Line separator\u2028\
+ Paragraph separator\u2029"
diff --git a/tests/data/spec-05-11.data b/tests/data/spec-05-11.data
new file mode 100644
index 0000000..b448b75
--- /dev/null
+++ b/tests/data/spec-05-11.data
@@ -0,0 +1,3 @@
+|
+  Generic line break (no glyph)
+  Generic line break (glyphed)…  Line separator
  Paragraph separator

\ No newline at end of file
diff --git a/tests/data/spec-05-12.data b/tests/data/spec-05-12.data
new file mode 100644
index 0000000..7c3ad7f
--- /dev/null
+++ b/tests/data/spec-05-12.data
@@ -0,0 +1,9 @@
+# Tabs do's and don'ts:
+# comment: 	
+quoted: "Quoted		"
+block: |
+  void main() {
+  	printf("Hello, world!\n");
+  }
+elsewhere:	# separation
+	indentation, in	plain scalar
diff --git a/tests/data/spec-05-12.error b/tests/data/spec-05-12.error
new file mode 100644
index 0000000..8aad4c8
--- /dev/null
+++ b/tests/data/spec-05-12.error
@@ -0,0 +1,8 @@
+ERROR:
+ Tabs may appear inside
+ comments and quoted or
+ block scalar content.
+ Tabs must not appear
+ elsewhere, such as
+ in indentation and
+ separation spaces.
diff --git a/tests/data/spec-05-13.canonical b/tests/data/spec-05-13.canonical
new file mode 100644
index 0000000..90c1c5c
--- /dev/null
+++ b/tests/data/spec-05-13.canonical
@@ -0,0 +1,5 @@
+%YAML 1.1
+--- !!str
+"Text containing \
+ both space and \
+ tab	characters"
diff --git a/tests/data/spec-05-13.data b/tests/data/spec-05-13.data
new file mode 100644
index 0000000..fce7951
--- /dev/null
+++ b/tests/data/spec-05-13.data
@@ -0,0 +1,3 @@
+  "Text containing   
+  both space and	
+  	tab	characters"
diff --git a/tests/data/spec-05-14.canonical b/tests/data/spec-05-14.canonical
new file mode 100644
index 0000000..4bff01c
--- /dev/null
+++ b/tests/data/spec-05-14.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+"Fun with \x5C
+ \x22 \x07 \x08 \x1B \x0C
+ \x0A \x0D \x09 \x0B \x00
+ \x20 \xA0 \x85 \u2028 \u2029
+ A A A"
diff --git a/tests/data/spec-05-14.data b/tests/data/spec-05-14.data
new file mode 100644
index 0000000..d6e8ce4
--- /dev/null
+++ b/tests/data/spec-05-14.data
@@ -0,0 +1,2 @@
+"Fun with \\
+ \" \a \b \e \f \… \n \r \t \v \0 \
 \  \_ \N \L \P \
 \x41 \u0041 \U00000041"
diff --git a/tests/data/spec-05-15.data b/tests/data/spec-05-15.data
new file mode 100644
index 0000000..7bf12b6
--- /dev/null
+++ b/tests/data/spec-05-15.data
@@ -0,0 +1,3 @@
+Bad escapes:
+  "\c
+  \xq-"
diff --git a/tests/data/spec-05-15.error b/tests/data/spec-05-15.error
new file mode 100644
index 0000000..71ffbd9
--- /dev/null
+++ b/tests/data/spec-05-15.error
@@ -0,0 +1,3 @@
+ERROR:
+- c is an invalid escaped character.
+- q and - are invalid hex digits.
diff --git a/tests/data/spec-06-01.canonical b/tests/data/spec-06-01.canonical
new file mode 100644
index 0000000..f17ec92
--- /dev/null
+++ b/tests/data/spec-06-01.canonical
@@ -0,0 +1,15 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "Not indented"
+  : !!map {
+      ? !!str "By one space"
+      : !!str "By four\n  spaces\n",
+      ? !!str "Flow style"
+      : !!seq [
+          !!str "By two",
+          !!str "Also by two",
+          !!str "Still by two",
+        ]
+    }
+}
diff --git a/tests/data/spec-06-01.data b/tests/data/spec-06-01.data
new file mode 100644
index 0000000..6134ba1
--- /dev/null
+++ b/tests/data/spec-06-01.data
@@ -0,0 +1,14 @@
+  # Leading comment line spaces are
+   # neither content nor indentation.
+    
+Not indented:
+ By one space: |
+    By four
+      spaces
+ Flow style: [    # Leading spaces
+   By two,        # in flow style
+  Also by two,    # are neither
+# Tabs are not allowed:
+#  	Still by two   # content nor
+    Still by two   # content nor
+    ]             # indentation.
diff --git a/tests/data/spec-06-02.data b/tests/data/spec-06-02.data
new file mode 100644
index 0000000..ff741e5
--- /dev/null
+++ b/tests/data/spec-06-02.data
@@ -0,0 +1,3 @@
+  # Comment
+   
+
diff --git a/tests/data/spec-06-02.empty b/tests/data/spec-06-02.empty
new file mode 100644
index 0000000..bfffa8b
--- /dev/null
+++ b/tests/data/spec-06-02.empty
@@ -0,0 +1,2 @@
+# This stream contains no
+# documents, only comments.
diff --git a/tests/data/spec-06-03.canonical b/tests/data/spec-06-03.canonical
new file mode 100644
index 0000000..ec26902
--- /dev/null
+++ b/tests/data/spec-06-03.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "key"
+  : !!str "value"
+}
diff --git a/tests/data/spec-06-03.data b/tests/data/spec-06-03.data
new file mode 100644
index 0000000..9db0912
--- /dev/null
+++ b/tests/data/spec-06-03.data
@@ -0,0 +1,2 @@
+key:    # Comment
+  value
diff --git a/tests/data/spec-06-04.canonical b/tests/data/spec-06-04.canonical
new file mode 100644
index 0000000..ec26902
--- /dev/null
+++ b/tests/data/spec-06-04.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "key"
+  : !!str "value"
+}
diff --git a/tests/data/spec-06-04.data b/tests/data/spec-06-04.data
new file mode 100644
index 0000000..86308dd
--- /dev/null
+++ b/tests/data/spec-06-04.data
@@ -0,0 +1,4 @@
+key:    # Comment
+        # lines
+  value
+
diff --git a/tests/data/spec-06-05.canonical b/tests/data/spec-06-05.canonical
new file mode 100644
index 0000000..8da431d
--- /dev/null
+++ b/tests/data/spec-06-05.canonical
@@ -0,0 +1,16 @@
+%YAML 1.1
+---
+!!map {
+  ? !!map {
+    ? !!str "first"
+    : !!str "Sammy",
+    ? !!str "last"
+    : !!str "Sosa"
+  }
+  : !!map {
+    ? !!str "hr"
+    : !!int "65",
+    ? !!str "avg"
+    : !!float "0.278"
+  }
+}
diff --git a/tests/data/spec-06-05.data b/tests/data/spec-06-05.data
new file mode 100644
index 0000000..37613f5
--- /dev/null
+++ b/tests/data/spec-06-05.data
@@ -0,0 +1,6 @@
+{ first: Sammy, last: Sosa }:
+# Statistics:
+  hr:  # Home runs
+    65
+  avg: # Average
+    0.278
diff --git a/tests/data/spec-06-06.canonical b/tests/data/spec-06-06.canonical
new file mode 100644
index 0000000..513d07a
--- /dev/null
+++ b/tests/data/spec-06-06.canonical
@@ -0,0 +1,10 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "plain"
+  : !!str "text lines",
+  ? !!str "quoted"
+  : !!str "text lines",
+  ? !!str "block"
+  : !!str "text\n 	lines\n"
+}
diff --git a/tests/data/spec-06-06.data b/tests/data/spec-06-06.data
new file mode 100644
index 0000000..2f62d08
--- /dev/null
+++ b/tests/data/spec-06-06.data
@@ -0,0 +1,7 @@
+plain: text
+  lines
+quoted: "text
+  	lines"
+block: |
+  text
+   	lines
diff --git a/tests/data/spec-06-07.canonical b/tests/data/spec-06-07.canonical
new file mode 100644
index 0000000..11357e4
--- /dev/null
+++ b/tests/data/spec-06-07.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!seq [
+  !!str "foo\nbar",
+  !!str "foo\n\nbar"
+]
diff --git a/tests/data/spec-06-07.data b/tests/data/spec-06-07.data
new file mode 100644
index 0000000..130cfa7
--- /dev/null
+++ b/tests/data/spec-06-07.data
@@ -0,0 +1,8 @@
+- foo
+ 
+  bar
+- |-
+  foo
+ 
+  bar
+  
diff --git a/tests/data/spec-06-08.canonical b/tests/data/spec-06-08.canonical
new file mode 100644
index 0000000..cc72bc8
--- /dev/null
+++ b/tests/data/spec-06-08.canonical
@@ -0,0 +1,5 @@
+%YAML 1.1
+--- !!str
+"specific\L\
+ trimmed\n\n\n\
+ as space"
diff --git a/tests/data/spec-06-08.data b/tests/data/spec-06-08.data
new file mode 100644
index 0000000..f2896ed
--- /dev/null
+++ b/tests/data/spec-06-08.data
@@ -0,0 +1,2 @@
+>-
+  specific
  trimmed…  … ……  as…  space
diff --git a/tests/data/spec-07-01.canonical b/tests/data/spec-07-01.canonical
new file mode 100644
index 0000000..8c8c48d
--- /dev/null
+++ b/tests/data/spec-07-01.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+--- !!str
+"foo"
diff --git a/tests/data/spec-07-01.data b/tests/data/spec-07-01.data
new file mode 100644
index 0000000..2113eb6
--- /dev/null
+++ b/tests/data/spec-07-01.data
@@ -0,0 +1,3 @@
+%FOO  bar baz # Should be ignored
+               # with a warning.
+--- "foo"
diff --git a/tests/data/spec-07-02.canonical b/tests/data/spec-07-02.canonical
new file mode 100644
index 0000000..cb7dd1c
--- /dev/null
+++ b/tests/data/spec-07-02.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!!str "foo"
diff --git a/tests/data/spec-07-02.data b/tests/data/spec-07-02.data
new file mode 100644
index 0000000..c8b7322
--- /dev/null
+++ b/tests/data/spec-07-02.data
@@ -0,0 +1,4 @@
+%YAML 1.2 # Attempt parsing
+           # with a warning
+---
+"foo"
diff --git a/tests/data/spec-07-03.data b/tests/data/spec-07-03.data
new file mode 100644
index 0000000..4bfa07a
--- /dev/null
+++ b/tests/data/spec-07-03.data
@@ -0,0 +1,3 @@
+%YAML 1.1
+%YAML 1.1
+foo
diff --git a/tests/data/spec-07-03.error b/tests/data/spec-07-03.error
new file mode 100644
index 0000000..b0ac446
--- /dev/null
+++ b/tests/data/spec-07-03.error
@@ -0,0 +1,3 @@
+ERROR:
+The YAML directive must only be
+given at most once per document.
diff --git a/tests/data/spec-07-04.canonical b/tests/data/spec-07-04.canonical
new file mode 100644
index 0000000..cb7dd1c
--- /dev/null
+++ b/tests/data/spec-07-04.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!!str "foo"
diff --git a/tests/data/spec-07-04.data b/tests/data/spec-07-04.data
new file mode 100644
index 0000000..50f5ab9
--- /dev/null
+++ b/tests/data/spec-07-04.data
@@ -0,0 +1,3 @@
+%TAG !yaml! tag:yaml.org,2002:
+---
+!yaml!str "foo"
diff --git a/tests/data/spec-07-05.data b/tests/data/spec-07-05.data
new file mode 100644
index 0000000..7276eae
--- /dev/null
+++ b/tests/data/spec-07-05.data
@@ -0,0 +1,3 @@
+%TAG ! !foo
+%TAG ! !foo
+bar
diff --git a/tests/data/spec-07-05.error b/tests/data/spec-07-05.error
new file mode 100644
index 0000000..5601b19
--- /dev/null
+++ b/tests/data/spec-07-05.error
@@ -0,0 +1,4 @@
+ERROR:
+The TAG directive must only
+be given at most once per
+handle in the same document.
diff --git a/tests/data/spec-07-06.canonical b/tests/data/spec-07-06.canonical
new file mode 100644
index 0000000..bddf616
--- /dev/null
+++ b/tests/data/spec-07-06.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!seq [
+  !<!foobar> "baz",
+  !<tag:yaml.org,2002:str> "string"
+]
diff --git a/tests/data/spec-07-06.data b/tests/data/spec-07-06.data
new file mode 100644
index 0000000..d9854cb
--- /dev/null
+++ b/tests/data/spec-07-06.data
@@ -0,0 +1,5 @@
+%TAG !      !foo
+%TAG !yaml! tag:yaml.org,2002:
+---
+- !bar "baz"
+- !yaml!str "string"
diff --git a/tests/data/spec-07-07a.canonical b/tests/data/spec-07-07a.canonical
new file mode 100644
index 0000000..fa086df
--- /dev/null
+++ b/tests/data/spec-07-07a.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!<!foo> "bar"
diff --git a/tests/data/spec-07-07a.data b/tests/data/spec-07-07a.data
new file mode 100644
index 0000000..9d42ec3
--- /dev/null
+++ b/tests/data/spec-07-07a.data
@@ -0,0 +1,2 @@
+# Private application:
+!foo "bar"
diff --git a/tests/data/spec-07-07b.canonical b/tests/data/spec-07-07b.canonical
new file mode 100644
index 0000000..fe917d8
--- /dev/null
+++ b/tests/data/spec-07-07b.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!<tag:ben-kiki.org,2000:app/foo> "bar"
diff --git a/tests/data/spec-07-07b.data b/tests/data/spec-07-07b.data
new file mode 100644
index 0000000..2d36d0e
--- /dev/null
+++ b/tests/data/spec-07-07b.data
@@ -0,0 +1,4 @@
+# Migrated to global:
+%TAG ! tag:ben-kiki.org,2000:app/
+---
+!foo "bar"
diff --git a/tests/data/spec-07-08.canonical b/tests/data/spec-07-08.canonical
new file mode 100644
index 0000000..703aa7b
--- /dev/null
+++ b/tests/data/spec-07-08.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!seq [
+  !<!foo> "bar",
+  !<tag:yaml.org,2002:str> "string",
+  !<tag:ben-kiki.org,2000:type> "baz"
+]
diff --git a/tests/data/spec-07-08.data b/tests/data/spec-07-08.data
new file mode 100644
index 0000000..e2c6d9e
--- /dev/null
+++ b/tests/data/spec-07-08.data
@@ -0,0 +1,9 @@
+# Explicitly specify default settings:
+%TAG !     !
+%TAG !!    tag:yaml.org,2002:
+# Named handles have no default:
+%TAG !o! tag:ben-kiki.org,2000:
+---
+- !foo "bar"
+- !!str "string"
+- !o!type "baz"
diff --git a/tests/data/spec-07-09.canonical b/tests/data/spec-07-09.canonical
new file mode 100644
index 0000000..32d9e94
--- /dev/null
+++ b/tests/data/spec-07-09.canonical
@@ -0,0 +1,9 @@
+%YAML 1.1
+---
+!!str "foo"
+%YAML 1.1
+---
+!!str "bar"
+%YAML 1.1
+---
+!!str "baz"
diff --git a/tests/data/spec-07-09.data b/tests/data/spec-07-09.data
new file mode 100644
index 0000000..1209d47
--- /dev/null
+++ b/tests/data/spec-07-09.data
@@ -0,0 +1,11 @@
+---
+foo
+...
+# Repeated end marker.
+...
+---
+bar
+# No end marker.
+---
+baz
+...
diff --git a/tests/data/spec-07-10.canonical b/tests/data/spec-07-10.canonical
new file mode 100644
index 0000000..1db650a
--- /dev/null
+++ b/tests/data/spec-07-10.canonical
@@ -0,0 +1,15 @@
+%YAML 1.1
+---
+!!str "Root flow scalar"
+%YAML 1.1
+---
+!!str "Root block scalar\n"
+%YAML 1.1
+---
+!!map {
+  ? !!str "foo"
+  : !!str "bar"
+}
+---
+#!!str ""
+!!null ""
diff --git a/tests/data/spec-07-10.data b/tests/data/spec-07-10.data
new file mode 100644
index 0000000..6939b39
--- /dev/null
+++ b/tests/data/spec-07-10.data
@@ -0,0 +1,11 @@
+"Root flow
+ scalar"
+--- !!str >
+ Root block
+ scalar
+---
+# Root collection:
+foo : bar
+... # Is optional.
+---
+# Explicit document may be empty.
diff --git a/tests/data/spec-07-11.data b/tests/data/spec-07-11.data
new file mode 100644
index 0000000..d11302d
--- /dev/null
+++ b/tests/data/spec-07-11.data
@@ -0,0 +1,2 @@
+# A stream may contain
+# no documents.
diff --git a/tests/data/spec-07-11.empty b/tests/data/spec-07-11.empty
new file mode 100644
index 0000000..bfffa8b
--- /dev/null
+++ b/tests/data/spec-07-11.empty
@@ -0,0 +1,2 @@
+# This stream contains no
+# documents, only comments.
diff --git a/tests/data/spec-07-12a.canonical b/tests/data/spec-07-12a.canonical
new file mode 100644
index 0000000..efc116f
--- /dev/null
+++ b/tests/data/spec-07-12a.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "foo"
+  : !!str "bar"
+}
diff --git a/tests/data/spec-07-12a.data b/tests/data/spec-07-12a.data
new file mode 100644
index 0000000..3807d57
--- /dev/null
+++ b/tests/data/spec-07-12a.data
@@ -0,0 +1,3 @@
+# Implicit document. Root
+# collection (mapping) node.
+foo : bar
diff --git a/tests/data/spec-07-12b.canonical b/tests/data/spec-07-12b.canonical
new file mode 100644
index 0000000..04bcffc
--- /dev/null
+++ b/tests/data/spec-07-12b.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!!str "Text content\n"
diff --git a/tests/data/spec-07-12b.data b/tests/data/spec-07-12b.data
new file mode 100644
index 0000000..43250db
--- /dev/null
+++ b/tests/data/spec-07-12b.data
@@ -0,0 +1,4 @@
+# Explicit document. Root
+# scalar (literal) node.
+--- |
+ Text content
diff --git a/tests/data/spec-07-13.canonical b/tests/data/spec-07-13.canonical
new file mode 100644
index 0000000..5af71e9
--- /dev/null
+++ b/tests/data/spec-07-13.canonical
@@ -0,0 +1,9 @@
+%YAML 1.1
+---
+!!str "First document"
+---
+!<!foo> "No directives"
+---
+!<!foobar> "With directives"
+---
+!<!baz> "Reset settings"
diff --git a/tests/data/spec-07-13.data b/tests/data/spec-07-13.data
new file mode 100644
index 0000000..ba7ec63
--- /dev/null
+++ b/tests/data/spec-07-13.data
@@ -0,0 +1,9 @@
+! "First document"
+---
+!foo "No directives"
+%TAG ! !foo
+---
+!bar "With directives"
+%YAML 1.1
+---
+!baz "Reset settings"
diff --git a/tests/data/spec-08-01.canonical b/tests/data/spec-08-01.canonical
new file mode 100644
index 0000000..69e4161
--- /dev/null
+++ b/tests/data/spec-08-01.canonical
@@ -0,0 +1,8 @@
+%YAML 1.1
+---
+!!map {
+  ? &A1 !!str "foo"
+  : !!str "bar",
+  ? &A2 !!str "baz"
+  : *A1
+}
diff --git a/tests/data/spec-08-01.data b/tests/data/spec-08-01.data
new file mode 100644
index 0000000..48986ec
--- /dev/null
+++ b/tests/data/spec-08-01.data
@@ -0,0 +1,2 @@
+!!str &a1 "foo" : !!str bar
+&a2 baz : *a1
diff --git a/tests/data/spec-08-02.canonical b/tests/data/spec-08-02.canonical
new file mode 100644
index 0000000..dd6f76e
--- /dev/null
+++ b/tests/data/spec-08-02.canonical
@@ -0,0 +1,8 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "First occurrence"
+  : &A !!str "Value",
+  ? !!str "Second occurrence"
+  : *A
+}
diff --git a/tests/data/spec-08-02.data b/tests/data/spec-08-02.data
new file mode 100644
index 0000000..600d179
--- /dev/null
+++ b/tests/data/spec-08-02.data
@@ -0,0 +1,2 @@
+First occurrence: &anchor Value
+Second occurrence: *anchor
diff --git a/tests/data/spec-08-03.canonical b/tests/data/spec-08-03.canonical
new file mode 100644
index 0000000..be7ea8f
--- /dev/null
+++ b/tests/data/spec-08-03.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!map {
+  ? !<tag:yaml.org,2002:str> "foo"
+  : !<!bar> "baz"
+}
diff --git a/tests/data/spec-08-03.data b/tests/data/spec-08-03.data
new file mode 100644
index 0000000..8e51f52
--- /dev/null
+++ b/tests/data/spec-08-03.data
@@ -0,0 +1,2 @@
+!<tag:yaml.org,2002:str> foo :
+  !<!bar> baz
diff --git a/tests/data/spec-08-04.data b/tests/data/spec-08-04.data
new file mode 100644
index 0000000..f7d1b01
--- /dev/null
+++ b/tests/data/spec-08-04.data
@@ -0,0 +1,2 @@
+- !<!> foo
+- !<$:?> bar
diff --git a/tests/data/spec-08-04.error b/tests/data/spec-08-04.error
new file mode 100644
index 0000000..6066375
--- /dev/null
+++ b/tests/data/spec-08-04.error
@@ -0,0 +1,6 @@
+ERROR:
+- Verbatim tags aren't resolved,
+  so ! is invalid.
+- The $:? tag is neither a global
+  URI tag nor a local tag starting
+  with “!”.
diff --git a/tests/data/spec-08-05.canonical b/tests/data/spec-08-05.canonical
new file mode 100644
index 0000000..a5c710a
--- /dev/null
+++ b/tests/data/spec-08-05.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!seq [
+  !<!local> "foo",
+  !<tag:yaml.org,2002:str> "bar",
+  !<tag:ben-kiki.org,2000:type> "baz",
+]
diff --git a/tests/data/spec-08-05.data b/tests/data/spec-08-05.data
new file mode 100644
index 0000000..93576ed
--- /dev/null
+++ b/tests/data/spec-08-05.data
@@ -0,0 +1,5 @@
+%TAG !o! tag:ben-kiki.org,2000:
+---
+- !local foo
+- !!str bar
+- !o!type baz
diff --git a/tests/data/spec-08-06.data b/tests/data/spec-08-06.data
new file mode 100644
index 0000000..8580010
--- /dev/null
+++ b/tests/data/spec-08-06.data
@@ -0,0 +1,5 @@
+%TAG !o! tag:ben-kiki.org,2000:
+---
+- !$a!b foo
+- !o! bar
+- !h!type baz
diff --git a/tests/data/spec-08-06.error b/tests/data/spec-08-06.error
new file mode 100644
index 0000000..fb76f42
--- /dev/null
+++ b/tests/data/spec-08-06.error
@@ -0,0 +1,4 @@
+ERROR:
+- The !$a! looks like a handle.
+- The !o! handle has no suffix.
+- The !h! handle wasn't declared.
diff --git a/tests/data/spec-08-07.canonical b/tests/data/spec-08-07.canonical
new file mode 100644
index 0000000..eda1adf
--- /dev/null
+++ b/tests/data/spec-08-07.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!seq [
+  !<tag:yaml.org,2002:str> "12",
+  !<tag:yaml.org,2002:int> "12",
+  !<tag:yaml.org,2002:str> "12",
+]
diff --git a/tests/data/spec-08-07.data b/tests/data/spec-08-07.data
new file mode 100644
index 0000000..98aa565
--- /dev/null
+++ b/tests/data/spec-08-07.data
@@ -0,0 +1,4 @@
+# Assuming conventional resolution:
+- "12"
+- 12
+- ! 12
diff --git a/tests/data/spec-08-08.canonical b/tests/data/spec-08-08.canonical
new file mode 100644
index 0000000..d3f8b1a
--- /dev/null
+++ b/tests/data/spec-08-08.canonical
@@ -0,0 +1,15 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "foo"
+  : !!str "bar baz"
+}
+%YAML 1.1
+---
+!!str "foo bar"
+%YAML 1.1
+---
+!!str "foo bar"
+%YAML 1.1
+---
+!!str "foo\n"
diff --git a/tests/data/spec-08-08.data b/tests/data/spec-08-08.data
new file mode 100644
index 0000000..757a93d
--- /dev/null
+++ b/tests/data/spec-08-08.data
@@ -0,0 +1,13 @@
+---
+foo:
+ "bar
+ baz"
+---
+"foo
+ bar"
+---
+foo
+ bar
+--- |
+ foo
+...
diff --git a/tests/data/spec-08-09.canonical b/tests/data/spec-08-09.canonical
new file mode 100644
index 0000000..3805daf
--- /dev/null
+++ b/tests/data/spec-08-09.canonical
@@ -0,0 +1,21 @@
+%YAML 1.1
+--- !!map {
+  ? !!str "scalars" : !!map {
+      ? !!str "plain"
+      : !!str "some text",
+      ? !!str "quoted"
+      : !!map {
+        ? !!str "single"
+        : !!str "some text",
+        ? !!str "double"
+        : !!str "some text"
+  } },
+  ? !!str "collections" : !!map {
+    ? !!str "sequence" : !!seq [
+      !!str "entry",
+      !!map {
+        ? !!str "key" : !!str "value"
+    } ],
+    ? !!str "mapping" : !!map {
+      ? !!str "key" : !!str "value"
+} } }
diff --git a/tests/data/spec-08-09.data b/tests/data/spec-08-09.data
new file mode 100644
index 0000000..69da042
--- /dev/null
+++ b/tests/data/spec-08-09.data
@@ -0,0 +1,11 @@
+---
+scalars:
+  plain: !!str some text
+  quoted:
+    single: 'some text'
+    double: "some text"
+collections:
+  sequence: !!seq [ !!str entry,
+    # Mapping entry:
+      key: value ]
+  mapping: { key: value }
diff --git a/tests/data/spec-08-10.canonical b/tests/data/spec-08-10.canonical
new file mode 100644
index 0000000..8281c5e
--- /dev/null
+++ b/tests/data/spec-08-10.canonical
@@ -0,0 +1,23 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "block styles" : !!map {
+    ? !!str "scalars" : !!map {
+      ? !!str "literal"
+      : !!str "#!/usr/bin/perl\n\
+          print \"Hello,
+          world!\\n\";\n",
+      ? !!str "folded"
+      : !!str "This sentence
+          is false.\n"
+    },
+    ? !!str "collections" : !!map {
+      ? !!str "sequence" : !!seq [
+        !!str "entry",
+        !!map {
+          ? !!str "key" : !!str "value"
+        }
+      ],
+      ? !!str "mapping" : !!map {
+        ? !!str "key" : !!str "value"
+} } } }
diff --git a/tests/data/spec-08-10.data b/tests/data/spec-08-10.data
new file mode 100644
index 0000000..72acc56
--- /dev/null
+++ b/tests/data/spec-08-10.data
@@ -0,0 +1,15 @@
+block styles:
+  scalars:
+    literal: !!str |
+      #!/usr/bin/perl
+      print "Hello, world!\n";
+    folded: >
+      This sentence
+      is false.
+  collections: !!map
+    sequence: !!seq # Entry:
+      - entry # Plain
+      # Mapping entry:
+      - key: value
+    mapping: 
+      key: value
diff --git a/tests/data/spec-08-11.canonical b/tests/data/spec-08-11.canonical
new file mode 100644
index 0000000..dd6f76e
--- /dev/null
+++ b/tests/data/spec-08-11.canonical
@@ -0,0 +1,8 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "First occurrence"
+  : &A !!str "Value",
+  ? !!str "Second occurrence"
+  : *A
+}
diff --git a/tests/data/spec-08-11.data b/tests/data/spec-08-11.data
new file mode 100644
index 0000000..600d179
--- /dev/null
+++ b/tests/data/spec-08-11.data
@@ -0,0 +1,2 @@
+First occurrence: &anchor Value
+Second occurrence: *anchor
diff --git a/tests/data/spec-08-12.canonical b/tests/data/spec-08-12.canonical
new file mode 100644
index 0000000..dc3b81a
--- /dev/null
+++ b/tests/data/spec-08-12.canonical
@@ -0,0 +1,9 @@
+%YAML 1.1
+---
+!!seq [
+  !!str "Without properties",
+  &A !!str "Anchored",
+  !!str "Tagged",
+  *A,
+  !!str "",
+]
diff --git a/tests/data/spec-08-12.data b/tests/data/spec-08-12.data
new file mode 100644
index 0000000..d936ba2
--- /dev/null
+++ b/tests/data/spec-08-12.data
@@ -0,0 +1,8 @@
+[
+  Without properties,
+  &anchor "Anchored",
+  !!str 'Tagged',
+  *anchor, # Alias node
+#  !!str,   # Empty plain scalar
+  '',   # Empty plain scalar
+]
diff --git a/tests/data/spec-08-13.canonical b/tests/data/spec-08-13.canonical
new file mode 100644
index 0000000..618bb7b
--- /dev/null
+++ b/tests/data/spec-08-13.canonical
@@ -0,0 +1,10 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "foo"
+#  : !!str "",
+#  ? !!str ""
+  : !!null "",
+  ? !!null ""
+  : !!str "bar",
+}
diff --git a/tests/data/spec-08-13.data b/tests/data/spec-08-13.data
new file mode 100644
index 0000000..ebe663a
--- /dev/null
+++ b/tests/data/spec-08-13.data
@@ -0,0 +1,4 @@
+{
+  ? foo :,
+  ? : bar,
+}
diff --git a/tests/data/spec-08-14.canonical b/tests/data/spec-08-14.canonical
new file mode 100644
index 0000000..11db439
--- /dev/null
+++ b/tests/data/spec-08-14.canonical
@@ -0,0 +1,10 @@
+%YAML 1.1
+---
+!!seq [
+  !!str "flow in block",
+  !!str "Block scalar\n",
+  !!map {
+    ? !!str "foo"
+    : !!str "bar"
+  }
+]
diff --git a/tests/data/spec-08-14.data b/tests/data/spec-08-14.data
new file mode 100644
index 0000000..2fbb1f7
--- /dev/null
+++ b/tests/data/spec-08-14.data
@@ -0,0 +1,5 @@
+- "flow in block"
+- >
+ Block scalar
+- !!map # Block collection
+  foo : bar
diff --git a/tests/data/spec-08-15.canonical b/tests/data/spec-08-15.canonical
new file mode 100644
index 0000000..76f028e
--- /dev/null
+++ b/tests/data/spec-08-15.canonical
@@ -0,0 +1,11 @@
+%YAML 1.1
+---
+!!seq [
+  !!null "",
+  !!map {
+    ? !!str "foo"
+    : !!null "",
+    ? !!null ""
+    : !!str "bar",
+  }
+]
diff --git a/tests/data/spec-08-15.data b/tests/data/spec-08-15.data
new file mode 100644
index 0000000..7c86bcf
--- /dev/null
+++ b/tests/data/spec-08-15.data
@@ -0,0 +1,5 @@
+- # Empty plain scalar
+- ? foo
+  :
+  ?
+  : bar
diff --git a/tests/data/spec-09-01.canonical b/tests/data/spec-09-01.canonical
new file mode 100644
index 0000000..e71a548
--- /dev/null
+++ b/tests/data/spec-09-01.canonical
@@ -0,0 +1,11 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "simple key"
+  : !!map {
+    ? !!str "also simple"
+    : !!str "value",
+    ? !!str "not a simple key"
+    : !!str "any value"
+  }
+}
diff --git a/tests/data/spec-09-01.data b/tests/data/spec-09-01.data
new file mode 100644
index 0000000..9e83eaf
--- /dev/null
+++ b/tests/data/spec-09-01.data
@@ -0,0 +1,6 @@
+"simple key" : {
+  "also simple" : value,
+  ? "not a
+  simple key" : "any
+  value"
+}
diff --git a/tests/data/spec-09-02.canonical b/tests/data/spec-09-02.canonical
new file mode 100644
index 0000000..6f8f41a
--- /dev/null
+++ b/tests/data/spec-09-02.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!str "as space \
+  trimmed\n\
+  specific\L\n\
+  escaped\t\n\
+  none"
diff --git a/tests/data/spec-09-02.data b/tests/data/spec-09-02.data
new file mode 100644
index 0000000..d84883d
--- /dev/null
+++ b/tests/data/spec-09-02.data
@@ -0,0 +1,6 @@
+ "as space	
+ trimmed 
+
+ specific

+ escaped	\
 
+ none"
diff --git a/tests/data/spec-09-03.canonical b/tests/data/spec-09-03.canonical
new file mode 100644
index 0000000..658c6df
--- /dev/null
+++ b/tests/data/spec-09-03.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!seq [
+  !!str " last",
+  !!str " last",
+  !!str " \tfirst last",
+]
diff --git a/tests/data/spec-09-03.data b/tests/data/spec-09-03.data
new file mode 100644
index 0000000..e0b914d
--- /dev/null
+++ b/tests/data/spec-09-03.data
@@ -0,0 +1,6 @@
+- "
+  last"
+- " 	
+  last"
+- " 	first
+  last"
diff --git a/tests/data/spec-09-04.canonical b/tests/data/spec-09-04.canonical
new file mode 100644
index 0000000..fa46632
--- /dev/null
+++ b/tests/data/spec-09-04.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!str "first \
+  inner 1  \
+  inner 2 \
+  last"
diff --git a/tests/data/spec-09-04.data b/tests/data/spec-09-04.data
new file mode 100644
index 0000000..313a91b
--- /dev/null
+++ b/tests/data/spec-09-04.data
@@ -0,0 +1,4 @@
+ "first
+ 	inner 1	
+ \ inner 2 \
+ last"
diff --git a/tests/data/spec-09-05.canonical b/tests/data/spec-09-05.canonical
new file mode 100644
index 0000000..24d1052
--- /dev/null
+++ b/tests/data/spec-09-05.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!seq [
+  !!str "first ",
+  !!str "first\nlast",
+  !!str "first inner  \tlast",
+]
diff --git a/tests/data/spec-09-05.data b/tests/data/spec-09-05.data
new file mode 100644
index 0000000..624c30e
--- /dev/null
+++ b/tests/data/spec-09-05.data
@@ -0,0 +1,8 @@
+- "first
+  	"
+- "first
+
+  	last"
+- "first
+ inner
+ \ 	last"
diff --git a/tests/data/spec-09-06.canonical b/tests/data/spec-09-06.canonical
new file mode 100644
index 0000000..5028772
--- /dev/null
+++ b/tests/data/spec-09-06.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!!str "here's to \"quotes\""
diff --git a/tests/data/spec-09-06.data b/tests/data/spec-09-06.data
new file mode 100644
index 0000000..b038078
--- /dev/null
+++ b/tests/data/spec-09-06.data
@@ -0,0 +1 @@
+ 'here''s to "quotes"'
diff --git a/tests/data/spec-09-07.canonical b/tests/data/spec-09-07.canonical
new file mode 100644
index 0000000..e71a548
--- /dev/null
+++ b/tests/data/spec-09-07.canonical
@@ -0,0 +1,11 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "simple key"
+  : !!map {
+    ? !!str "also simple"
+    : !!str "value",
+    ? !!str "not a simple key"
+    : !!str "any value"
+  }
+}
diff --git a/tests/data/spec-09-07.data b/tests/data/spec-09-07.data
new file mode 100644
index 0000000..755b54a
--- /dev/null
+++ b/tests/data/spec-09-07.data
@@ -0,0 +1,6 @@
+'simple key' : {
+  'also simple' : value,
+  ? 'not a
+  simple key' : 'any
+  value'
+}
diff --git a/tests/data/spec-09-08.canonical b/tests/data/spec-09-08.canonical
new file mode 100644
index 0000000..06abdb5
--- /dev/null
+++ b/tests/data/spec-09-08.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!str "as space \
+  trimmed\n\
+  specific\L\n\
+  none"
diff --git a/tests/data/spec-09-08.data b/tests/data/spec-09-08.data
new file mode 100644
index 0000000..aa4d458
--- /dev/null
+++ b/tests/data/spec-09-08.data
@@ -0,0 +1 @@
+ 'as space	… trimmed …… specific
… none'
diff --git a/tests/data/spec-09-09.canonical b/tests/data/spec-09-09.canonical
new file mode 100644
index 0000000..658c6df
--- /dev/null
+++ b/tests/data/spec-09-09.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!seq [
+  !!str " last",
+  !!str " last",
+  !!str " \tfirst last",
+]
diff --git a/tests/data/spec-09-09.data b/tests/data/spec-09-09.data
new file mode 100644
index 0000000..52171df
--- /dev/null
+++ b/tests/data/spec-09-09.data
@@ -0,0 +1,6 @@
+- '
+  last'
+- ' 	
+  last'
+- ' 	first
+  last'
diff --git a/tests/data/spec-09-10.canonical b/tests/data/spec-09-10.canonical
new file mode 100644
index 0000000..2028d04
--- /dev/null
+++ b/tests/data/spec-09-10.canonical
@@ -0,0 +1,5 @@
+%YAML 1.1
+---
+!!str "first \
+  inner \
+  last"
diff --git a/tests/data/spec-09-10.data b/tests/data/spec-09-10.data
new file mode 100644
index 0000000..0e41449
--- /dev/null
+++ b/tests/data/spec-09-10.data
@@ -0,0 +1,3 @@
+ 'first
+ 	inner	
+ last'
diff --git a/tests/data/spec-09-11.canonical b/tests/data/spec-09-11.canonical
new file mode 100644
index 0000000..4eb222c
--- /dev/null
+++ b/tests/data/spec-09-11.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!seq [
+  !!str "first ",
+  !!str "first\nlast",
+]
diff --git a/tests/data/spec-09-11.data b/tests/data/spec-09-11.data
new file mode 100644
index 0000000..5efa873
--- /dev/null
+++ b/tests/data/spec-09-11.data
@@ -0,0 +1,5 @@
+- 'first
+  	'
+- 'first
+
+  	last'
diff --git a/tests/data/spec-09-12.canonical b/tests/data/spec-09-12.canonical
new file mode 100644
index 0000000..d8e6dce
--- /dev/null
+++ b/tests/data/spec-09-12.canonical
@@ -0,0 +1,12 @@
+%YAML 1.1
+---
+!!seq [
+  !!str "::std::vector",
+  !!str "Up, up, and away!",
+  !!int "-123",
+  !!seq [
+    !!str "::std::vector",
+    !!str "Up, up, and away!",
+    !!int "-123",
+  ]
+]
diff --git a/tests/data/spec-09-12.data b/tests/data/spec-09-12.data
new file mode 100644
index 0000000..b9a3ac5
--- /dev/null
+++ b/tests/data/spec-09-12.data
@@ -0,0 +1,8 @@
+# Outside flow collection:
+- ::std::vector
+- Up, up, and away!
+- -123
+# Inside flow collection:
+- [ '::std::vector',
+  "Up, up, and away!",
+  -123 ]
diff --git a/tests/data/spec-09-13.canonical b/tests/data/spec-09-13.canonical
new file mode 100644
index 0000000..e71a548
--- /dev/null
+++ b/tests/data/spec-09-13.canonical
@@ -0,0 +1,11 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "simple key"
+  : !!map {
+    ? !!str "also simple"
+    : !!str "value",
+    ? !!str "not a simple key"
+    : !!str "any value"
+  }
+}
diff --git a/tests/data/spec-09-13.data b/tests/data/spec-09-13.data
new file mode 100644
index 0000000..b156386
--- /dev/null
+++ b/tests/data/spec-09-13.data
@@ -0,0 +1,6 @@
+simple key : {
+  also simple : value,
+  ? not a
+  simple key : any
+  value
+}
diff --git a/tests/data/spec-09-14.data b/tests/data/spec-09-14.data
new file mode 100644
index 0000000..97f2316
--- /dev/null
+++ b/tests/data/spec-09-14.data
@@ -0,0 +1,14 @@
+---
+--- ||| : foo
+... >>>: bar
+---
+[
+---
+,
+... ,
+{
+--- :
+... # Nested
+}
+]
+...
diff --git a/tests/data/spec-09-14.error b/tests/data/spec-09-14.error
new file mode 100644
index 0000000..9f3db7b
--- /dev/null
+++ b/tests/data/spec-09-14.error
@@ -0,0 +1,6 @@
+ERROR:
+ The --- and ... document
+ start and end markers must
+ not be specified as the
+ first content line of a
+ non-indented plain scalar.
diff --git a/tests/data/spec-09-15.canonical b/tests/data/spec-09-15.canonical
new file mode 100644
index 0000000..df02040
--- /dev/null
+++ b/tests/data/spec-09-15.canonical
@@ -0,0 +1,18 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "---"
+  : !!str "foo",
+  ? !!str "..."
+  : !!str "bar"
+}
+%YAML 1.1
+---
+!!seq [
+  !!str "---",
+  !!str "...",
+  !!map {
+    ? !!str "---"
+    : !!str "..."
+  }
+]
diff --git a/tests/data/spec-09-15.data b/tests/data/spec-09-15.data
new file mode 100644
index 0000000..e6863b0
--- /dev/null
+++ b/tests/data/spec-09-15.data
@@ -0,0 +1,13 @@
+---
+"---" : foo
+...: bar
+---
+[
+---,
+...,
+{
+? ---
+: ...
+}
+]
+...
diff --git a/tests/data/spec-09-16.canonical b/tests/data/spec-09-16.canonical
new file mode 100644
index 0000000..06abdb5
--- /dev/null
+++ b/tests/data/spec-09-16.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!str "as space \
+  trimmed\n\
+  specific\L\n\
+  none"
diff --git a/tests/data/spec-09-16.data b/tests/data/spec-09-16.data
new file mode 100644
index 0000000..473beb9
--- /dev/null
+++ b/tests/data/spec-09-16.data
@@ -0,0 +1,3 @@
+# Tabs are confusing:
+# as space/trimmed/specific/none
+ as space … trimmed …… specific
… none
diff --git a/tests/data/spec-09-17.canonical b/tests/data/spec-09-17.canonical
new file mode 100644
index 0000000..68cb70d
--- /dev/null
+++ b/tests/data/spec-09-17.canonical
@@ -0,0 +1,4 @@
+%YAML 1.1
+---
+!!str "first line\n\
+      more line"
diff --git a/tests/data/spec-09-17.data b/tests/data/spec-09-17.data
new file mode 100644
index 0000000..97bc46c
--- /dev/null
+++ b/tests/data/spec-09-17.data
@@ -0,0 +1,3 @@
+ first line 
+   
+  more line
diff --git a/tests/data/spec-09-18.canonical b/tests/data/spec-09-18.canonical
new file mode 100644
index 0000000..f21428f
--- /dev/null
+++ b/tests/data/spec-09-18.canonical
@@ -0,0 +1,8 @@
+%YAML 1.1
+---
+!!seq [
+  !!str "literal\n",
+  !!str " folded\n",
+  !!str "keep\n\n",
+  !!str " strip",
+]
diff --git a/tests/data/spec-09-18.data b/tests/data/spec-09-18.data
new file mode 100644
index 0000000..68c5d7c
--- /dev/null
+++ b/tests/data/spec-09-18.data
@@ -0,0 +1,9 @@
+- | # Just the style
+ literal
+- >1 # Indentation indicator
+  folded
+- |+ # Chomping indicator
+ keep
+
+- >-1 # Both indicators
+  strip
diff --git a/tests/data/spec-09-19.canonical b/tests/data/spec-09-19.canonical
new file mode 100644
index 0000000..3e828d7
--- /dev/null
+++ b/tests/data/spec-09-19.canonical
@@ -0,0 +1,6 @@
+%YAML 1.1
+---
+!!seq [
+  !!str "literal\n",
+  !!str "folded\n",
+]
diff --git a/tests/data/spec-09-19.data b/tests/data/spec-09-19.data
new file mode 100644
index 0000000..f0e589d
--- /dev/null
+++ b/tests/data/spec-09-19.data
@@ -0,0 +1,4 @@
+- |
+ literal
+- >
+ folded
diff --git a/tests/data/spec-09-20.canonical b/tests/data/spec-09-20.canonical
new file mode 100644
index 0000000..d03bef5
--- /dev/null
+++ b/tests/data/spec-09-20.canonical
@@ -0,0 +1,8 @@
+%YAML 1.1
+---
+!!seq [
+  !!str "detected\n",
+  !!str "\n\n# detected\n",
+  !!str " explicit\n",
+  !!str "\t\ndetected\n",
+]
diff --git a/tests/data/spec-09-20.data b/tests/data/spec-09-20.data
new file mode 100644
index 0000000..39bee04
--- /dev/null
+++ b/tests/data/spec-09-20.data
@@ -0,0 +1,11 @@
+- |
+ detected
+- >
+ 
+  
+  # detected
+- |1
+  explicit
+- >
+ 	
+ detected
diff --git a/tests/data/spec-09-21.data b/tests/data/spec-09-21.data
new file mode 100644
index 0000000..0fdd14f
--- /dev/null
+++ b/tests/data/spec-09-21.data
@@ -0,0 +1,8 @@
+- |
+  
+ text
+- >
+  text
+ text
+- |1
+ text
diff --git a/tests/data/spec-09-21.error b/tests/data/spec-09-21.error
new file mode 100644
index 0000000..1379ca5
--- /dev/null
+++ b/tests/data/spec-09-21.error
@@ -0,0 +1,7 @@
+ERROR:
+- A leading all-space line must
+  not have too many spaces.
+- A following text line must
+  not be less indented.
+- The text is less indented
+  than the indicated level.
diff --git a/tests/data/spec-09-22.canonical b/tests/data/spec-09-22.canonical
new file mode 100644
index 0000000..c1bbcd2
--- /dev/null
+++ b/tests/data/spec-09-22.canonical
@@ -0,0 +1,10 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "strip"
+  : !!str "text",
+  ? !!str "clip"
+  : !!str "text\n",
+  ? !!str "keep"
+  : !!str "text\L",
+}
diff --git a/tests/data/spec-09-22.data b/tests/data/spec-09-22.data
new file mode 100644
index 0000000..0dd51eb
--- /dev/null
+++ b/tests/data/spec-09-22.data
@@ -0,0 +1,4 @@
+strip: |-
+  text
clip: |
+  textÂ…keep: |+
+  text

\ No newline at end of file
diff --git a/tests/data/spec-09-23.canonical b/tests/data/spec-09-23.canonical
new file mode 100644
index 0000000..c4444ca
--- /dev/null
+++ b/tests/data/spec-09-23.canonical
@@ -0,0 +1,10 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "strip"
+  : !!str "# text",
+  ? !!str "clip"
+  : !!str "# text\n",
+  ? !!str "keep"
+  : !!str "# text\L\n",
+}
diff --git a/tests/data/spec-09-23.data b/tests/data/spec-09-23.data
new file mode 100644
index 0000000..8972d2b
--- /dev/null
+++ b/tests/data/spec-09-23.data
@@ -0,0 +1,11 @@
+ # Strip
+  # Comments:
+strip: |-
+  # text
  
 # Clip
+  # comments:
+Â…clip: |
+  # text… 
 # Keep
+  # comments:
+Â…keep: |+
+  # text
… # Trail
+  # comments.
diff --git a/tests/data/spec-09-24.canonical b/tests/data/spec-09-24.canonical
new file mode 100644
index 0000000..45a99b0
--- /dev/null
+++ b/tests/data/spec-09-24.canonical
@@ -0,0 +1,10 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "strip"
+  : !!str "",
+  ? !!str "clip"
+  : !!str "",
+  ? !!str "keep"
+  : !!str "\n",
+}
diff --git a/tests/data/spec-09-24.data b/tests/data/spec-09-24.data
new file mode 100644
index 0000000..de0b64b
--- /dev/null
+++ b/tests/data/spec-09-24.data
@@ -0,0 +1,6 @@
+strip: >-
+
+clip: >
+
+keep: |+
+
diff --git a/tests/data/spec-09-25.canonical b/tests/data/spec-09-25.canonical
new file mode 100644
index 0000000..9d2327b
--- /dev/null
+++ b/tests/data/spec-09-25.canonical
@@ -0,0 +1,4 @@
+%YAML 1.1
+---
+!!str "literal\n\
+      \ttext\n"
diff --git a/tests/data/spec-09-25.data b/tests/data/spec-09-25.data
new file mode 100644
index 0000000..f6303a1
--- /dev/null
+++ b/tests/data/spec-09-25.data
@@ -0,0 +1,3 @@
+| # Simple block scalar
+ literal
+ 	text
diff --git a/tests/data/spec-09-26.canonical b/tests/data/spec-09-26.canonical
new file mode 100644
index 0000000..3029a11
--- /dev/null
+++ b/tests/data/spec-09-26.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!!str "\n\nliteral\n\ntext\n"
diff --git a/tests/data/spec-09-26.data b/tests/data/spec-09-26.data
new file mode 100644
index 0000000..f28555a
--- /dev/null
+++ b/tests/data/spec-09-26.data
@@ -0,0 +1,8 @@
+|
+ 
+  
+  literal
+ 
+  text
+
+ # Comment
diff --git a/tests/data/spec-09-27.canonical b/tests/data/spec-09-27.canonical
new file mode 100644
index 0000000..3029a11
--- /dev/null
+++ b/tests/data/spec-09-27.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!!str "\n\nliteral\n\ntext\n"
diff --git a/tests/data/spec-09-27.data b/tests/data/spec-09-27.data
new file mode 100644
index 0000000..f28555a
--- /dev/null
+++ b/tests/data/spec-09-27.data
@@ -0,0 +1,8 @@
+|
+ 
+  
+  literal
+ 
+  text
+
+ # Comment
diff --git a/tests/data/spec-09-28.canonical b/tests/data/spec-09-28.canonical
new file mode 100644
index 0000000..3029a11
--- /dev/null
+++ b/tests/data/spec-09-28.canonical
@@ -0,0 +1,3 @@
+%YAML 1.1
+---
+!!str "\n\nliteral\n\ntext\n"
diff --git a/tests/data/spec-09-28.data b/tests/data/spec-09-28.data
new file mode 100644
index 0000000..f28555a
--- /dev/null
+++ b/tests/data/spec-09-28.data
@@ -0,0 +1,8 @@
+|
+ 
+  
+  literal
+ 
+  text
+
+ # Comment
diff --git a/tests/data/spec-09-29.canonical b/tests/data/spec-09-29.canonical
new file mode 100644
index 0000000..0980789
--- /dev/null
+++ b/tests/data/spec-09-29.canonical
@@ -0,0 +1,4 @@
+%YAML 1.1
+---
+!!str "folded text\n\
+      \tlines\n"
diff --git a/tests/data/spec-09-29.data b/tests/data/spec-09-29.data
new file mode 100644
index 0000000..82e611f
--- /dev/null
+++ b/tests/data/spec-09-29.data
@@ -0,0 +1,4 @@
+> # Simple folded scalar
+ folded
+ text
+ 	lines
diff --git a/tests/data/spec-09-30.canonical b/tests/data/spec-09-30.canonical
new file mode 100644
index 0000000..fc37db1
--- /dev/null
+++ b/tests/data/spec-09-30.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!str "folded line\n\
+      next line\n\n\
+      \  * bullet\n\
+      \  * list\n\n\
+      last line\n"
diff --git a/tests/data/spec-09-30.data b/tests/data/spec-09-30.data
new file mode 100644
index 0000000..a4d8c36
--- /dev/null
+++ b/tests/data/spec-09-30.data
@@ -0,0 +1,14 @@
+>
+ folded
+ line
+
+ next
+ line
+
+   * bullet
+   * list
+
+ last
+ line
+
+# Comment
diff --git a/tests/data/spec-09-31.canonical b/tests/data/spec-09-31.canonical
new file mode 100644
index 0000000..fc37db1
--- /dev/null
+++ b/tests/data/spec-09-31.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!str "folded line\n\
+      next line\n\n\
+      \  * bullet\n\
+      \  * list\n\n\
+      last line\n"
diff --git a/tests/data/spec-09-31.data b/tests/data/spec-09-31.data
new file mode 100644
index 0000000..a4d8c36
--- /dev/null
+++ b/tests/data/spec-09-31.data
@@ -0,0 +1,14 @@
+>
+ folded
+ line
+
+ next
+ line
+
+   * bullet
+   * list
+
+ last
+ line
+
+# Comment
diff --git a/tests/data/spec-09-32.canonical b/tests/data/spec-09-32.canonical
new file mode 100644
index 0000000..fc37db1
--- /dev/null
+++ b/tests/data/spec-09-32.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!str "folded line\n\
+      next line\n\n\
+      \  * bullet\n\
+      \  * list\n\n\
+      last line\n"
diff --git a/tests/data/spec-09-32.data b/tests/data/spec-09-32.data
new file mode 100644
index 0000000..a4d8c36
--- /dev/null
+++ b/tests/data/spec-09-32.data
@@ -0,0 +1,14 @@
+>
+ folded
+ line
+
+ next
+ line
+
+   * bullet
+   * list
+
+ last
+ line
+
+# Comment
diff --git a/tests/data/spec-09-33.canonical b/tests/data/spec-09-33.canonical
new file mode 100644
index 0000000..fc37db1
--- /dev/null
+++ b/tests/data/spec-09-33.canonical
@@ -0,0 +1,7 @@
+%YAML 1.1
+---
+!!str "folded line\n\
+      next line\n\n\
+      \  * bullet\n\
+      \  * list\n\n\
+      last line\n"
diff --git a/tests/data/spec-09-33.data b/tests/data/spec-09-33.data
new file mode 100644
index 0000000..a4d8c36
--- /dev/null
+++ b/tests/data/spec-09-33.data
@@ -0,0 +1,14 @@
+>
+ folded
+ line
+
+ next
+ line
+
+   * bullet
+   * list
+
+ last
+ line
+
+# Comment
diff --git a/tests/data/spec-10-01.canonical b/tests/data/spec-10-01.canonical
new file mode 100644
index 0000000..d08cdd4
--- /dev/null
+++ b/tests/data/spec-10-01.canonical
@@ -0,0 +1,12 @@
+%YAML 1.1
+---
+!!seq [
+  !!seq [
+    !!str "inner",
+    !!str "inner",
+  ],
+  !!seq [
+    !!str "inner",
+    !!str "last",
+  ],
+]
diff --git a/tests/data/spec-10-01.data b/tests/data/spec-10-01.data
new file mode 100644
index 0000000..e668d38
--- /dev/null
+++ b/tests/data/spec-10-01.data
@@ -0,0 +1,2 @@
+- [ inner, inner, ]
+- [inner,last]
diff --git a/tests/data/spec-10-02.canonical b/tests/data/spec-10-02.canonical
new file mode 100644
index 0000000..82fe0d9
--- /dev/null
+++ b/tests/data/spec-10-02.canonical
@@ -0,0 +1,14 @@
+%YAML 1.1
+---
+!!seq [
+  !!str "double quoted",
+  !!str "single quoted",
+  !!str "plain text",
+  !!seq [
+    !!str "nested",
+  ],
+  !!map {
+    ? !!str "single"
+    : !!str "pair"
+  }
+]
diff --git a/tests/data/spec-10-02.data b/tests/data/spec-10-02.data
new file mode 100644
index 0000000..3b23351
--- /dev/null
+++ b/tests/data/spec-10-02.data
@@ -0,0 +1,8 @@
+[
+"double
+ quoted", 'single
+           quoted',
+plain
+ text, [ nested ],
+single: pair ,
+]
diff --git a/tests/data/spec-10-03.canonical b/tests/data/spec-10-03.canonical
new file mode 100644
index 0000000..1443395
--- /dev/null
+++ b/tests/data/spec-10-03.canonical
@@ -0,0 +1,12 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "block"
+  : !!seq [
+    !!str "one",
+    !!map {
+      ? !!str "two"
+      : !!str "three"
+    }
+  ]
+}
diff --git a/tests/data/spec-10-03.data b/tests/data/spec-10-03.data
new file mode 100644
index 0000000..9e15f83
--- /dev/null
+++ b/tests/data/spec-10-03.data
@@ -0,0 +1,4 @@
+block: # Block
+       # sequence
+- one
+- two : three
diff --git a/tests/data/spec-10-04.canonical b/tests/data/spec-10-04.canonical
new file mode 100644
index 0000000..ae486a3
--- /dev/null
+++ b/tests/data/spec-10-04.canonical
@@ -0,0 +1,11 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "block"
+  : !!seq [
+    !!str "one",
+    !!seq [
+      !!str "two"
+    ]
+  ]
+}
diff --git a/tests/data/spec-10-04.data b/tests/data/spec-10-04.data
new file mode 100644
index 0000000..2905b0d
--- /dev/null
+++ b/tests/data/spec-10-04.data
@@ -0,0 +1,4 @@
+block:
+- one
+-
+ - two
diff --git a/tests/data/spec-10-05.canonical b/tests/data/spec-10-05.canonical
new file mode 100644
index 0000000..07cc0c9
--- /dev/null
+++ b/tests/data/spec-10-05.canonical
@@ -0,0 +1,14 @@
+%YAML 1.1
+---
+!!seq [
+  !!null "",
+  !!str "block node\n",
+  !!seq [
+    !!str "one",
+    !!str "two",
+  ],
+  !!map {
+    ? !!str "one"
+    : !!str "two",
+  }
+]
diff --git a/tests/data/spec-10-05.data b/tests/data/spec-10-05.data
new file mode 100644
index 0000000..f19a99e
--- /dev/null
+++ b/tests/data/spec-10-05.data
@@ -0,0 +1,7 @@
+- # Empty
+- |
+ block node
+- - one # in-line
+  - two # sequence
+- one: two # in-line
+           # mapping
diff --git a/tests/data/spec-10-06.canonical b/tests/data/spec-10-06.canonical
new file mode 100644
index 0000000..d9986c2
--- /dev/null
+++ b/tests/data/spec-10-06.canonical
@@ -0,0 +1,16 @@
+%YAML 1.1
+---
+!!seq [
+  !!map {
+    ? !!str "inner"
+    : !!str "entry",
+    ? !!str "also"
+    : !!str "inner"
+  },
+  !!map {
+    ? !!str "inner"
+    : !!str "entry",
+    ? !!str "last"
+    : !!str "entry"
+  }
+]
diff --git a/tests/data/spec-10-06.data b/tests/data/spec-10-06.data
new file mode 100644
index 0000000..860ba25
--- /dev/null
+++ b/tests/data/spec-10-06.data
@@ -0,0 +1,2 @@
+- { inner : entry , also: inner , }
+- {inner: entry,last : entry}
diff --git a/tests/data/spec-10-07.canonical b/tests/data/spec-10-07.canonical
new file mode 100644
index 0000000..ec74230
--- /dev/null
+++ b/tests/data/spec-10-07.canonical
@@ -0,0 +1,16 @@
+%YAML 1.1
+---
+!!map {
+  ? !!null ""
+  : !!str "value",
+  ? !!str "explicit key"
+  : !!str "value",
+  ? !!str "simple key"
+  : !!str "value",
+  ? !!seq [
+    !!str "collection",
+    !!str "simple",
+    !!str "key"
+  ]
+  : !!str "value"
+}
diff --git a/tests/data/spec-10-07.data b/tests/data/spec-10-07.data
new file mode 100644
index 0000000..ff943fb
--- /dev/null
+++ b/tests/data/spec-10-07.data
@@ -0,0 +1,7 @@
+{
+? : value, # Empty key
+? explicit
+ key: value,
+simple key : value,
+[ collection, simple, key ]: value
+}
diff --git a/tests/data/spec-10-08.data b/tests/data/spec-10-08.data
new file mode 100644
index 0000000..55bd788
--- /dev/null
+++ b/tests/data/spec-10-08.data
@@ -0,0 +1,5 @@
+{
+multi-line
+ simple key : value,
+very long ...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................(>1KB)................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... key: value
+}
diff --git a/tests/data/spec-10-08.error b/tests/data/spec-10-08.error
new file mode 100644
index 0000000..3979e1f
--- /dev/null
+++ b/tests/data/spec-10-08.error
@@ -0,0 +1,5 @@
+ERROR:
+- A simple key is restricted
+  to only one line.
+- A simple key must not be
+  longer than 1024 characters.
diff --git a/tests/data/spec-10-09.canonical b/tests/data/spec-10-09.canonical
new file mode 100644
index 0000000..4d9827b
--- /dev/null
+++ b/tests/data/spec-10-09.canonical
@@ -0,0 +1,8 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "key"
+  : !!str "value",
+  ? !!str "empty"
+  : !!null "",
+}
diff --git a/tests/data/spec-10-09.data b/tests/data/spec-10-09.data
new file mode 100644
index 0000000..4d55e21
--- /dev/null
+++ b/tests/data/spec-10-09.data
@@ -0,0 +1,4 @@
+{
+key : value,
+empty: # empty value↓
+}
diff --git a/tests/data/spec-10-10.canonical b/tests/data/spec-10-10.canonical
new file mode 100644
index 0000000..016fb64
--- /dev/null
+++ b/tests/data/spec-10-10.canonical
@@ -0,0 +1,16 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "explicit key1"
+  : !!str "explicit value",
+  ? !!str "explicit key2"
+  : !!null "",
+  ? !!str "explicit key3"
+  : !!null "",
+  ? !!str "simple key1"
+  : !!str "explicit value",
+  ? !!str "simple key2"
+  : !!null "",
+  ? !!str "simple key3"
+  : !!null "",
+}
diff --git a/tests/data/spec-10-10.data b/tests/data/spec-10-10.data
new file mode 100644
index 0000000..0888b05
--- /dev/null
+++ b/tests/data/spec-10-10.data
@@ -0,0 +1,8 @@
+{
+? explicit key1 : explicit value,
+? explicit key2 : , # Explicit empty
+? explicit key3,     # Empty value
+simple key1 : explicit value,
+simple key2 : ,     # Explicit empty
+simple key3,         # Empty value
+}
diff --git a/tests/data/spec-10-11.canonical b/tests/data/spec-10-11.canonical
new file mode 100644
index 0000000..7309544
--- /dev/null
+++ b/tests/data/spec-10-11.canonical
@@ -0,0 +1,24 @@
+%YAML 1.1
+---
+!!seq [
+  !!map {
+    ? !!str "explicit key1"
+    : !!str "explicit value",
+  },
+  !!map {
+    ? !!str "explicit key2"
+    : !!null "",
+  },
+  !!map {
+    ? !!str "explicit key3"
+    : !!null "",
+  },
+  !!map {
+    ? !!str "simple key1"
+    : !!str "explicit value",
+  },
+  !!map {
+    ? !!str "simple key2"
+    : !!null "",
+  },
+]
diff --git a/tests/data/spec-10-11.data b/tests/data/spec-10-11.data
new file mode 100644
index 0000000..9f05568
--- /dev/null
+++ b/tests/data/spec-10-11.data
@@ -0,0 +1,7 @@
+[
+? explicit key1 : explicit value,
+? explicit key2 : , # Explicit empty
+? explicit key3,     # Implicit empty
+simple key1 : explicit value,
+simple key2 : ,     # Explicit empty
+]
diff --git a/tests/data/spec-10-12.canonical b/tests/data/spec-10-12.canonical
new file mode 100644
index 0000000..a95dd40
--- /dev/null
+++ b/tests/data/spec-10-12.canonical
@@ -0,0 +1,9 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "block"
+  : !!map {
+    ? !!str "key"
+    : !!str "value"
+  }
+}
diff --git a/tests/data/spec-10-12.data b/tests/data/spec-10-12.data
new file mode 100644
index 0000000..5521443
--- /dev/null
+++ b/tests/data/spec-10-12.data
@@ -0,0 +1,3 @@
+block: # Block
+    # mapping
+ key: value
diff --git a/tests/data/spec-10-13.canonical b/tests/data/spec-10-13.canonical
new file mode 100644
index 0000000..e183c50
--- /dev/null
+++ b/tests/data/spec-10-13.canonical
@@ -0,0 +1,11 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "explicit key"
+  : !!null "",
+  ? !!str "block key\n"
+  : !!seq [
+    !!str "one",
+    !!str "two",
+  ]
+}
diff --git a/tests/data/spec-10-13.data b/tests/data/spec-10-13.data
new file mode 100644
index 0000000..b5b97db
--- /dev/null
+++ b/tests/data/spec-10-13.data
@@ -0,0 +1,5 @@
+? explicit key # implicit value
+? |
+  block key
+: - one # explicit in-line
+  - two # block value
diff --git a/tests/data/spec-10-14.canonical b/tests/data/spec-10-14.canonical
new file mode 100644
index 0000000..e87c880
--- /dev/null
+++ b/tests/data/spec-10-14.canonical
@@ -0,0 +1,11 @@
+%YAML 1.1
+---
+!!map {
+  ? !!str "plain key"
+  : !!null "",
+  ? !!str "quoted key"
+  : !!seq [
+    !!str "one",
+    !!str "two",
+  ]
+}
diff --git a/tests/data/spec-10-14.data b/tests/data/spec-10-14.data
new file mode 100644
index 0000000..7f5995c
--- /dev/null
+++ b/tests/data/spec-10-14.data
@@ -0,0 +1,4 @@
+plain key: # empty value
+"quoted key":
+- one # explicit next-line
+- two # block value
diff --git a/tests/data/spec-10-15.canonical b/tests/data/spec-10-15.canonical
new file mode 100644
index 0000000..85fbbd0
--- /dev/null
+++ b/tests/data/spec-10-15.canonical
@@ -0,0 +1,18 @@
+%YAML 1.1
+---
+!!seq [
+  !!map {
+    ? !!str "sun"
+    : !!str "yellow"
+  },
+  !!map {
+    ? !!map {
+      ? !!str "earth"
+      : !!str "blue"
+    }
+    : !!map {
+      ? !!str "moon"
+      : !!str "white"
+    }
+  }
+]
diff --git a/tests/data/spec-10-15.data b/tests/data/spec-10-15.data
new file mode 100644
index 0000000..d675cfd
--- /dev/null
+++ b/tests/data/spec-10-15.data
@@ -0,0 +1,3 @@
+- sun: yellow
+- ? earth: blue
+  : moon: white
diff --git a/tests/data/str.data b/tests/data/str.data
new file mode 100644
index 0000000..7cbdb7c
--- /dev/null
+++ b/tests/data/str.data
@@ -0,0 +1 @@
+- abcd
diff --git a/tests/data/str.detect b/tests/data/str.detect
new file mode 100644
index 0000000..7d5026f
--- /dev/null
+++ b/tests/data/str.detect
@@ -0,0 +1 @@
+tag:yaml.org,2002:str
diff --git a/tests/data/test_marker.markers b/tests/data/test_marker.markers
new file mode 100644
index 0000000..7b08ee4
--- /dev/null
+++ b/tests/data/test_marker.markers
@@ -0,0 +1,38 @@
+---
+*The first line.
+The last line.
+---
+The first*line.
+The last line.
+---
+The first line.*
+The last line.
+---
+The first line.
+*The last line.
+---
+The first line.
+The last*line.
+---
+The first line.
+The last line.*
+---
+The first line.
+*The selected line.
+The last line.
+---
+The first line.
+The selected*line.
+The last line.
+---
+The first line.
+The selected line.*
+The last line.
+---
+*The only line.
+---
+The only*line.
+---
+The only line.*
+---
+Loooooooooooooooooooooooooooooooooooooooooooooong*Liiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiine
diff --git a/tests/data/timestamp.data b/tests/data/timestamp.data
new file mode 100644
index 0000000..7d214ce
--- /dev/null
+++ b/tests/data/timestamp.data
@@ -0,0 +1,5 @@
+- 2001-12-15T02:59:43.1Z
+- 2001-12-14t21:59:43.10-05:00
+- 2001-12-14 21:59:43.10 -5
+- 2001-12-15 2:59:43.10
+- 2002-12-14
diff --git a/tests/data/timestamp.detect b/tests/data/timestamp.detect
new file mode 100644
index 0000000..2013936
--- /dev/null
+++ b/tests/data/timestamp.detect
@@ -0,0 +1 @@
+tag:yaml.org,2002:timestamp
diff --git a/tests/data/unacceptable-key.error-message b/tests/data/unacceptable-key.error-message
new file mode 100644
index 0000000..d748e37
--- /dev/null
+++ b/tests/data/unacceptable-key.error-message
@@ -0,0 +1,4 @@
+---
+? - foo
+  - bar
+: baz
diff --git a/tests/data/unclosed-bracket.error-message b/tests/data/unclosed-bracket.error-message
new file mode 100644
index 0000000..8c82077
--- /dev/null
+++ b/tests/data/unclosed-bracket.error-message
@@ -0,0 +1,6 @@
+test:
+    - [ foo: bar
+# comment the rest of the stream to let the scanner detect the problem.
+#    - baz
+#"we could have detected the unclosed bracket on the above line, but this would forbid such syntax as": {
+#}
diff --git a/tests/data/unclosed-quoted-scalar.error-message b/tests/data/unclosed-quoted-scalar.error-message
new file mode 100644
index 0000000..8537429
--- /dev/null
+++ b/tests/data/unclosed-quoted-scalar.error-message
@@ -0,0 +1,2 @@
+'foo
+ bar
diff --git a/tests/data/undefined-anchor.error-message b/tests/data/undefined-anchor.error-message
new file mode 100644
index 0000000..9469103
--- /dev/null
+++ b/tests/data/undefined-anchor.error-message
@@ -0,0 +1,3 @@
+- foo
+- &bar baz
+- *bat
diff --git a/tests/data/undefined-constructor.error-message b/tests/data/undefined-constructor.error-message
new file mode 100644
index 0000000..9a37ccc
--- /dev/null
+++ b/tests/data/undefined-constructor.error-message
@@ -0,0 +1 @@
+--- !foo bar
diff --git a/tests/data/undefined-tag-handle.error-message b/tests/data/undefined-tag-handle.error-message
new file mode 100644
index 0000000..82ba335
--- /dev/null
+++ b/tests/data/undefined-tag-handle.error-message
@@ -0,0 +1 @@
+--- !foo!bar    baz
diff --git a/tests/data/value.data b/tests/data/value.data
new file mode 100644
index 0000000..c5b7680
--- /dev/null
+++ b/tests/data/value.data
@@ -0,0 +1 @@
+- =
diff --git a/tests/data/value.detect b/tests/data/value.detect
new file mode 100644
index 0000000..7c37d02
--- /dev/null
+++ b/tests/data/value.detect
@@ -0,0 +1 @@
+tag:yaml.org,2002:value
diff --git a/tests/data/yaml.data b/tests/data/yaml.data
new file mode 100644
index 0000000..a4bb3f8
--- /dev/null
+++ b/tests/data/yaml.data
@@ -0,0 +1,3 @@
+- !!yaml '!'
+- !!yaml '&'
+- !!yaml '*'
diff --git a/tests/data/yaml.detect b/tests/data/yaml.detect
new file mode 100644
index 0000000..e2cf189
--- /dev/null
+++ b/tests/data/yaml.detect
@@ -0,0 +1 @@
+tag:yaml.org,2002:yaml
diff --git a/tests/test_appliance.py b/tests/test_appliance.py
new file mode 100644
index 0000000..12239eb
--- /dev/null
+++ b/tests/test_appliance.py
@@ -0,0 +1,312 @@
+
+import unittest, os
+
+from yaml.tokens import *
+from yaml.events import *
+
+class TestAppliance(unittest.TestCase):
+
+    DATA = 'tests/data'
+
+    all_tests = {}
+    for filename in os.listdir(DATA):
+        if os.path.isfile(os.path.join(DATA, filename)):
+            root, ext = os.path.splitext(filename)
+            all_tests.setdefault(root, []).append(ext)
+
+    def add_tests(cls, method_name, *extensions):
+        for test in cls.all_tests:
+            available_extensions = cls.all_tests[test]
+            for ext in extensions:
+                if ext not in available_extensions:
+                    break
+            else:
+                filenames = [os.path.join(cls.DATA, test+ext) for ext in extensions]
+                def test_method(self, test=test, filenames=filenames):
+                    getattr(self, '_'+method_name)(test, *filenames)
+                test = test.replace('-', '_')
+                try:
+                    test_method.__name__ = '%s_%s' % (method_name, test)
+                except TypeError:
+                    import new
+                    test_method = new.function(test_method.func_code, test_method.func_globals,
+                            '%s_%s' % (method_name, test), test_method.func_defaults,
+                            test_method.func_closure)
+                setattr(cls, test_method.__name__, test_method)
+    add_tests = classmethod(add_tests)
+
+class Error(Exception):
+    pass
+
+class CanonicalScanner:
+
+    def __init__(self, data):
+        self.data = unicode(data, 'utf-8')+u'\0'
+        self.index = 0
+
+    def scan(self):
+        #print self.data[self.index:]
+        tokens = []
+        while True:
+            self.find_token()
+            ch = self.data[self.index]
+            if ch == u'\0':
+                tokens.append(StreamEndToken(None, None))
+                break
+            elif ch == u'%':
+                tokens.append(self.scan_directive())
+            elif ch == u'-' and self.data[self.index:self.index+3] == u'---':
+                self.index += 3
+                tokens.append(DocumentStartToken(None, None))
+            elif ch == u'[':
+                self.index += 1
+                tokens.append(FlowSequenceStartToken(None, None))
+            elif ch == u'{':
+                self.index += 1
+                tokens.append(FlowMappingStartToken(None, None))
+            elif ch == u']':
+                self.index += 1
+                tokens.append(FlowSequenceEndToken(None, None))
+            elif ch == u'}':
+                self.index += 1
+                tokens.append(FlowMappingEndToken(None, None))
+            elif ch == u'?':
+                self.index += 1
+                tokens.append(KeyToken(None, None))
+            elif ch == u':':
+                self.index += 1
+                tokens.append(ValueToken(None, None))
+            elif ch == u',':
+                self.index += 1
+                tokens.append(FlowEntryToken(None, None))
+            elif ch == u'*' or ch == u'&':
+                tokens.append(self.scan_alias())
+            elif ch == u'!':
+                tokens.append(self.scan_tag())
+            elif ch == u'"':
+                tokens.append(self.scan_scalar())
+            else:
+                raise Error("invalid token")
+        return tokens
+
+    DIRECTIVE = u'%YAML 1.1'
+
+    def scan_directive(self):
+        if self.data[self.index:self.index+len(self.DIRECTIVE)] == self.DIRECTIVE and \
+                self.data[self.index+len(self.DIRECTIVE)] in u' \n\0':
+            self.index += len(self.DIRECTIVE)
+            return DirectiveToken('YAML', (1, 1), None, None)
+
+    def scan_alias(self):
+        if self.data[self.index] == u'*':
+            TokenClass = AliasToken
+        else:
+            TokenClass = AnchorToken
+        self.index += 1
+        start = self.index
+        while self.data[self.index] not in u', \n\0':
+            self.index += 1
+        value = self.data[start:self.index]
+        return TokenClass(value, None, None)
+
+    def scan_tag(self):
+        self.index += 1
+        start = self.index
+        while self.data[self.index] not in u' \n\0':
+            self.index += 1
+        value = self.data[start:self.index]
+        if value[0] == u'!':
+            value = 'tag:yaml.org,2002:'+value[1:]
+        elif value[0] == u'<' and value[-1] == u'>':
+            value = value[1:-1]
+        else:
+            value = u'!'+value
+        return TagToken(value, None, None)
+
+    QUOTE_CODES = {
+        'x': 2,
+        'u': 4,
+        'U': 8,
+    }
+
+    QUOTE_REPLACES = {
+        u'\\': u'\\',
+        u'\"': u'\"',
+        u' ': u' ',
+        u'a': u'\x07',
+        u'b': u'\x08',
+        u'e': u'\x1B',
+        u'f': u'\x0C',
+        u'n': u'\x0A',
+        u'r': u'\x0D',
+        u't': u'\x09',
+        u'v': u'\x0B',
+        u'N': u'\u0085',
+        u'L': u'\u2028',
+        u'P': u'\u2029',
+        u'_': u'_',
+        u'0': u'\x00',
+
+    }
+
+    def scan_scalar(self):
+        self.index += 1
+        chunks = []
+        start = self.index
+        ignore_spaces = False
+        while self.data[self.index] != u'"':
+            if self.data[self.index] == u'\\':
+                ignore_spaces = False
+                chunks.append(self.data[start:self.index])
+                self.index += 1
+                ch = self.data[self.index]
+                self.index += 1
+                if ch == u'\n':
+                    ignore_spaces = True
+                elif ch in self.QUOTE_CODES:
+                    length = self.QUOTE_CODES[ch]
+                    code = int(self.data[self.index:self.index+length], 16)
+                    chunks.append(unichr(code))
+                    self.index += length
+                else:
+                    chunks.append(self.QUOTE_REPLACES[ch])
+                start = self.index
+            elif self.data[self.index] == u'\n':
+                chunks.append(self.data[start:self.index])
+                chunks.append(u' ')
+                self.index += 1
+                start = self.index
+                ignore_spaces = True
+            elif ignore_spaces and self.data[self.index] == u' ':
+                self.index += 1
+                start = self.index
+            else:
+                ignore_spaces = False
+                self.index += 1
+        chunks.append(self.data[start:self.index])
+        self.index += 1
+        return ScalarToken(u''.join(chunks), False, None, None)
+
+    def find_token(self):
+        found = False
+        while not found:
+            while self.data[self.index] in u' \t':
+                self.index += 1
+            if self.data[self.index] == u'#':
+                while self.data[self.index] != u'\n':
+                    self.index += 1
+            if self.data[self.index] == u'\n':
+                self.index += 1
+            else:
+                found = True
+
+class CanonicalParser:
+
+    def __init__(self, data):
+        self.scanner = CanonicalScanner(data)
+        self.events = []
+
+    # stream: document* END
+    def parse_stream(self):
+        while not self.test_token(StreamEndToken):
+            if self.test_token(DirectiveToken, DocumentStartToken):
+                self.parse_document()
+            else:
+                raise Error("document is expected, got "+repr(self.tokens[self.index]))
+        self.events.append(StreamEndEvent(None, None))
+
+    # document: DIRECTIVE? DOCUMENT-START node
+    def parse_document(self):
+        node = None
+        if self.test_token(DirectiveToken):
+            self.consume_token(DirectiveToken)
+        self.consume_token(DocumentStartToken)
+        self.parse_node()
+
+    # node: ALIAS | ANCHOR? TAG? (SCALAR|sequence|mapping)
+    def parse_node(self):
+        if self.test_token(AliasToken):
+            self.events.append(AliasEvent(self.get_value(), None, None))
+        else:
+            anchor = None
+            if self.test_token(AnchorToken):
+                anchor = self.get_value()
+            tag = u'!'
+            if self.test_token(TagToken):
+                tag = self.get_value()
+            if self.test_token(ScalarToken):
+                self.events.append(ScalarEvent(anchor, tag, self.get_value(), None, None))
+            elif self.test_token(FlowSequenceStartToken):
+                self.events.append(SequenceEvent(anchor, tag, None, None))
+                self.parse_sequence()
+            elif self.test_token(FlowMappingStartToken):
+                self.events.append(MappingEvent(anchor, tag, None, None))
+                self.parse_mapping()
+            else:
+                raise Error("SCALAR, '[', or '{' is expected, got "+repr(self.tokens[self.index]))
+
+    # sequence: SEQUENCE-START (node (ENTRY node)*)? ENTRY? SEQUENCE-END
+    def parse_sequence(self):
+        self.consume_token(FlowSequenceStartToken)
+        if not self.test_token(FlowSequenceEndToken):
+            self.parse_node()
+            while not self.test_token(FlowSequenceEndToken):
+                self.consume_token(FlowEntryToken)
+                if not self.test_token(FlowSequenceEndToken):
+                    self.parse_node()
+        self.consume_token(FlowSequenceEndToken)
+        self.events.append(CollectionEndEvent(None, None))
+
+    # mapping: MAPPING-START (map_entry (ENTRY map_entry)*)? ENTRY? MAPPING-END
+    def parse_mapping(self):
+        self.consume_token(FlowMappingStartToken)
+        if not self.test_token(FlowMappingEndToken):
+            self.parse_map_entry()
+            while not self.test_token(FlowMappingEndToken):
+                self.consume_token(FlowEntryToken)
+                if not self.test_token(FlowMappingEndToken):
+                    self.parse_map_entry()
+        self.consume_token(FlowMappingEndToken)
+        self.events.append(CollectionEndEvent(None, None))
+
+    # map_entry: KEY node VALUE node
+    def parse_map_entry(self):
+        self.consume_token(KeyToken)
+        self.parse_node()
+        self.consume_token(ValueToken)
+        self.parse_node()
+
+    def test_token(self, *choices):
+        for choice in choices:
+            if isinstance(self.tokens[self.index], choice):
+                return True
+        return False
+
+    def consume_token(self, cls):
+        if not isinstance(self.tokens[self.index], cls):
+            raise Error("unexpected token "+repr(self.tokens[self.index]))
+        self.index += 1
+
+    def get_value(self):
+        value = self.tokens[self.index].value
+        self.index += 1
+        return value
+
+    def parse(self):
+        self.tokens = self.scanner.scan()
+        self.index = 0
+        self.parse_stream()
+        return self.events
+
+    def get(self):
+        return self.events.pop(0)
+
+    def check(self, *choices):
+        for choice in choices:
+            if isinstance(self.events[0], choice):
+                return True
+        return False
+
+    def peek(self):
+        return self.events[0]
+
diff --git a/tests/test_build.py b/tests/test_build.py
new file mode 100644
index 0000000..50f7437
--- /dev/null
+++ b/tests/test_build.py
@@ -0,0 +1,12 @@
+
+def main():
+    import sys, os, distutils.util
+    #build_lib = os.path.join('build', 'lib.%s-%s' % (distutils.util.get_platform(), sys.version[0:3]))
+    build_lib = 'build/lib'
+    sys.path.insert(0, build_lib)
+    import test_yaml
+    test_yaml.main('test_yaml')
+
+if __name__ == '__main__':
+    main()
+
diff --git a/tests/test_canonical.py b/tests/test_canonical.py
new file mode 100644
index 0000000..7fa85dc
--- /dev/null
+++ b/tests/test_canonical.py
@@ -0,0 +1,22 @@
+
+import test_appliance
+
+class TestCanonicalAppliance(test_appliance.TestAppliance):
+
+    def _testCanonicalScanner(self, test_name, canonical_filename):
+        data = file(canonical_filename, 'rb').read()
+        scanner = test_appliance.CanonicalScanner(data)
+        tokens = scanner.scan()
+        #for token in tokens:
+        #    print token
+
+    def _testCanonicalParser(self, test_name, canonical_filename):
+        data = file(canonical_filename, 'rb').read()
+        parser = test_appliance.CanonicalParser(data)
+        events = parser.parse()
+        #for event in events:
+        #    print event
+
+TestCanonicalAppliance.add_tests('testCanonicalScanner', '.canonical')
+TestCanonicalAppliance.add_tests('testCanonicalParser', '.canonical')
+
diff --git a/tests/test_constructor.py b/tests/test_constructor.py
new file mode 100644
index 0000000..794d3e4
--- /dev/null
+++ b/tests/test_constructor.py
@@ -0,0 +1,90 @@
+
+import test_appliance
+try:
+    import datetime
+except ImportError:
+    pass
+try:
+    set
+except NameError:
+    from sets import Set as set
+
+from yaml import *
+
+class MyConstructor(Constructor):
+    pass
+
+class MyTestClass1:
+
+    def __init__(self, x, y=0, z=0):
+        self.x = x
+        self.y = y
+        self.z = z
+
+    def __eq__(self, other):
+        return self.__class__, self.__dict__ == other.__class__, other.__dict__
+
+def construct1(constructor, node):
+    mapping = constructor.construct_mapping(node)
+    return MyTestClass1(**mapping)
+
+MyConstructor.add_constructor("!tag1", construct1)
+
+class MyTestClass2(MyTestClass1, YAMLObject):
+
+    yaml_constructor = MyConstructor
+    yaml_tag = "!tag2"
+
+    def from_yaml(cls, constructor, node):
+        x = constructor.construct_yaml_int(node)
+        return cls(x=x)
+    from_yaml = classmethod(from_yaml)
+
+class MyTestClass3(MyTestClass2):
+
+    yaml_tag = "!tag3"
+
+    def from_yaml(cls, constructor, node):
+        mapping = constructor.construct_mapping(node)
+        if '=' in mapping:
+            x = mapping['=']
+            del mapping['=']
+            mapping['x'] = x
+        return cls(**mapping)
+    from_yaml = classmethod(from_yaml)
+
+class TestTypes(test_appliance.TestAppliance):
+
+    def _testTypes(self, test_name, data_filename, code_filename):
+        natives1 = None
+        natives2 = None
+        try:
+            constructor1 = MyConstructor(Resolver(Composer(Parser(Scanner(Reader(file(data_filename, 'rb')))))))
+            natives1 = list(iter(constructor1))
+            if len(natives1) == 1:
+                natives1 = natives1[0]
+            natives2 = eval(file(code_filename, 'rb').read())
+            try:
+                self.failUnlessEqual(natives1, natives2)
+            except AssertionError:
+                if isinstance(natives1, dict):
+                    natives1 = natives1.items()
+                    natives1.sort()
+                    natives1 = repr(natives1)
+                    natives2 = natives2.items()
+                    natives2.sort()
+                    natives2 = repr(natives2)
+                if natives1 != natives2:
+                    raise
+        except:
+            print
+            print "DATA:"
+            print file(data_filename, 'rb').read()
+            print "CODE:"
+            print file(code_filename, 'rb').read()
+            print "NATIVES1:", natives1
+            print "NATIVES2:", natives2
+            raise
+
+TestTypes.add_tests('testTypes', '.data', '.code')
+
diff --git a/tests/test_detector.py b/tests/test_detector.py
new file mode 100644
index 0000000..491929d
--- /dev/null
+++ b/tests/test_detector.py
@@ -0,0 +1,36 @@
+
+import test_appliance
+
+from yaml.reader import Reader
+from yaml.scanner import Scanner
+from yaml.parser import *
+from yaml.composer import *
+from yaml.resolver import *
+from yaml.nodes import *
+
+class TestDetector(test_appliance.TestAppliance):
+
+    def _testDetector(self, test_name, data_filename, detect_filename):
+        node = None
+        correct_tag = None
+        try:
+            correct_tag = file(detect_filename, 'rb').read().strip()
+            resolver = Resolver(Composer(Parser(Scanner(Reader(file(data_filename, 'rb'))))))
+            node = list(iter(resolver))[0]
+            self.failUnless(isinstance(node, SequenceNode))
+            for scalar in node.value:
+                self.failUnless(isinstance(scalar, ScalarNode))
+                self.failUnlessEqual(scalar.tag, correct_tag)
+        except:
+            print
+            print "DATA:"
+            print file(data_filename, 'rb').read()
+            print "CORRECT_TAG:"
+            print file(detect_filename, 'rb').read()
+            print "ROOT NODE:", node
+            print "SCALAR NODES:", node.value
+            raise
+
+TestDetector.add_tests('testDetector', '.data', '.detect')
+
+
diff --git a/tests/test_errors.py b/tests/test_errors.py
new file mode 100644
index 0000000..626b4e4
--- /dev/null
+++ b/tests/test_errors.py
@@ -0,0 +1,55 @@
+
+import test_appliance
+
+from yaml import *
+
+class TestErrors(test_appliance.TestAppliance):
+
+    def _testErrors(self, test_name, invalid_filename):
+        #self._load(invalid_filename)
+        self.failUnlessRaises(YAMLError, lambda: self._load(invalid_filename))
+
+    def _testStringErrors(self, test_name, invalid_filename):
+        #self._load_string(invalid_filename)
+        self.failUnlessRaises(YAMLError, lambda: self._load_string(invalid_filename))
+
+    def _load(self, filename):
+        try:
+            reader = Reader(file(filename, 'rb'))
+            scanner = Scanner(reader)
+            parser = Parser(scanner)
+            composer = Composer(parser)
+            resolver = Resolver(composer)
+            constructor = Constructor(resolver)
+            return list(constructor)
+        except YAMLError, exc:
+        #except ScannerError, exc:
+        #except ParserError, exc:
+        #except ComposerError, exc:
+        #except ConstructorError, exc:
+            #print '.'*70
+            #print "%s:" % exc.__class__.__name__, exc
+            raise
+
+    def _load_string(self, filename):
+        try:
+            reader = Reader(file(filename, 'rb').read())
+            scanner = Scanner(reader)
+            parser = Parser(scanner)
+            composer = Composer(parser)
+            resolver = Resolver(composer)
+            constructor = Constructor(resolver)
+            return list(constructor)
+        except YAMLError, exc:
+        #except ScannerError, exc:
+        #except ParserError, exc:
+        #except ComposerError, exc:
+        #except ConstructorError, exc:
+            #print '.'*70
+            #print "%s:" % filename
+            #print "%s:" % exc.__class__.__name__, exc
+            raise
+
+TestErrors.add_tests('testErrors', '.error-message')
+TestErrors.add_tests('testStringErrors', '.error-message')
+
diff --git a/tests/test_marker.py b/tests/test_marker.py
new file mode 100644
index 0000000..9ea4474
--- /dev/null
+++ b/tests/test_marker.py
@@ -0,0 +1,34 @@
+
+import test_appliance
+
+from yaml.reader import Marker
+
+class TestMarker(test_appliance.TestAppliance):
+
+    def _testMarkers(self, test_name, markers_filename):
+        inputs = file(markers_filename, 'rb').read().split('---\n')[1:]
+        for input in inputs:
+            index = 0
+            line = 0
+            column = 0
+            while input[index] != '*':
+                if input[index] == '\n':
+                    line += 1
+                    column = 0
+                else:
+                    column += 1
+                index += 1
+            marker = Marker(test_name, line, column, unicode(input), index)
+            snippet = marker.get_snippet(indent=2, max_length=79)
+            #print "INPUT:"
+            #print input
+            #print "SNIPPET:"
+            #print snippet
+            self.failUnless(isinstance(snippet, str))
+            self.failUnlessEqual(snippet.count('\n'), 1)
+            data, pointer = snippet.split('\n')
+            self.failUnless(len(data) < 82)
+            self.failUnlessEqual(data[len(pointer)-1], '*')
+
+TestMarker.add_tests('testMarkers', '.markers')
+
diff --git a/tests/test_reader.py b/tests/test_reader.py
new file mode 100644
index 0000000..1bfae1a
--- /dev/null
+++ b/tests/test_reader.py
@@ -0,0 +1,44 @@
+
+import test_appliance
+from yaml.reader import Reader, ReaderError
+
+import codecs
+
+class TestReaderErrors(test_appliance.TestAppliance):
+
+    def _testReaderUnicodeErrors(self, test_name, stream_filename):
+        for encoding in ['utf-8', 'utf-16-le', 'utf-16-be']:
+            try:
+                data = unicode(file(stream_filename, 'rb').read(), encoding)
+                break
+            except:
+                pass
+        else:
+            return
+        #self._load(data)
+        self.failUnlessRaises(ReaderError,
+                lambda: self._load(data))
+        #self._load(codecs.open(stream_filename, encoding=encoding))
+        self.failUnlessRaises(ReaderError,
+                lambda: self._load(codecs.open(stream_filename, encoding=encoding)))
+
+    def _testReaderStringErrors(self, test_name, stream_filename):
+        data = file(stream_filename, 'rb').read()
+        #self._load(data)
+        self.failUnlessRaises(ReaderError, lambda: self._load(data))
+
+    def _testReaderFileErrors(self, test_name, stream_filename):
+        data = file(stream_filename, 'rb')
+        #self._load(data)
+        self.failUnlessRaises(ReaderError, lambda: self._load(data))
+
+    def _load(self, data):
+        stream = Reader(data)
+        while stream.peek() != u'\0':
+            stream.forward()
+
+TestReaderErrors.add_tests('testReaderUnicodeErrors', '.stream-error')
+TestReaderErrors.add_tests('testReaderStringErrors', '.stream-error')
+TestReaderErrors.add_tests('testReaderFileErrors', '.stream-error')
+
+
diff --git a/tests/test_structure.py b/tests/test_structure.py
new file mode 100644
index 0000000..985d2c3
--- /dev/null
+++ b/tests/test_structure.py
@@ -0,0 +1,218 @@
+
+import test_appliance
+
+from yaml import *
+
+class TestStructure(test_appliance.TestAppliance):
+
+    def _testStructure(self, test_name, data_filename, structure_filename):
+        node1 = None
+        node2 = eval(file(structure_filename, 'rb').read())
+        try:
+            parser = Parser(Scanner(Reader(file(data_filename, 'rb'))))
+            node1 = []
+            while not parser.check(StreamEndEvent):
+                node1.append(self._convert(parser))
+            parser.get()
+            if len(node1) == 1:
+                node1 = node1[0]
+            self.failUnlessEqual(node1, node2)
+        except:
+            print
+            print "DATA:"
+            print file(data_filename, 'rb').read()
+            print "NODE1:", node1
+            print "NODE2:", node2
+            raise
+
+    def _convert(self, parser):
+        if parser.check(ScalarEvent):
+            event = parser.get()
+            if event.tag or event.anchor or event.value:
+                return True
+            else:
+                return None
+        elif parser.check(SequenceEvent):
+            parser.get()
+            sequence = []
+            while not parser.check(CollectionEndEvent):
+                sequence.append(self._convert(parser))
+            parser.get()
+            return sequence
+        elif parser.check(MappingEvent):
+            parser.get()
+            mapping = []
+            while not parser.check(CollectionEndEvent):
+                key = self._convert(parser)
+                value = self._convert(parser)
+                mapping.append((key, value))
+            parser.get()
+            return mapping
+        elif parser.check(AliasEvent):
+            parser.get()
+            return '*'
+        else:
+            parser.get()
+            return '?'
+
+TestStructure.add_tests('testStructure', '.data', '.structure')
+
+class TestParser(test_appliance.TestAppliance):
+
+    def _testParser(self, test_name, data_filename, canonical_filename):
+        events1 = None
+        events2 = None
+        try:
+            parser = Parser(Scanner(Reader(file(data_filename, 'rb'))))
+            events1 = list(iter(parser))
+            canonical = test_appliance.CanonicalParser(file(canonical_filename, 'rb').read())
+            events2 = canonical.parse()
+            self._compare(events1, events2)
+        except:
+            print
+            print "DATA1:"
+            print file(data_filename, 'rb').read()
+            print "DATA2:"
+            print file(canonical_filename, 'rb').read()
+            print "EVENTS1:", events1
+            print "EVENTS2:", events2
+            raise
+
+    def _compare(self, events1, events2):
+        self.failUnlessEqual(len(events1), len(events2))
+        for event1, event2 in zip(events1, events2):
+            self.failUnlessEqual(event1.__class__, event2.__class__)
+            if isinstance(event1, AliasEvent):
+                #self.failUnlessEqual(event1.name, event2.name)
+                pass
+            elif isinstance(event1, ScalarEvent):
+                #self.failUnlessEqual(event1.anchor, event2.anchor)
+                #self.failUnlessEqual(event1.tag, event2.tag)
+                self.failUnlessEqual(event1.value, event2.value)
+            if isinstance(event1, CollectionEvent):
+                #self.failUnlessEqual(event1.anchor, event2.anchor)
+                #self.failUnlessEqual(event1.tag, event2.tag)
+                pass
+
+TestParser.add_tests('testParser', '.data', '.canonical')
+
+class TestResolver(test_appliance.TestAppliance):
+
+    def _testResolver(self, test_name, data_filename, canonical_filename):
+        nodes1 = None
+        nodes2 = None
+        try:
+            resolver1 = Resolver(Composer(Parser(Scanner(Reader(file(data_filename, 'rb'))))))
+            nodes1 = list(iter(resolver1))
+            canonical = test_appliance.CanonicalParser(file(canonical_filename, 'rb').read())
+            canonical.parse()
+            resolver2 = Resolver(Composer(canonical))
+            nodes2 = list(iter(resolver2))
+            self.failUnlessEqual(len(nodes1), len(nodes2))
+            for node1, node2 in zip(nodes1, nodes2):
+                self._compare(node1, node2)
+        except:
+            print
+            print "DATA1:"
+            print file(data_filename, 'rb').read()
+            print "DATA2:"
+            print file(canonical_filename, 'rb').read()
+            print "NODES1:", nodes1
+            print "NODES2:", nodes2
+            raise
+
+    def _compare(self, node1, node2):
+        self.failUnlessEqual(node1.__class__, node2.__class__)
+        if isinstance(node1, ScalarNode):
+            #self.failUnlessEqual(node1.tag, node2.tag)
+            self.failUnlessEqual(node1.value, node2.value)
+        elif isinstance(node1, SequenceNode):
+            self.failUnlessEqual(len(node1.value), len(node2.value))
+            for item1, item2 in zip(node1.value, node2.value):
+                self._compare(item1, item2)
+        elif isinstance(node1, MappingNode):
+            self.failUnlessEqual(len(node1.value), len(node2.value))
+            items1 = node1.value.items()
+            items1.sort(lambda (k1,v1), (k2,v2): cmp((k1.tag,k1.value,v1.tag,v1.value),
+                                                    (k2.tag,k2.value,v2.tag,v2.value)))
+            items2 = node2.value.items()
+            items2.sort(lambda (k1,v1), (k2,v2): cmp((k1.tag,k1.value,v1.tag,v1.value),
+                                                    (k2.tag,k2.value,v2.tag,v2.value)))
+            for (key1, value1), (key2, value2) in zip(items1, items2):
+                self._compare(key1, key2)
+                self._compare(value1, value2)
+
+TestResolver.add_tests('testResolver', '.data', '.canonical')
+
+class MyConstructor(Constructor):
+
+    def construct_sequence(self, node):
+        return tuple(Constructor.construct_sequence(self, node))
+
+    def construct_mapping(self, node):
+        pairs = self.construct_pairs(node)
+        pairs.sort()
+        return pairs
+
+MyConstructor.add_constructor(None, MyConstructor.construct_scalar)
+
+class TestConstructor(test_appliance.TestAppliance):
+
+    def _testConstructor(self, test_name, data_filename, canonical_filename):
+        natives1 = None
+        natives2 = None
+        try:
+            constructor1 = MyConstructor(Resolver(Composer(Parser(Scanner(Reader(file(data_filename, 'rb')))))))
+            natives1 = list(iter(constructor1))
+            canonical = test_appliance.CanonicalParser(file(canonical_filename, 'rb').read())
+            canonical.parse()
+            constructor2 = MyConstructor(Resolver(Composer(canonical)))
+            natives2 = list(iter(constructor2))
+            self.failUnlessEqual(natives1, natives2)
+        except:
+            print
+            print "DATA1:"
+            print file(data_filename, 'rb').read()
+            print "DATA2:"
+            print file(canonical_filename, 'rb').read()
+            print "NATIVES1:", natives1
+            print "NATIVES2:", natives2
+            raise
+
+TestConstructor.add_tests('testConstructor', '.data', '.canonical')
+
+class TestParserOnCanonical(test_appliance.TestAppliance):
+
+    def _testParserOnCanonical(self, test_name, canonical_filename):
+        events1 = None
+        events2 = None
+        try:
+            parser = Parser(Scanner(Reader(file(canonical_filename, 'rb'))))
+            events1 = list(iter(parser))
+            canonical = test_appliance.CanonicalParser(file(canonical_filename, 'rb').read())
+            events2 = canonical.parse()
+            self._compare(events1, events2)
+        except:
+            print
+            print "DATA:"
+            print file(canonical_filename, 'rb').read()
+            print "EVENTS1:", events1
+            print "EVENTS2:", events2
+            raise
+
+    def _compare(self, events1, events2):
+        self.failUnlessEqual(len(events1), len(events2))
+        for event1, event2 in zip(events1, events2):
+            self.failUnlessEqual(event1.__class__, event2.__class__)
+            if isinstance(event1, AliasEvent):
+                self.failUnlessEqual(event1.anchor, event2.anchor)
+            elif isinstance(event1, ScalarEvent):
+                self.failUnlessEqual(event1.anchor, event2.anchor)
+                self.failUnlessEqual(event1.tag, event2.tag)
+                self.failUnlessEqual(event1.value, event2.value)
+            if isinstance(event1, CollectionEvent):
+                self.failUnlessEqual(event1.anchor, event2.anchor)
+                self.failUnlessEqual(event1.tag, event2.tag)
+
+TestParserOnCanonical.add_tests('testParserOnCanonical', '.canonical')
+
diff --git a/tests/test_syck.py b/tests/test_syck.py
new file mode 100644
index 0000000..dd63056
--- /dev/null
+++ b/tests/test_syck.py
@@ -0,0 +1,30 @@
+
+import test_appliance
+
+class TestSyck(test_appliance.TestAppliance):
+
+    def _testSyckOnTokenTests(self, test_name, data_filename, tokens_filename):
+        try:
+            syck.parse(file(data_filename, 'rb'))
+        except:
+            print
+            print "DATA:"
+            print file(data_filename, 'rb').read()
+            raise
+
+    def _testSyckOnCanonicalTests(self, test_name, data_filename, canonical_filename):
+        try:
+            syck.parse(file(data_filename, 'rb'))
+        except:
+            print
+            print "DATA:"
+            print file(data_filename, 'rb').read()
+            raise
+
+try:
+    import syck
+    #TestSyck.add_tests('testSyckOnTokenTests', '.data', '.tokens')
+    #TestSyck.add_tests('testSyckOnCanonicalTests', '.data', '.canonical')
+except ImportError:
+    pass
+
diff --git a/tests/test_tokens.py b/tests/test_tokens.py
new file mode 100644
index 0000000..2ccc305
--- /dev/null
+++ b/tests/test_tokens.py
@@ -0,0 +1,90 @@
+
+import test_appliance
+
+from yaml.reader import *
+from yaml.tokens import *
+from yaml.scanner import *
+
+class TestTokens(test_appliance.TestAppliance):
+
+    # Tokens mnemonic:
+    # directive:            %
+    # document_start:       ---
+    # document_end:         ...
+    # alias:                *
+    # anchor:               &
+    # tag:                  !
+    # scalar                _
+    # block_sequence_start: [[
+    # block_mapping_start:  {{
+    # block_end:            ]}
+    # flow_sequence_start:  [
+    # flow_sequence_end:    ]
+    # flow_mapping_start:   {
+    # flow_mapping_end:     }
+    # entry:                ,
+    # key:                  ?
+    # value:                :
+
+    replaces = {
+        DirectiveToken: '%',
+        DocumentStartToken: '---',
+        DocumentEndToken: '...',
+        AliasToken: '*',
+        AnchorToken: '&',
+        TagToken: '!',
+        ScalarToken: '_',
+        BlockSequenceStartToken: '[[',
+        BlockMappingStartToken: '{{',
+        BlockEndToken: ']}',
+        FlowSequenceStartToken: '[',
+        FlowSequenceEndToken: ']',
+        FlowMappingStartToken: '{',
+        FlowMappingEndToken: '}',
+        BlockEntryToken: ',',
+        FlowEntryToken: ',',
+        KeyToken: '?',
+        ValueToken: ':',
+    }
+
+    def _testTokens(self, test_name, data_filename, tokens_filename):
+        tokens1 = None
+        tokens2 = file(tokens_filename, 'rb').read().split()
+        try:
+            scanner = Scanner(Reader(file(data_filename, 'rb')))
+            tokens1 = []
+            for token in scanner:
+                if not isinstance(token, StreamEndToken):
+                    tokens1.append(token)
+            tokens1 = [self.replaces[t.__class__] for t in tokens1]
+            self.failUnlessEqual(tokens1, tokens2)
+        except:
+            print
+            print "DATA:"
+            print file(data_filename, 'rb').read()
+            print "TOKENS1:", tokens1
+            print "TOKENS2:", tokens2
+            raise
+
+TestTokens.add_tests('testTokens', '.data', '.tokens')
+
+class TestScanner(test_appliance.TestAppliance):
+
+    def _testScanner(self, test_name, data_filename, canonical_filename):
+        for filename in [canonical_filename, data_filename]:
+            tokens = None
+            try:
+                scanner = Scanner(Reader(file(filename, 'rb')))
+                tokens = []
+                for token in scanner:
+                    if not isinstance(token, StreamEndToken):
+                        tokens.append(token.__class__.__name__)
+            except:
+                print
+                print "DATA:"
+                print file(data_filename, 'rb').read()
+                print "TOKENS:", tokens
+                raise
+
+TestScanner.add_tests('testScanner', '.data', '.canonical')
+
diff --git a/tests/test_yaml.py b/tests/test_yaml.py
new file mode 100644
index 0000000..cfd4e79
--- /dev/null
+++ b/tests/test_yaml.py
@@ -0,0 +1,19 @@
+
+import unittest
+
+from test_marker import *
+from test_reader import *
+from test_canonical import *
+from test_tokens import *
+from test_structure import *
+from test_errors import *
+from test_detector import *
+from test_constructor import *
+from test_syck import *
+
+def main(module='__main__'):
+    unittest.main(module)
+
+if __name__ == '__main__':
+    main()
+