From 30fcab3528f6ab0e1c0db4105433ed6ba72885b3 Mon Sep 17 00:00:00 2001 From: Colin Benner Date: Mon, 1 Oct 2018 11:31:06 +0200 Subject: [PATCH] Test escape handling in gnu_units --- src/gnu_units.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gnu_units.rs b/src/gnu_units.rs index cf3717e..b541d1c 100644 --- a/src/gnu_units.rs +++ b/src/gnu_units.rs @@ -597,7 +597,17 @@ mod tests { Expr::Error, "Expected term, got Error(\"Expected LF or CRLF line endings\")" ); + expect!("\\\r\n1", Expr::Const, 1.into()); - expect!("\\\r\n1", Expr::Const, 1.into()) + expect!( + "\\a", + Expr::Error, + "Expected term, got Error(\"Invalid escape: \\\\a\")" + ); + expect!( + "\\", + Expr::Error, + "Expected term, got Error(\"Unexpected EOF\")" + ); } }