diff --git a/src/state.rs b/src/state.rs index b7b3a68..8abf8fa 100644 --- a/src/state.rs +++ b/src/state.rs @@ -120,14 +120,14 @@ impl State { let env = BTreeMap::from_iter ([ ("arg", Value::BogusArg (arg)), ("print", Value::BogusPrint), - ].map (|(k, v)| (k.to_string (), v)).into_iter ()); + ].map (|(k, v)| (k.to_string (), v))); vec! [ Value::BogusEnv (env), ] } - pub fn execute_chunk (&mut self, chunk: &Chunk, upvalues: &Vec ) + pub fn execute_chunk (&mut self, chunk: &Chunk, upvalues: &[Value]) -> Vec { let max_iters = 2000; diff --git a/src/tests.rs b/src/tests.rs index 491b09d..4b32591 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -38,6 +38,7 @@ fn floats () { for (arg, expected) in [ (vec! ["_exe_name"], vec! [3.5.into ()]), + (vec! ["_exe_name", " "], vec! [3.5.into ()]), ] { let mut vm = State::default (); let upvalues = State::upvalues_from_args (arg.into_iter ().map (|s| s.to_string ())); @@ -85,7 +86,7 @@ fn is_93 () { "print", "it's 93", "it's not 93", - ].into_iter ().map (|s| Value::from (s)).collect (), + ].into_iter ().map (Value::from).collect (), }; for (arg, expected) in [