diff --git a/build.zig b/build.zig index 2570831..626ffc0 100644 --- a/build.zig +++ b/build.zig @@ -11,18 +11,26 @@ const snapshot_files: []const []const u8 = &.{ }; const conformance_accept_files: []const []const u8 = &.{ + "test/conformance/accept/header_and_title_order.hdoc", + "test/conformance/accept/image_with_required_path.hdoc", "test/conformance/accept/inline_escape.hdoc", + "test/conformance/accept/no_title_document.hdoc", "test/conformance/accept/title_header_redundant.hdoc", }; const conformance_reject_files: []const []const u8 = &.{ - "test/conformance/reject/string_cr_escape.hdoc", - "test/conformance/reject/inline_identifier_dash.hdoc", + "test/conformance/reject/container_children.hdoc", + "test/conformance/reject/duplicate_header.hdoc", + "test/conformance/reject/hdoc_body_non_empty.hdoc", "test/conformance/reject/heading_sequence.hdoc", + "test/conformance/reject/image_missing_path.hdoc", + "test/conformance/reject/inline_identifier_dash.hdoc", + "test/conformance/reject/missing_header.hdoc", "test/conformance/reject/nested_top_level.hdoc", - "test/conformance/reject/container_children.hdoc", "test/conformance/reject/time_relative_fmt.hdoc", "test/conformance/reject/ref_in_heading.hdoc", + "test/conformance/reject/string_cr_escape.hdoc", + "test/conformance/reject/title_after_content.hdoc", }; pub fn build(b: *std.Build) void { diff --git a/test/conformance/accept/header_and_title_order.hdoc b/test/conformance/accept/header_and_title_order.hdoc new file mode 100644 index 0000000..3357233 --- /dev/null +++ b/test/conformance/accept/header_and_title_order.hdoc @@ -0,0 +1,5 @@ +hdoc(version="2.0", lang="en"); + +title { Proper Order } + +p "Body content" diff --git a/test/conformance/accept/header_and_title_order.yaml b/test/conformance/accept/header_and_title_order.yaml new file mode 100644 index 0000000..604bdd5 --- /dev/null +++ b/test/conformance/accept/header_and_title_order.yaml @@ -0,0 +1,24 @@ +document: + version: + major: 2 + minor: 0 + lang: "en" + title: + simple: "Proper Order" + full: + lang: "" + content: + - [] "Proper Order" + author: null + date: null + toc: + level: h1 + headings: [] + children: [] + contents: + - paragraph: + lang: "" + content: + - [] "Body content" + ids: + - null diff --git a/test/conformance/accept/image_with_required_path.hdoc b/test/conformance/accept/image_with_required_path.hdoc new file mode 100644 index 0000000..5152870 --- /dev/null +++ b/test/conformance/accept/image_with_required_path.hdoc @@ -0,0 +1,3 @@ +hdoc(version="2.0", lang="en"); + +img(path="media/picture.png", alt="Example figure") { Figure caption } diff --git a/test/conformance/accept/image_with_required_path.yaml b/test/conformance/accept/image_with_required_path.yaml new file mode 100644 index 0000000..9376937 --- /dev/null +++ b/test/conformance/accept/image_with_required_path.yaml @@ -0,0 +1,21 @@ +document: + version: + major: 2 + minor: 0 + lang: "en" + title: null + author: null + date: null + toc: + level: h1 + headings: [] + children: [] + contents: + - image: + lang: "" + alt: "Example figure" + path: "media/picture.png" + content: + - [] "Figure caption" + ids: + - null diff --git a/test/conformance/accept/no_title_document.hdoc b/test/conformance/accept/no_title_document.hdoc new file mode 100644 index 0000000..1c046ef --- /dev/null +++ b/test/conformance/accept/no_title_document.hdoc @@ -0,0 +1,3 @@ +hdoc(version="2.0", lang="en"); + +p "Untitled body" diff --git a/test/conformance/accept/no_title_document.yaml b/test/conformance/accept/no_title_document.yaml new file mode 100644 index 0000000..4be7da4 --- /dev/null +++ b/test/conformance/accept/no_title_document.yaml @@ -0,0 +1,19 @@ +document: + version: + major: 2 + minor: 0 + lang: "en" + title: null + author: null + date: null + toc: + level: h1 + headings: [] + children: [] + contents: + - paragraph: + lang: "" + content: + - [] "Untitled body" + ids: + - null diff --git a/test/conformance/reject/duplicate_header.diag b/test/conformance/reject/duplicate_header.diag new file mode 100644 index 0000000..79d5d3b --- /dev/null +++ b/test/conformance/reject/duplicate_header.diag @@ -0,0 +1,20 @@ +[ + { + "code": { + "misplaced_hdoc_header": {} + }, + "location": { + "line": 3, + "column": 1 + } + }, + { + "code": { + "duplicate_hdoc_header": {} + }, + "location": { + "line": 3, + "column": 1 + } + } +] diff --git a/test/conformance/reject/duplicate_header.hdoc b/test/conformance/reject/duplicate_header.hdoc new file mode 100644 index 0000000..faeb809 --- /dev/null +++ b/test/conformance/reject/duplicate_header.hdoc @@ -0,0 +1,5 @@ +hdoc(version="2.0", lang="en"); + +hdoc(version="2.0", lang="en"); + +p "Duplicate headers" diff --git a/test/conformance/reject/hdoc_body_non_empty.diag b/test/conformance/reject/hdoc_body_non_empty.diag new file mode 100644 index 0000000..1b0ff8b --- /dev/null +++ b/test/conformance/reject/hdoc_body_non_empty.diag @@ -0,0 +1,11 @@ +[ + { + "code": { + "non_empty_hdoc_body": {} + }, + "location": { + "line": 1, + "column": 1 + } + } +] diff --git a/test/conformance/reject/hdoc_body_non_empty.hdoc b/test/conformance/reject/hdoc_body_non_empty.hdoc new file mode 100644 index 0000000..cf1aa2a --- /dev/null +++ b/test/conformance/reject/hdoc_body_non_empty.hdoc @@ -0,0 +1 @@ +hdoc(version="2.0", lang="en") "not empty" diff --git a/test/conformance/reject/image_missing_path.diag b/test/conformance/reject/image_missing_path.diag new file mode 100644 index 0000000..9cc8cbe --- /dev/null +++ b/test/conformance/reject/image_missing_path.diag @@ -0,0 +1,14 @@ +[ + { + "code": { + "missing_attribute": { + "type": "img", + "name": "path" + } + }, + "location": { + "line": 3, + "column": 1 + } + } +] diff --git a/test/conformance/reject/image_missing_path.hdoc b/test/conformance/reject/image_missing_path.hdoc new file mode 100644 index 0000000..3051dc6 --- /dev/null +++ b/test/conformance/reject/image_missing_path.hdoc @@ -0,0 +1,3 @@ +hdoc(version="2.0", lang="en"); + +img { Figure caption } diff --git a/test/conformance/reject/missing_header.diag b/test/conformance/reject/missing_header.diag new file mode 100644 index 0000000..901fdd5 --- /dev/null +++ b/test/conformance/reject/missing_header.diag @@ -0,0 +1,11 @@ +[ + { + "code": { + "missing_hdoc_header": {} + }, + "location": { + "line": 1, + "column": 1 + } + } +] diff --git a/test/conformance/reject/missing_header.hdoc b/test/conformance/reject/missing_header.hdoc new file mode 100644 index 0000000..f942349 --- /dev/null +++ b/test/conformance/reject/missing_header.hdoc @@ -0,0 +1 @@ +p "No header present" diff --git a/test/conformance/reject/title_after_content.diag b/test/conformance/reject/title_after_content.diag new file mode 100644 index 0000000..8d0abcb --- /dev/null +++ b/test/conformance/reject/title_after_content.diag @@ -0,0 +1,11 @@ +[ + { + "code": { + "misplaced_title_block": {} + }, + "location": { + "line": 5, + "column": 1 + } + } +] diff --git a/test/conformance/reject/title_after_content.hdoc b/test/conformance/reject/title_after_content.hdoc new file mode 100644 index 0000000..8aa7651 --- /dev/null +++ b/test/conformance/reject/title_after_content.hdoc @@ -0,0 +1,5 @@ +hdoc(version="2.0", lang="en"); + +p "First content" + +title { Late Title }