use crate::pretty_printer::{assert_round_trips, assert_round_trips_with_types};
#[test]
fn string_literals() {
assert_round_trips(r" local S='abcdef\n\f\a\020' ");
}
#[test]
fn string_literals_containing_utf8() {
assert_round_trips(" local S='lalala こんにちは' ");
}
#[test]
fn single_quoted_strings() {
assert_round_trips(r" local a = 'hello world' ");
}
#[test]
fn double_quoted_strings() {
assert_round_trips(r#" local a = "hello world" "#);
}
#[test]
fn simple_interp_string() {
assert_round_trips(r" local a = `hello world` ");
}
#[test]
fn raw_strings() {
assert_round_trips(r" local a = [[ hello world ]] ");
}
#[test]
fn raw_strings_with_blocks() {
assert_round_trips(r" local a = [==[ hello world ]==] ");
}
#[test]
fn escaped_strings() {
assert_round_trips(r" local s='\\b\\t\\n\\\\' ");
}
#[test]
fn escaped_strings_2() {
assert_round_trips(r#" local s="\a\b\f\n\r\t\v\'\"\\" "#);
}
#[test]
fn escaped_strings_newline() {
assert_round_trips(
r#"
print("foo \
bar")
"#,
);
}
#[test]
fn escaped_strings_raw() {
assert_round_trips(r#" local x = [=[\v<((do|load)file|require)\s*\(?['"]\zs[^'"]+\ze['"]]=] "#);
}
#[test]
fn pretty_print_string_interp() {
assert_round_trips_with_types(r" local _ = `hello {name}` ");
}
#[test]
fn pretty_print_string_interp_multiline() {
assert_round_trips_with_types(
r#" local _ = `hello {
name
}!` "#,
);
}
#[test]
fn pretty_print_string_interp_on_new_line() {
assert_round_trips_with_types(
r#"
error(
`a {b} c`
)
"#,
);
}
#[test]
fn pretty_print_string_interp_multiline_escape() {
assert_round_trips_with_types(
r#" local _ = `hello \
world!` "#,
);
}
#[test]
fn pretty_print_string_literal_escape() {
assert_round_trips_with_types(r#" local _ = ` bracket = \{, backtick = \` = {'ok'} ` "#);
}
#[test]
fn pretty_print_single_quoted_string_types() {
assert_round_trips_with_types(r" type a = 'hello world' ");
}
#[test]
fn pretty_print_double_quoted_string_types() {
assert_round_trips_with_types(r#" type a = "hello world" "#);
}
#[test]
fn pretty_print_raw_string_types() {
assert_round_trips_with_types(r" type a = [[ hello world ]] ");
assert_round_trips_with_types(r" type a = [==[ hello world ]==] ");
}
#[test]
fn pretty_print_escaped_string_types() {
assert_round_trips_with_types(r#" type a = "\\b\\t\\n\\\\" "#);
}