(temp_db)
| 267 | |
| 268 | |
| 269 | def test_lbugrc(temp_db) -> None: |
| 270 | deleteIfExists(".lbugrc") |
| 271 | # confirm that nothing is read on startup |
| 272 | test = ShellTest().add_argument(temp_db) |
| 273 | result = test.run() |
| 274 | result.check_not_stdout("-- Processing: .lbugrc") |
| 275 | |
| 276 | # create a .lbugrc file |
| 277 | with open(".lbugrc", "w") as f: |
| 278 | f.write("CREATE NODE TABLE a(i STRING, PRIMARY KEY(i));\n") |
| 279 | f.write(":max_rows 1\n") |
| 280 | |
| 281 | # confirm that the file is read on startup |
| 282 | test = ShellTest().add_argument(temp_db).statement("CALL show_tables() RETURN *;") |
| 283 | result = test.run() |
| 284 | deleteIfExists(".lbugrc") |
| 285 | result.check_stdout("-- Processing: .lbugrc") |
| 286 | result.check_stdout("maxRows set as 1") |
| 287 | result.check_stdout("a") |
| 288 | |
| 289 | # create a .lbugrc file with errors |
| 290 | with open(".lbugrc", "w") as f: |
| 291 | f.write('RETURN "databases rule" S a; RETURN s;\n') |
| 292 | f.write(":max_rows\n") |
| 293 | f.write(":mode table\n") |
| 294 | f.write("CREATE NODE TABLE b(i STRING, PRIMARY KEY(i));\n") |
| 295 | |
| 296 | # confirm that the file is read on startup |
| 297 | test = ShellTest().add_argument(temp_db).statement("CALL show_tables() RETURN *;") |
| 298 | result = test.run() |
| 299 | deleteIfExists(".lbugrc") |
| 300 | result.check_stdout("-- Processing: .lbugrc") |
| 301 | result.check_stdout( |
| 302 | [ |
| 303 | "Error: Parser exception: Invalid input < S>: expected rule iC_Statements (line: 1, offset: 24)", |
| 304 | '"RETURN "databases rule" S a; RETURN s;"', |
| 305 | " ^", |
| 306 | ], |
| 307 | ) |
| 308 | result.check_stdout("Cannot parse '' as number of rows. Expect integer.") |
| 309 | result.check_stdout("mode set as table") |
| 310 | result.check_stdout("b") |
| 311 | |
| 312 | |
| 313 | def test_comments(temp_db) -> None: |
nothing calls this directly
no test coverage detected