diff --git a/llvm/test/YAMLParser/spec-02-17.test b/llvm/test/YAMLParser/spec-02-17.test index 2bcb60c8d933b..e7b0147a0fcd8 100644 --- a/llvm/test/YAMLParser/spec-02-17.test +++ b/llvm/test/YAMLParser/spec-02-17.test @@ -1,4 +1,4 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s unicode: "Sosa did fine.\u263A" control: "\b1998\t1999\t2000\n" diff --git a/llvm/test/YAMLParser/spec-05-13.test b/llvm/test/YAMLParser/spec-05-13.test index db62e866a755a..e7ec42a4aaa80 100644 --- a/llvm/test/YAMLParser/spec-05-13.test +++ b/llvm/test/YAMLParser/spec-05-13.test @@ -1,4 +1,5 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: "Text containing \n both space and\t\n \ttab\tcharacters" "Text containing both space and diff --git a/llvm/test/YAMLParser/spec-05-14.test b/llvm/test/YAMLParser/spec-05-14.test index 65451651b69e9..984f3721312ab 100644 --- a/llvm/test/YAMLParser/spec-05-14.test +++ b/llvm/test/YAMLParser/spec-05-14.test @@ -1,4 +1,4 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace "Fun with \\ \" \a \b \e \f \ diff --git a/llvm/test/YAMLParser/spec-09-01.test b/llvm/test/YAMLParser/spec-09-01.test index 8999b49616264..2b5a6f31166dd 100644 --- a/llvm/test/YAMLParser/spec-09-01.test +++ b/llvm/test/YAMLParser/spec-09-01.test @@ -1,4 +1,13 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: !!map { +# CHECK-NEXT: ? !!str "simple key" +# CHECK-NEXT: : !!map { +# CHECK-NEXT: ? !!str "also simple" +# CHECK-NEXT: : !!str "value", +# CHECK-NEXT: ? !!str "not a\n simple key" +# CHECK-NEXT: : !!str "any\n value", +# CHECK-NEXT: }, +# CHECK-NEXT: } "simple key" : { "also simple" : value, diff --git a/llvm/test/YAMLParser/spec-09-02.test b/llvm/test/YAMLParser/spec-09-02.test index 3f8e49a8bd310..6b68a00e3fc3e 100644 --- a/llvm/test/YAMLParser/spec-09-02.test +++ b/llvm/test/YAMLParser/spec-09-02.test @@ -1,14 +1,17 @@ -# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s +# RUN: yaml-bench -canonical %s 2>&1 | FileCheck %s --strict-whitespace +# CHECK: "as space\n trimmed \n specific\L\n escaped\t \n none" - "as space - trimmed +## Note: The example was originally taken from Spec 1.1, but the parsing rules +## have been changed since then. +## * The paragraph-separator character '\u2029' is excluded from line-break +## characters, so the original sequence "escaped\t\\\u2029" is no longer +## considered valid. This is replaced by "escaped\t\\\n" in the test source. +## See https://yaml.org/spec/1.2.2/ext/changes/ for details. - specific + "as space + trimmed + specific
 escaped \ + none" - -# FIXME: The string below should actually be -# "as space trimmed\nspecific\nescaped\tnone", but the parser currently has -# a bug when parsing multiline quoted strings. -# CHECK: !!str "as space\n trimmed\n specific\n escaped\t none" diff --git a/llvm/test/YAMLParser/spec-09-03.test b/llvm/test/YAMLParser/spec-09-03.test index 3fb0d8b184abb..c656058b7ff8b 100644 --- a/llvm/test/YAMLParser/spec-09-03.test +++ b/llvm/test/YAMLParser/spec-09-03.test @@ -1,4 +1,9 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: !!seq [ +# CHECK-NEXT: !!str "\n last", +# CHECK-NEXT: !!str " \t\n last", +# CHECK-NEXT: !!str " \tfirst\n last", +# CHECK-NEXT: ] - " last" diff --git a/llvm/test/YAMLParser/spec-09-04.test b/llvm/test/YAMLParser/spec-09-04.test index 4178ec6befbd5..1e904eaa70992 100644 --- a/llvm/test/YAMLParser/spec-09-04.test +++ b/llvm/test/YAMLParser/spec-09-04.test @@ -1,4 +1,5 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: "first\n \tinner 1\t\n inner 2 last" "first inner 1 diff --git a/llvm/test/YAMLParser/spec-09-05.test b/llvm/test/YAMLParser/spec-09-05.test index e482d5366235b..5eb5b22f421d6 100644 --- a/llvm/test/YAMLParser/spec-09-05.test +++ b/llvm/test/YAMLParser/spec-09-05.test @@ -1,4 +1,9 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: !!seq [ +# CHECK-NEXT: !!str "first\n \t", +# CHECK-NEXT: !!str "first\n \tlast", +# CHECK-NEXT: !!str "first\n inner\n \tlast", +# CHECK-NEXT: ] - "first " diff --git a/llvm/test/YAMLParser/spec-09-06.test b/llvm/test/YAMLParser/spec-09-06.test index edc0cbba9004c..084cda1cd52d7 100644 --- a/llvm/test/YAMLParser/spec-09-06.test +++ b/llvm/test/YAMLParser/spec-09-06.test @@ -1,3 +1,4 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s +# CHECK: "here's to \"quotes\"" 'here''s to "quotes"' diff --git a/llvm/test/YAMLParser/spec-09-07.test b/llvm/test/YAMLParser/spec-09-07.test index 3c010ca5b93bd..71007e79b79d2 100644 --- a/llvm/test/YAMLParser/spec-09-07.test +++ b/llvm/test/YAMLParser/spec-09-07.test @@ -1,4 +1,13 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: !!map { +# CHECK-NEXT: ? !!str "simple key" +# CHECK-NEXT: : !!map { +# CHECK-NEXT: ? !!str "also simple" +# CHECK-NEXT: : !!str "value", +# CHECK-NEXT: ? !!str "not a\n simple key" +# CHECK-NEXT: : !!str "any\n value", +# CHECK-NEXT: }, +# CHECK-NEXT: } 'simple key' : { 'also simple' : value, diff --git a/llvm/test/YAMLParser/spec-09-08.test b/llvm/test/YAMLParser/spec-09-08.test index d114e58fcac15..5d1f13b0e31df 100644 --- a/llvm/test/YAMLParser/spec-09-08.test +++ b/llvm/test/YAMLParser/spec-09-08.test @@ -1,3 +1,8 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: "as space\t\n trimmed \n \n specific\L\n none" - 'as space … trimmed …… specific
… none' + 'as space + trimmed + + specific
 + none' diff --git a/llvm/test/YAMLParser/spec-09-09.test b/llvm/test/YAMLParser/spec-09-09.test index 2fec1b536ef13..181971bd13495 100644 --- a/llvm/test/YAMLParser/spec-09-09.test +++ b/llvm/test/YAMLParser/spec-09-09.test @@ -1,4 +1,9 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: !!seq [ +# CHECK-NEXT: !!str "\n last", +# CHECK-NEXT: !!str " \t\n last", +# CHECK-NEXT: !!str " \tfirst\n last", +# CHECK-NEXT: ] - ' last' diff --git a/llvm/test/YAMLParser/spec-09-10.test b/llvm/test/YAMLParser/spec-09-10.test index faabfb06b5ec2..f75834fa4dda5 100644 --- a/llvm/test/YAMLParser/spec-09-10.test +++ b/llvm/test/YAMLParser/spec-09-10.test @@ -1,4 +1,5 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: "first\n \tinner\t\n last" 'first inner diff --git a/llvm/test/YAMLParser/spec-09-11.test b/llvm/test/YAMLParser/spec-09-11.test index 3f487ad6b0439..b1f8f45f954af 100644 --- a/llvm/test/YAMLParser/spec-09-11.test +++ b/llvm/test/YAMLParser/spec-09-11.test @@ -1,4 +1,8 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: !!seq [ +# CHECK-NEXT: !!str "first\n \t", +# CHECK-NEXT: !!str "first\n\n \tlast", +# CHECK-NEXT: ] - 'first ' diff --git a/llvm/test/YAMLParser/spec-09-13.test b/llvm/test/YAMLParser/spec-09-13.test index d48f2d2c47ee3..015f38951ebbd 100644 --- a/llvm/test/YAMLParser/spec-09-13.test +++ b/llvm/test/YAMLParser/spec-09-13.test @@ -1,4 +1,13 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: !!map { +# CHECK-NEXT: ? !!str "simple key" +# CHECK-NEXT: : !!map { +# CHECK-NEXT: ? !!str "also simple" +# CHECK-NEXT: : !!str "value", +# CHECK-NEXT: ? !!str "not a\n simple key" +# CHECK-NEXT: : !!str "any\n value", +# CHECK-NEXT: }, +# CHECK-NEXT: } simple key : { also simple : value, diff --git a/llvm/test/YAMLParser/spec-09-16.test b/llvm/test/YAMLParser/spec-09-16.test index e595f47bece9d..3e0e48de220ef 100644 --- a/llvm/test/YAMLParser/spec-09-16.test +++ b/llvm/test/YAMLParser/spec-09-16.test @@ -1,5 +1,14 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: "as space\t\n trimmed \n\n specific\L\n none" -# Tabs are confusing: -# as space/trimmed/specific/none - as space … trimmed …… specific
… none +## Note: The parsing rules were changed in version 1.2 and the line-separator +## character is no longer considered a line-break character. The example is +## taken from Spec 1.1 and is now parsed as "..\L .." instead of "..\L\n.." as +## in the original edition. +## See https://yaml.org/spec/1.2.2/ext/changes/ for details. + + as space + trimmed + + specific
 + none diff --git a/llvm/test/YAMLParser/spec-09-17.test b/llvm/test/YAMLParser/spec-09-17.test index 1bacf4d68b1f7..425925774d92f 100644 --- a/llvm/test/YAMLParser/spec-09-17.test +++ b/llvm/test/YAMLParser/spec-09-17.test @@ -1,4 +1,5 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: "first line \n \n more line" first line diff --git a/llvm/test/YAMLParser/spec-10-02.test b/llvm/test/YAMLParser/spec-10-02.test index 662427a0c066c..9adddc9237d51 100644 --- a/llvm/test/YAMLParser/spec-10-02.test +++ b/llvm/test/YAMLParser/spec-10-02.test @@ -1,4 +1,16 @@ -# RUN: yaml-bench -canonical %s +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: !!seq [ +# CHECK-NEXT: !!str "double\n quoted", +# CHECK-NEXT: !!str "single\n quoted", +# CHECK-NEXT: !!str "plain\n text", +# CHECK-NEXT: !!seq [ +# CHECK-NEXT: !!str "nested", +# CHECK-NEXT: ], +# CHECK-NEXT: !!map { +# CHECK-NEXT: ? !!str "single" +# CHECK-NEXT: : !!str "pair", +# CHECK-NEXT: }, +# CHECK-NEXT: ] [ "double diff --git a/llvm/test/YAMLParser/spec1.2-07-05.test b/llvm/test/YAMLParser/spec1.2-07-05.test new file mode 100644 index 0000000000000..3ea0e5aa37743 --- /dev/null +++ b/llvm/test/YAMLParser/spec1.2-07-05.test @@ -0,0 +1,8 @@ +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: "folded \nto a space,\t\n \nto a line feed, or \t \tnon-content" + +"folded +to a space, + +to a line feed, or \ + \ non-content" diff --git a/llvm/test/YAMLParser/spec1.2-07-06.test b/llvm/test/YAMLParser/spec1.2-07-06.test new file mode 100644 index 0000000000000..8982c1ed2a7b1 --- /dev/null +++ b/llvm/test/YAMLParser/spec1.2-07-06.test @@ -0,0 +1,7 @@ +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: " 1st non-empty\n 2nd non-empty \n\t3rd non-empty " + +" 1st non-empty + + 2nd non-empty + 3rd non-empty " diff --git a/llvm/test/YAMLParser/spec1.2-07-09.test b/llvm/test/YAMLParser/spec1.2-07-09.test new file mode 100644 index 0000000000000..38d541973bc43 --- /dev/null +++ b/llvm/test/YAMLParser/spec1.2-07-09.test @@ -0,0 +1,7 @@ +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: " 1st non-empty\n\n 2nd non-empty \n\t3rd non-empty " + +' 1st non-empty + + 2nd non-empty + 3rd non-empty ' diff --git a/llvm/test/YAMLParser/spec1.2-07-12.test b/llvm/test/YAMLParser/spec1.2-07-12.test new file mode 100644 index 0000000000000..84d986e29d510 --- /dev/null +++ b/llvm/test/YAMLParser/spec1.2-07-12.test @@ -0,0 +1,7 @@ +# RUN: yaml-bench -canonical %s | FileCheck %s --strict-whitespace +# CHECK: "1st non-empty\n\n 2nd non-empty \n\t3rd non-empty" + +1st non-empty + + 2nd non-empty + 3rd non-empty