Author: Igor Kudrin Date: 2023-11-08T19:20:14-08:00 New Revision: 5784f2014981cdd16095e737d1d128a2995a3dbd
URL: https://github.com/llvm/llvm-project/commit/5784f2014981cdd16095e737d1d128a2995a3dbd DIFF: https://github.com/llvm/llvm-project/commit/5784f2014981cdd16095e737d1d128a2995a3dbd.diff LOG: [YAMLParser] Enable tests for flow scalar styles This is a preparing commit for #70898. It activates checks in tests for single-quoted, double-quoted, and plain values and demonstrates how they are handled currently. Added: llvm/test/YAMLParser/spec1.2-07-05.test llvm/test/YAMLParser/spec1.2-07-06.test llvm/test/YAMLParser/spec1.2-07-09.test llvm/test/YAMLParser/spec1.2-07-12.test Modified: llvm/test/YAMLParser/spec-02-17.test llvm/test/YAMLParser/spec-05-13.test llvm/test/YAMLParser/spec-05-14.test llvm/test/YAMLParser/spec-09-01.test llvm/test/YAMLParser/spec-09-02.test llvm/test/YAMLParser/spec-09-03.test llvm/test/YAMLParser/spec-09-04.test llvm/test/YAMLParser/spec-09-05.test llvm/test/YAMLParser/spec-09-06.test llvm/test/YAMLParser/spec-09-07.test llvm/test/YAMLParser/spec-09-08.test llvm/test/YAMLParser/spec-09-09.test llvm/test/YAMLParser/spec-09-10.test llvm/test/YAMLParser/spec-09-11.test llvm/test/YAMLParser/spec-09-13.test llvm/test/YAMLParser/spec-09-16.test llvm/test/YAMLParser/spec-09-17.test llvm/test/YAMLParser/spec-10-02.test Removed: ################################################################################ diff --git a/llvm/test/YAMLParser/spec-02-17.test b/llvm/test/YAMLParser/spec-02-17.test index 2bcb60c8d933bd8..e7b0147a0fcd89f 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 db62e866a755a32..e7ec42a4aaa80d7 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 65451651b69e96b..984f3721312ab63 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 8999b4961626470..2b5a6f31166ddf1 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 3f8e49a8bd31079..6b68a00e3fc3e6f 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 3fb0d8b184abb16..c656058b7ff8b3e 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 4178ec6befbd538..1e904eaa70992e5 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 e482d5366235b79..5eb5b22f421d64b 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 edc0cbba9004c4a..084cda1cd52d789 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 3c010ca5b93bdd3..71007e79b79d208 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 d114e58fcac15da..5d1f13b0e31dfc0 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 2fec1b536ef1357..181971bd1349530 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 faabfb06b5ec2af..f75834fa4dda544 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 3f487ad6b04398d..b1f8f45f954af22 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 d48f2d2c47ee3d5..015f38951ebbd64 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 e595f47bece9d97..3e0e48de220ef9f 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 1bacf4d68b1f7ab..425925774d92fd1 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 662427a0c066cf8..9adddc9237d51de 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 000000000000000..3ea0e5aa37743e4 --- /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 000000000000000..8982c1ed2a7b18d --- /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 000000000000000..38d541973bc43fc --- /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 000000000000000..84d986e29d510c5 --- /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 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits