From b6cff37de4f45e92d6f70bce789c23a330059c7a Mon Sep 17 00:00:00 2001 From: trivernis Date: Mon, 27 Mar 2023 19:37:02 +0200 Subject: [PATCH] Improve test for add var --- tests/test_eval.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/test_eval.rs b/tests/test_eval.rs index b2f5c36..42d2d9e 100644 --- a/tests/test_eval.rs +++ b/tests/test_eval.rs @@ -1,7 +1,7 @@ -use embed_nu::{rusty_value::*, IntoValue}; +use embed_nu::{rusty_value::*, IntoValue, NewEmpty}; use embed_nu::{CommandGroupConfig, Context, PipelineData}; use nu_protocol::engine::Command; -use nu_protocol::{Config, Signature, SyntaxShape}; +use nu_protocol::{Config, Signature, Span, SyntaxShape}; #[test] fn it_evals_strings() { @@ -30,6 +30,13 @@ fn it_accepts_variables() { ctx.add_var("hello", "world").unwrap(); let val = ctx.get_var("hello").expect("No variable returned"); + assert_eq!(val.as_string().unwrap(), String::from("world")); + + let val = ctx + .eval_raw(r#"$hello"#, PipelineData::empty()) + .unwrap() + .into_value(Span::empty()); + assert_eq!(val.as_string().unwrap(), String::from("world")) }