()
| 406 | |
| 407 | #[test] |
| 408 | fn valid() { |
| 409 | let tx = SchemaViewer(module_def()); |
| 410 | |
| 411 | struct TestCase { |
| 412 | sql: &'static str, |
| 413 | msg: &'static str, |
| 414 | } |
| 415 | |
| 416 | for TestCase { sql, msg } in [ |
| 417 | TestCase { |
| 418 | sql: "select * from t", |
| 419 | msg: "Can select * on any table", |
| 420 | }, |
| 421 | TestCase { |
| 422 | sql: "select * from t where true", |
| 423 | msg: "Boolean literals are valid in WHERE clause", |
| 424 | }, |
| 425 | TestCase { |
| 426 | sql: "select * from t where t.u32 = 1", |
| 427 | msg: "Can qualify column references with table name", |
| 428 | }, |
| 429 | TestCase { |
| 430 | sql: "select * from t where u32 = 1", |
| 431 | msg: "Can leave columns unqualified when unambiguous", |
| 432 | }, |
| 433 | TestCase { |
| 434 | sql: "select * from s where id = :sender", |
| 435 | msg: "Can use :sender as an Identity", |
| 436 | }, |
| 437 | TestCase { |
| 438 | sql: "select * from s where bytes = :sender", |
| 439 | msg: "Can use :sender as a byte array", |
| 440 | }, |
| 441 | TestCase { |
| 442 | sql: "select * from t where t.u32 = 1 or t.str = ''", |
| 443 | msg: "Type OR with qualified column references", |
| 444 | }, |
| 445 | TestCase { |
| 446 | sql: "select * from s where s.bytes = 0xABCD or bytes = X'ABCD'", |
| 447 | msg: "Type OR with mixed qualified and unqualified column references", |
| 448 | }, |
| 449 | TestCase { |
| 450 | sql: "select * from s as r where r.bytes = 0xABCD or bytes = X'ABCD'", |
| 451 | msg: "Type OR with table alias", |
| 452 | }, |
| 453 | TestCase { |
| 454 | sql: "select t.* from t join s", |
| 455 | msg: "Type cross join + projection", |
| 456 | }, |
| 457 | TestCase { |
| 458 | sql: "select t.* from t join s join s as r where t.u32 = s.u32 and s.u32 = r.u32", |
| 459 | msg: "Type self join + projection", |
| 460 | }, |
| 461 | TestCase { |
| 462 | sql: "select t.* from t join s on t.u32 = s.u32 where t.f32 = 0.1", |
| 463 | msg: "Type inner join + projection", |
| 464 | }, |
| 465 | ] { |
nothing calls this directly
no test coverage detected
searching dependent graphs…