Implements binding and evaluating function declarations
This commit is contained in:
17
tests/integration/Functions.cpp
Normal file
17
tests/integration/Functions.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include <catch.hpp>
|
||||
#include "../src/Script.hpp"
|
||||
|
||||
TEST_CASE( "Define script function", "[integration]" ) {
|
||||
Script* script = Script::Create("function add(number a, number b) a + b end");
|
||||
REQUIRE(!script->Diagnostics -> HasErrors());
|
||||
script->Evaluate();
|
||||
auto variable = script->GetVariable("add");
|
||||
REQUIRE(variable != nullptr);
|
||||
REQUIRE(variable->GetType()->GetClass() == TypeClass::Function);
|
||||
delete script;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user