Use String::new() for empty strings.
This commit is contained in:
@@ -25,28 +25,28 @@ fn test_assignments_bad_lhs() -> Result<(), Box<EvalAltResult>> {
|
||||
.compile("(x+y) = 42;")
|
||||
.expect_err("should error")
|
||||
.err_type(),
|
||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||
ParseErrorType::AssignmentToInvalidLHS(String::new())
|
||||
);
|
||||
assert_eq!(
|
||||
*engine
|
||||
.compile("foo(x) = 42;")
|
||||
.expect_err("should error")
|
||||
.err_type(),
|
||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||
ParseErrorType::AssignmentToInvalidLHS(String::new())
|
||||
);
|
||||
assert_eq!(
|
||||
*engine
|
||||
.compile("true = 42;")
|
||||
.expect_err("should error")
|
||||
.err_type(),
|
||||
ParseErrorType::AssignmentToConstant("".to_string())
|
||||
ParseErrorType::AssignmentToConstant(String::new())
|
||||
);
|
||||
assert_eq!(
|
||||
*engine
|
||||
.compile("123 = 42;")
|
||||
.expect_err("should error")
|
||||
.err_type(),
|
||||
ParseErrorType::AssignmentToConstant("".to_string())
|
||||
ParseErrorType::AssignmentToConstant(String::new())
|
||||
);
|
||||
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
@@ -56,21 +56,21 @@ fn test_assignments_bad_lhs() -> Result<(), Box<EvalAltResult>> {
|
||||
.compile("x.foo() = 42;")
|
||||
.expect_err("should error")
|
||||
.err_type(),
|
||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||
ParseErrorType::AssignmentToInvalidLHS(String::new())
|
||||
);
|
||||
assert_eq!(
|
||||
*engine
|
||||
.compile("x.foo().x.y = 42;")
|
||||
.expect_err("should error")
|
||||
.err_type(),
|
||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||
ParseErrorType::AssignmentToInvalidLHS(String::new())
|
||||
);
|
||||
assert_eq!(
|
||||
*engine
|
||||
.compile("x.y.z.foo() = 42;")
|
||||
.expect_err("should error")
|
||||
.err_type(),
|
||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||
ParseErrorType::AssignmentToInvalidLHS(String::new())
|
||||
);
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
assert_eq!(
|
||||
@@ -78,7 +78,7 @@ fn test_assignments_bad_lhs() -> Result<(), Box<EvalAltResult>> {
|
||||
.compile("x.foo()[0] = 42;")
|
||||
.expect_err("should error")
|
||||
.err_type(),
|
||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||
ParseErrorType::AssignmentToInvalidLHS(String::new())
|
||||
);
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
assert_eq!(
|
||||
@@ -86,7 +86,7 @@ fn test_assignments_bad_lhs() -> Result<(), Box<EvalAltResult>> {
|
||||
.compile("x[y].z.foo() = 42;")
|
||||
.expect_err("should error")
|
||||
.err_type(),
|
||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||
ParseErrorType::AssignmentToInvalidLHS(String::new())
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -303,7 +303,7 @@ fn test_custom_syntax_raw() -> Result<(), Box<EvalAltResult>> {
|
||||
.compile("hello hey")
|
||||
.expect_err("should error")
|
||||
.err_type(),
|
||||
ParseErrorType::BadInput(LexError::ImproperSymbol("hey".to_string(), "".to_string()))
|
||||
ParseErrorType::BadInput(LexError::ImproperSymbol("hey".to_string(), String::new()))
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
Reference in New Issue
Block a user