use super::super::*;
use dsntk_common::DsntkError;
use std::str::from_utf8;
fn te(input: &str, source: &str, message: &str) {
assert_eq!(Err(DsntkError::new(source, message)), Parser::new(&scope!(), StartExpression, input, false).parse())
}
#[test]
fn _0001() {
te(r#"^123"#, "ParserError", r#"syntax error: ^123"#);
}
#[test]
fn _0002() {
let input = from_utf8(&[34, 49, 50, 10, 51, 34]).unwrap(); te(input, "ParserError", "syntax error: \"12\n3\"");
}
#[test]
fn _0003() {
te(r#""123"#, "ParserError", "syntax error: \"123");
}
#[test]
fn _0004() {
te(r#""a\u4B"#, "LexerError", "unexpected end of file");
}
#[test]
fn _0005() {
te(r#"1. + 2"#, "ParserError", "syntax error: 1. + 2");
}
#[test]
fn _0006() {
te(r#"1.^ + 2"#, "ParserError", "syntax error: 1.^ + 2");
}
#[test]
fn _0007() {
te(r#"1."#, "ParserError", "syntax error: 1.");
}
#[test]
fn _0008() {
let scope = scope!();
accept(
&scope,
StartExpression,
"function ",
r#"
Name
└─ `function`
"#,
false,
);
}
#[test]
fn _0009() {
te(r#""\uD800\uE000""#, "LexerError", "surrogate value is out of allowed range 0xD800..0xDFFF : E000");
}
#[test]
fn _0010() {
te(r#""\U110000""#, "LexerError", "value is out of allowed Unicode range 0x0000..0x10FFFF : 110000");
}
#[test]
fn _0011() {
let input = "1 += 2";
let expected = r#"
Add
├─ Numeric
│ └─ `1`
└─ UnaryEq
└─ Numeric
└─ `2`
"#;
accept(&scope!(), StartExpression, input, expected, false);
}