()
| 281 | |
| 282 | #[test] |
| 283 | fn valid_literals() { |
| 284 | let tx = SchemaViewer(module_def()); |
| 285 | |
| 286 | struct TestCase { |
| 287 | sql: &'static str, |
| 288 | msg: &'static str, |
| 289 | } |
| 290 | |
| 291 | for TestCase { sql, msg } in [ |
| 292 | TestCase { |
| 293 | sql: "select * from t where i32 = -1", |
| 294 | msg: "Leading `-`", |
| 295 | }, |
| 296 | TestCase { |
| 297 | sql: "select * from t where u32 = +1", |
| 298 | msg: "Leading `+`", |
| 299 | }, |
| 300 | TestCase { |
| 301 | sql: "select * from t where u32 = 1e3", |
| 302 | msg: "Scientific notation", |
| 303 | }, |
| 304 | TestCase { |
| 305 | sql: "select * from t where u32 = 1E3", |
| 306 | msg: "Case insensitive scientific notation", |
| 307 | }, |
| 308 | TestCase { |
| 309 | sql: "select * from t where f32 = 1e3", |
| 310 | msg: "Integers can parse as floats", |
| 311 | }, |
| 312 | TestCase { |
| 313 | sql: "select * from t where f32 = 1e-3", |
| 314 | msg: "Negative exponent", |
| 315 | }, |
| 316 | TestCase { |
| 317 | sql: "select * from t where f32 = 0.1", |
| 318 | msg: "Standard decimal notation", |
| 319 | }, |
| 320 | TestCase { |
| 321 | sql: "select * from t where f32 = .1", |
| 322 | msg: "Leading `.`", |
| 323 | }, |
| 324 | TestCase { |
| 325 | sql: "select * from t where f32 = 1e40", |
| 326 | msg: "Infinity", |
| 327 | }, |
| 328 | TestCase { |
| 329 | sql: "select * from t where u256 = 1e40", |
| 330 | msg: "u256", |
| 331 | }, |
| 332 | TestCase { |
| 333 | sql: "select * from t where ts = '2025-02-10T15:45:30Z'", |
| 334 | msg: "timestamp", |
| 335 | }, |
| 336 | TestCase { |
| 337 | sql: "select * from t where ts = '2025-02-10T15:45:30.123Z'", |
| 338 | msg: "timestamp ms", |
| 339 | }, |
| 340 | TestCase { |
nothing calls this directly
no test coverage detected
searching dependent graphs…