mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
FIX: More error reporting improvements.
This commit is contained in:
parent
efef2bc3d2
commit
276c155264
@ -396,3 +396,25 @@ fn test_incomplete_tuple_key_value_missing_value_compile_failure() {
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_format_expr_missing_expr_compile_error() {
|
||||||
|
assert_build_failure(
|
||||||
|
"\"foo\" %",
|
||||||
|
vec![
|
||||||
|
Regex::new(r"Expected format arguments").unwrap(),
|
||||||
|
Regex::new(r"at <eval> line: 1, column: 8").unwrap(),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_format_expr_unclosed_parens_compile_failure() {
|
||||||
|
assert_build_failure(
|
||||||
|
"\"foo\" % (1",
|
||||||
|
vec![
|
||||||
|
Regex::new(r"Expected \(\)\) but got \(\)").unwrap(),
|
||||||
|
Regex::new(r"at <eval> line: 1, column: 9").unwrap(),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -503,7 +503,8 @@ make_fn!(
|
|||||||
do_each!(
|
do_each!(
|
||||||
tmpl => match_type!(STR),
|
tmpl => match_type!(STR),
|
||||||
_ => punct!("%"),
|
_ => punct!("%"),
|
||||||
args => either!(simple_format_args, expression_format_args),
|
args => wrap_err!(must!(either!(simple_format_args, expression_format_args)),
|
||||||
|
"Expected format arguments"),
|
||||||
(Expression::Format(FormatDef {
|
(Expression::Format(FormatDef {
|
||||||
template: tmpl.fragment.to_string(),
|
template: tmpl.fragment.to_string(),
|
||||||
args: args,
|
args: args,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user