37 lines
973 B
C++
37 lines
973 B
C++
|
|
#ifdef TESTS_BUILD
|
|
#include <catch.hpp>
|
|
#include "../src/Script.hpp"
|
|
|
|
|
|
TEST_CASE( "Simple String", "[integration]" ) {
|
|
auto script = Script::Create("\"foo bar\"");
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
script->Evaluate();
|
|
auto lastValue = script->GetLastValue();
|
|
REQUIRE(*lastValue->EvaluateString() == u"foo bar");
|
|
delete script;
|
|
}
|
|
|
|
TEST_CASE( "String Concat", "[integration]" ) {
|
|
auto script = Script::Create(R"("foo" + "bar")");
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
script->Evaluate();
|
|
auto lastValue = script->GetLastValue();
|
|
REQUIRE(*lastValue->EvaluateString() == u"foobar");
|
|
delete script;
|
|
}
|
|
|
|
TEST_CASE( "String Concat 2", "[integration]" ) {
|
|
auto script = Script::Create("'foo' + 'bar'");
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
script->Evaluate();
|
|
auto lastValue = script->GetLastValue();
|
|
REQUIRE(*lastValue->EvaluateString() == u"foobar");
|
|
delete script;
|
|
}
|
|
|
|
|
|
#endif
|
|
|