open_pql/pql_parser/ast/
str.rs1use super::*;
2
3#[derive(Debug, Clone, PartialEq, Eq, From)]
4pub struct Str<'i> {
5 pub inner: &'i str,
6 pub loc: (Loc, Loc),
7}
8
9#[cfg(test)]
10mod tests {
11 use super::{super::super::parser::*, *};
12
13 fn s(s: &str) -> Str<'_> {
14 StrParser::new().parse(s).unwrap()
15 }
16
17 #[test]
18 fn test_str() {
19 assert_eq!(s(r#""str""#), ("str", (0, 5)).into());
20 assert_eq!(s(r#""""#), ("", (0, 2)).into());
21
22 assert_eq!(s("'str'"), ("str", (0, 5)).into());
23 assert_eq!(s("''"), ("", (0, 2)).into());
24
25 assert_eq!(s("'one two three'"), ("one two three", (0, 15)).into());
26 }
27}