Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/ |
| 3 | * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/ |
| 4 | * |
| 5 | * Written by Václav Kubernát <kubervac@fit.cvut.cz> |
| 6 | * |
| 7 | */ |
| 8 | |
Jan Kundrát | a33cf08 | 2019-03-28 11:55:57 +0100 | [diff] [blame] | 9 | #include "trompeloeil_doctest.h" |
Václav Kubernát | 24df80e | 2018-06-06 15:18:03 +0200 | [diff] [blame] | 10 | #include "ast_commands.hpp" |
Václav Kubernát | 48fc383 | 2018-05-28 14:21:22 +0200 | [diff] [blame] | 11 | #include "parser.hpp" |
Václav Kubernát | bddbb17 | 2018-06-13 16:27:39 +0200 | [diff] [blame] | 12 | #include "static_schema.hpp" |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 13 | |
| 14 | TEST_CASE("cd") |
| 15 | { |
Václav Kubernát | bddbb17 | 2018-06-13 16:27:39 +0200 | [diff] [blame] | 16 | auto schema = std::make_shared<StaticSchema>(); |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 17 | schema->addModule("example"); |
| 18 | schema->addModule("second"); |
Václav Kubernát | efcac93 | 2020-01-10 15:26:32 +0100 | [diff] [blame] | 19 | schema->addContainer("/", "example:a"); |
| 20 | schema->addContainer("/", "second:a"); |
| 21 | schema->addContainer("/", "example:b"); |
| 22 | schema->addContainer("/example:a", "example:a2"); |
| 23 | schema->addContainer("/example:b", "example:b2"); |
| 24 | schema->addContainer("/example:a/example:a2", "example:a3"); |
| 25 | schema->addContainer("/example:b/example:b2", "example:b3"); |
| 26 | schema->addList("/", "example:list", {"number"}); |
| 27 | schema->addContainer("/example:list", "example:contInList"); |
| 28 | schema->addList("/", "example:twoKeyList", {"number", "name"}); |
Václav Kubernát | 48fc383 | 2018-05-28 14:21:22 +0200 | [diff] [blame] | 29 | Parser parser(schema); |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 30 | std::string input; |
Václav Kubernát | 2315c73 | 2018-05-16 20:25:55 +0200 | [diff] [blame] | 31 | std::ostringstream errorStream; |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 32 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 33 | |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 34 | SECTION("valid input") |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 35 | { |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 36 | cd_ expected; |
| 37 | |
| 38 | SECTION("container") |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 39 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 40 | SECTION("example:a") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 41 | { |
Václav Kubernát | d6fd249 | 2018-11-19 15:11:16 +0100 | [diff] [blame] | 42 | SECTION("trailing slash") |
| 43 | { |
| 44 | input = "cd example:a/"; |
| 45 | expected.m_path.m_trailingSlash = TrailingSlash::Present; |
| 46 | } |
| 47 | SECTION("no trailing slash") |
| 48 | { |
| 49 | input = "cd example:a"; |
| 50 | } |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 51 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("a"))); |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 52 | } |
| 53 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 54 | SECTION("second:a") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 55 | { |
Václav Kubernát | d6fd249 | 2018-11-19 15:11:16 +0100 | [diff] [blame] | 56 | SECTION("trailing slash") |
| 57 | { |
| 58 | input = "cd second:a/"; |
| 59 | expected.m_path.m_trailingSlash = TrailingSlash::Present; |
| 60 | } |
| 61 | SECTION("no trailing slash") |
| 62 | { |
| 63 | input = "cd second:a"; |
| 64 | } |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 65 | expected.m_path.m_nodes.push_back(dataNode_(module_{"second"}, container_("a"))); |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 66 | } |
| 67 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 68 | SECTION("example:b") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 69 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 70 | input = "cd example:b"; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 71 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("b"))); |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 72 | } |
| 73 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 74 | SECTION("example:a/a2") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 75 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 76 | input = "cd example:a/a2"; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 77 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("a"))); |
| 78 | expected.m_path.m_nodes.push_back(dataNode_(container_("a2"))); |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | SECTION("example:a/example:a2") |
| 82 | { |
| 83 | input = "cd example:a/example:a2"; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 84 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("a"))); |
| 85 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("a2"))); |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | SECTION("example:b/b2") |
| 89 | { |
| 90 | input = "cd example:b/b2"; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 91 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("b"))); |
| 92 | expected.m_path.m_nodes.push_back(dataNode_(container_("b2"))); |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 93 | } |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 94 | } |
| 95 | |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 96 | SECTION("list elements") |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 97 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 98 | SECTION("example:list[number=1]") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 99 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 100 | input = "cd example:list[number=1]"; |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 101 | auto keys = std::map<std::string, std::string>{ |
Václav Kubernát | 48fc383 | 2018-05-28 14:21:22 +0200 | [diff] [blame] | 102 | {"number", "1"}}; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 103 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, listElement_("list", keys))); |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 104 | } |
| 105 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 106 | SECTION("example:list[number=1]/contInList") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 107 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 108 | input = "cd example:list[number=1]/contInList"; |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 109 | auto keys = std::map<std::string, std::string>{ |
Václav Kubernát | 48fc383 | 2018-05-28 14:21:22 +0200 | [diff] [blame] | 110 | {"number", "1"}}; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 111 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, listElement_("list", keys))); |
| 112 | expected.m_path.m_nodes.push_back(dataNode_(container_("contInList"))); |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 113 | } |
| 114 | |
Václav Kubernát | 89728d8 | 2018-09-13 16:28:28 +0200 | [diff] [blame] | 115 | SECTION("example:twoKeyList[number=4][name='abcd']") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 116 | { |
Václav Kubernát | 89728d8 | 2018-09-13 16:28:28 +0200 | [diff] [blame] | 117 | input = "cd example:twoKeyList[number=4][name='abcd']"; |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 118 | auto keys = std::map<std::string, std::string>{ |
Václav Kubernát | 48fc383 | 2018-05-28 14:21:22 +0200 | [diff] [blame] | 119 | {"number", "4"}, |
| 120 | {"name", "abcd"}}; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 121 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, listElement_("twoKeyList", keys))); |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 122 | } |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 123 | } |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 124 | |
| 125 | SECTION("whitespace handling") |
| 126 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 127 | SECTION(" cd example:a ") |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 128 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 129 | input = " cd example:a "; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 130 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("a"))); |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 131 | } |
| 132 | } |
| 133 | |
Václav Kubernát | 60d6f29 | 2018-05-25 09:45:32 +0200 | [diff] [blame] | 134 | SECTION("moving up") |
| 135 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 136 | SECTION("example:a/..") |
Václav Kubernát | 60d6f29 | 2018-05-25 09:45:32 +0200 | [diff] [blame] | 137 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 138 | input = "cd example:a/.."; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 139 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("a"))); |
| 140 | expected.m_path.m_nodes.push_back(dataNode_(nodeup_())); |
Václav Kubernát | 60d6f29 | 2018-05-25 09:45:32 +0200 | [diff] [blame] | 141 | } |
| 142 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 143 | SECTION("example:a/../example:a") |
Václav Kubernát | 60d6f29 | 2018-05-25 09:45:32 +0200 | [diff] [blame] | 144 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 145 | input = "cd example:a/../example:a"; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 146 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("a"))); |
| 147 | expected.m_path.m_nodes.push_back(dataNode_(nodeup_())); |
| 148 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("a"))); |
Václav Kubernát | 60d6f29 | 2018-05-25 09:45:32 +0200 | [diff] [blame] | 149 | } |
| 150 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 151 | SECTION("example:a/../example:a/a2") |
Václav Kubernát | 60d6f29 | 2018-05-25 09:45:32 +0200 | [diff] [blame] | 152 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 153 | input = "cd example:a/../example:a/a2"; |
Václav Kubernát | 2eaceb8 | 2018-10-08 19:56:30 +0200 | [diff] [blame] | 154 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("a"))); |
| 155 | expected.m_path.m_nodes.push_back(dataNode_(nodeup_())); |
| 156 | expected.m_path.m_nodes.push_back(dataNode_(module_{"example"}, container_("a"))); |
| 157 | expected.m_path.m_nodes.push_back(dataNode_(container_("a2"))); |
Václav Kubernát | 60d6f29 | 2018-05-25 09:45:32 +0200 | [diff] [blame] | 158 | } |
| 159 | } |
| 160 | |
Václav Kubernát | b61336d | 2018-05-28 17:35:03 +0200 | [diff] [blame] | 161 | command_ command = parser.parseCommand(input, errorStream); |
| 162 | REQUIRE(command.type() == typeid(cd_)); |
| 163 | REQUIRE(boost::get<cd_>(command) == expected); |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 164 | } |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 165 | SECTION("invalid input") |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 166 | { |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 167 | SECTION("missing space between a command and its arguments") |
| 168 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 169 | SECTION("cdexample:a") |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 170 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 171 | input = "cdexample:a"; |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 172 | } |
| 173 | } |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 174 | |
| 175 | SECTION("whitespace between module and nodename") |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 176 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 177 | SECTION("cd example: a") |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 178 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 179 | input = "cd example: a"; |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 180 | } |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 181 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 182 | SECTION("cd example : a") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 183 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 184 | input = "cd example : a"; |
| 185 | } |
| 186 | |
| 187 | SECTION("cd example :a") |
| 188 | { |
| 189 | input = "cd example :a"; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | SECTION("entering modules") |
| 194 | { |
| 195 | SECTION("cd example") |
| 196 | { |
| 197 | input = "cd example"; |
| 198 | } |
| 199 | |
| 200 | SECTION("cd example:") |
| 201 | { |
| 202 | input = "cd example:"; |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | SECTION("garbage arguments handling") |
| 207 | { |
| 208 | SECTION("cd example:a garbage") |
| 209 | { |
| 210 | input = "cd example:a garbage"; |
| 211 | } |
| 212 | SECTION("cd example:a/a2 garbage") |
| 213 | { |
| 214 | input = "cd example:a/a2 garbage"; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | SECTION("invalid node identifiers") |
| 219 | { |
| 220 | SECTION("example:nonexistent") |
| 221 | { |
| 222 | input = "cd example:nonexistent"; |
| 223 | } |
| 224 | |
| 225 | SECTION("example:nonexistent/lol") |
| 226 | { |
| 227 | input = "cd example:nonexistent/lol"; |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | SECTION("invalid module identifiers") |
| 232 | { |
| 233 | SECTION("elpmaxe:nonexistent") |
| 234 | { |
| 235 | input = "cd elpmaxe:nonexistent"; |
| 236 | } |
| 237 | |
| 238 | SECTION("elpmaxe:nonexistent/example:lol") |
| 239 | { |
| 240 | input = "cd elpmaxe:nonexistent/example:lol"; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | SECTION("no top-level module") |
| 245 | { |
| 246 | SECTION("cd a") |
| 247 | { |
| 248 | input = "cd a"; |
| 249 | } |
| 250 | |
| 251 | SECTION("cd example:a/../a") |
| 252 | { |
| 253 | input = "cd example:a/../a"; |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 254 | } |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 255 | } |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 256 | |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 257 | SECTION("invalid list key identifiers") |
| 258 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 259 | SECTION("example:list") |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 260 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 261 | input = "cd example:list"; |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 262 | } |
| 263 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 264 | SECTION("example:list[]") |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 265 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 266 | input = "cd example:list[]"; |
Václav Kubernát | 7e4e82f | 2018-05-14 20:04:58 +0200 | [diff] [blame] | 267 | } |
| 268 | |
Václav Kubernát | 89728d8 | 2018-09-13 16:28:28 +0200 | [diff] [blame] | 269 | SECTION("example:twoKeyList[invalidKey='4']") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 270 | { |
Václav Kubernát | 89728d8 | 2018-09-13 16:28:28 +0200 | [diff] [blame] | 271 | input = "cd example:twoKeyList[invalidKey='4']"; |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 272 | } |
| 273 | |
Václav Kubernát | 89728d8 | 2018-09-13 16:28:28 +0200 | [diff] [blame] | 274 | SECTION("example:twoKeyList[number=4][number=5]") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 275 | { |
Václav Kubernát | 89728d8 | 2018-09-13 16:28:28 +0200 | [diff] [blame] | 276 | input = "cd example:twoKeyList[number=4][number=5]"; |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 277 | } |
| 278 | |
Václav Kubernát | 89728d8 | 2018-09-13 16:28:28 +0200 | [diff] [blame] | 279 | SECTION("example:twoKeyList[number=4][name='lol'][number=7]") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 280 | { |
Václav Kubernát | 89728d8 | 2018-09-13 16:28:28 +0200 | [diff] [blame] | 281 | input = "cd example:twoKeyList[number=4][name='lol'][number=7]"; |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 282 | } |
| 283 | |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 284 | SECTION("example:twoKeyList[number=4]") |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 285 | { |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 286 | input = "cd example:twoKeyList[number=4]"; |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 287 | } |
Václav Kubernát | 89728d8 | 2018-09-13 16:28:28 +0200 | [diff] [blame] | 288 | |
| 289 | SECTION("strings must be quoted") |
| 290 | { |
| 291 | input = "cd example:twoKeyList[number=4][name=abcd]"; |
| 292 | } |
Václav Kubernát | b96eef7 | 2018-05-04 19:10:22 +0200 | [diff] [blame] | 293 | } |
Jan Kundrát | c381e63 | 2019-03-14 13:39:11 +0100 | [diff] [blame] | 294 | REQUIRE_THROWS_AS(parser.parseCommand(input, errorStream), InvalidCommandException); |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame] | 295 | } |
| 296 | } |