Removed test that are expecting wrong results

This commit is contained in:
Robert Bendun 2022-05-17 02:55:09 +02:00
parent e7cb2de198
commit d1d3421376
2 changed files with 4 additions and 3 deletions

View File

@ -71,11 +71,12 @@ Result<Value> Interpreter::eval(Ast &&ast)
case Ast::Type::Literal:
switch (ast.token.type) {
case Token::Type::Symbol:
{
if (ast.token.source != "nil") {
auto const value = env().find(std::string(ast.token.source));
assert(value, "Missing variable error is not implemented yet");
return *value;
}
return Value{};
default:
return Value::from(ast.token);

View File

@ -40,7 +40,7 @@ suite intepreter_test = [] {
should("evaluate literals") = [] {
evaluates_to(Value{}, "nil");
evaluates_to(Value::number(Number(10)), "10");
evaluates_to(Value::symbol("notexistingsymbol"), "notexistingsymbol");
// evaluates_to(Value::symbol("notexistingsymbol"), "notexistingsymbol");
};
should("evaluate arithmetic") = [] {
@ -52,7 +52,7 @@ suite intepreter_test = [] {
should("call builtin functions") = [] {
evaluates_to(Value::symbol("nil"), "typeof nil");
evaluates_to(Value::symbol("symbol"), "typeof foo");
// evaluates_to(Value::symbol("symbol"), "typeof foo");
evaluates_to(Value::symbol("number"), "typeof 100");
produces_output("say 5", "5\n");