1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
#include "./test_lib/test_group.hpp"
#include "./test_lib/test_group.def.hpp"
namespace c4 {
namespace yml {
CASE_GROUP(MAP_OF_SEQ)
{
ADD_CASE_TO_GROUP("map of empty seqs",
R"({foo: [], bar: [], baz: []})",
N(MFS, L{
N(KP|SFS, "foo", L()),
N(KP|SFS, "bar", L()),
N(KP|SFS, "baz", L()),
})
);
ADD_CASE_TO_GROUP("map of seqs, one line",
R"({men: [John Smith, Bill Jones], women: [Mary Smith, Susan Williams]})",
N(MFS, L{
N(KP|SFS, "men", L{N{VP, "John Smith"}, N{VP, "Bill Jones"}}),
N(KP|SFS, "women", L{N{VP, "Mary Smith"}, N{VP, "Susan Williams"}})
})
);
ADD_CASE_TO_GROUP("map of seqs",
R"(
men:
- John Smith
- Bill Jones
women:
- Mary Smith
- Susan Williams
)",
N(MB, L{
N(KP|SB, "men", L{N{VP, "John Smith"}, N{VP, "Bill Jones"}}),
N(KP|SB, "women", L{N{VP, "Mary Smith"}, N{VP, "Susan Williams"}})
})
);
ADD_CASE_TO_GROUP("map of seqs, not indented",
R"(
men:
- John Smith
- Bill Jones
women:
- Mary Smith
- Susan Williams
)",
N(MB, L{
N(KP|SB, "men", L{N{VP, "John Smith"}, N{VP, "Bill Jones"}}),
N(KP|SB, "women", L{N{VP, "Mary Smith"}, N{VP, "Susan Williams"}})
})
);
ADD_CASE_TO_GROUP("map of seqs, not indented, more",
R"(
product:
- sku: BL4438H
quantity: 1
description: Super Hoop
price: 2392.00 # jumping one level here would be wrong.
tax: 1234.5 # we must jump two levels
product2:
subproduct1:
- sku: BL4438H
quantity: 1
description: Super Hoop
price: 2392.00 # jumping one level here would be wrong.
subproduct2:
- sku: BL4438H
quantity: 1
description: Super Hoop
price: 2392.00 # jumping one level here would be wrong.
tax2: 789.10 # we must jump two levels
tax3: 1234.5
product3:
subproduct1:
- sku: BL4438H
quantity: 1
description: Super Hoop
price: 2392.00 # jumping one level here would be wrong.
subproduct2:
- sku: BL4438H
quantity: 1
description: Super Hoop
price: 2392.00 # jumping one level here would be wrong.
# a comment here, will it ruin parsing?
tax2: 789.10 # we must jump two levels
tax4: 1234.5
product4:
subproduct1:
- sku: BL4438H
quantity: 1
description: Super Hoop
price: 2392.00 # jumping one level here would be wrong.
subproduct2:
- sku: BL4438H
quantity: 1
description: Super Hoop
price: 2392.00 # jumping one level here would be wrong.
# what about here?
tax2: 789.10 # we must jump two levels
tax5: 1234.5
)",
N(MB, L{
N(KP|SB, "product", L{
N(MB, L{N(KP|VP, "sku", "BL4438H"), N(KP|VP, "quantity", "1"), N(KP|VP, "description", "Super Hoop"), N(KP|VP, "price", "2392.00")}),
}),
N(KP|VP, "tax", "1234.5"),
N(KP|MB, "product2", L{
N(KP|SB, "subproduct1", L{
N(MB, L{N(KP|VP, "sku", "BL4438H"), N(KP|VP, "quantity", "1"), N(KP|VP, "description", "Super Hoop"), N(KP|VP, "price", "2392.00")}),
}),
N(KP|SB, "subproduct2", L{
N(MB, L{N(KP|VP, "sku", "BL4438H"), N(KP|VP, "quantity", "1"), N(KP|VP, "description", "Super Hoop"), N(KP|VP, "price", "2392.00")}),
}),
N(KP|VP, "tax2", "789.10"),
}),
N(KP|VP, "tax3", "1234.5"),
N(KP|MB, "product3", L{
N(KP|SB, "subproduct1", L{
N(MB, L{N(KP|VP, "sku", "BL4438H"), N(KP|VP, "quantity", "1"), N(KP|VP, "description", "Super Hoop"), N(KP|VP, "price", "2392.00")}),
}),
N(KP|SB, "subproduct2", L{
N(MB, L{N(KP|VP, "sku", "BL4438H"), N(KP|VP, "quantity", "1"), N(KP|VP, "description", "Super Hoop"), N(KP|VP, "price", "2392.00")}),
}),
N(KP|VP, "tax2", "789.10"),
}),
N(KP|VP, "tax4", "1234.5"),
N(KP|MB, "product4", L{
N(KP|SB, "subproduct1", L{
N(MB, L{N(KP|VP, "sku", "BL4438H"), N(KP|VP, "quantity", "1"), N(KP|VP, "description", "Super Hoop"), N(KP|VP, "price", "2392.00")}),
}),
N(KP|SB, "subproduct2", L{
N(MB, L{N(KP|VP, "sku", "BL4438H"), N(KP|VP, "quantity", "1"), N(KP|VP, "description", "Super Hoop"), N(KP|VP, "price", "2392.00")}),
}),
N(KP|VP, "tax2", "789.10"),
}),
N(KP|VP, "tax5", "1234.5"),
})
);
ADD_CASE_TO_GROUP("map of seqs, next line",
R"(
men:
-
John Smith
-
Bill Jones
women:
-
Mary Smith
-
Susan Williams
)",
N(MB, L{
N(KP|SB, "men", L{N{VP, "John Smith"}, N{VP, "Bill Jones"}}),
N(KP|SB, "women", L{N{VP, "Mary Smith"}, N{VP, "Susan Williams"}})
})
);
ADD_CASE_TO_GROUP("map of seqs, next line without space",
R"(
men:
-
John Smith
-
Bill Jones
women:
-
Mary Smith
-
Susan Williams
)",
N(MB, L{
N(KP|SB, "men", L{N{VP, "John Smith"}, N{VP, "Bill Jones"}}),
N(KP|SB, "women", L{N{VP, "Mary Smith"}, N{VP, "Susan Williams"}})
})
);
ADD_CASE_TO_GROUP("map of seqs, deal with unk",
R"(
skip_commits:
files:
- a
- b
- c
- d
- e
)",
N(MB, L{
N(KP|MB, "skip_commits", L{
N(KP|SB, "files", L{
N(VP, "a"), N(VP, "b"), N(VP, "c"), N(VP, "d"), N(VP, "e")
})
})
})
);
}
} // namespace yml
} // namespace c4
|