Fix switch of non-hashable value.

This commit is contained in:
Stephen Chung
2021-03-05 10:33:48 +08:00
parent 0fa3968b74
commit 4c5ea8decc
4 changed files with 52 additions and 10 deletions

View File

@@ -18,6 +18,10 @@ fn test_switch() -> Result<(), Box<EvalAltResult>> {
engine.eval_with_scope::<()>(&mut scope, "switch x { 1 => 123, 2 => 'a' }")?,
()
);
assert_eq!(
engine.eval::<INT>("let x = timestamp(); switch x { 1 => 123, _ => 42 }")?,
42
);
assert_eq!(
engine.eval_with_scope::<INT>(
&mut scope,