unexist.dev

Changeset 204:c249a126e299

Moved assert message into assert_eq! call
author Christoph Kappel <unexist@subforge.org>
date Fri, 02 Oct 2020 13:44:17 +0200
parents 33c06642e721
children ae0cfc9dc6f3
files rubtle-lib/src/tests/rubtle.rs
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rubtle-lib/src/tests/rubtle.rs	Fri Oct 02 13:38:58 2020 +0200
+++ b/rubtle-lib/src/tests/rubtle.rs	Fri Oct 02 13:44:17 2020 +0200
@@ -278,12 +278,9 @@
 
     rubtle.set_global_function("assert", |inv: Invocation| -> Result<Value> {
         let assert_val = inv.args.first().unwrap().as_boolean().unwrap();
+        let assert_mesg = inv.args.last().unwrap().coerce_string().unwrap();
 
-        if true != assert_val {
-            eprintln!("Assertion failed: {}", inv.args.last().unwrap().coerce_string().unwrap());
-        }
-
-        assert_eq!(true, assert_val);
+        assert_eq!(true, assert_val, "{}", assert_mesg);
 
         /* Make compiler happy */
         Ok(Value::from(true))