29 lines
655 B
C++
29 lines
655 B
C++
#ifdef TESTS_BUILD
|
|
#include <catch.hpp>
|
|
#include "../src/Script.hpp"
|
|
using namespace Porygon;
|
|
|
|
TEST_CASE( "String indexing", "[integration]" ) {
|
|
auto script = Script::Create("'foobar'[4]");
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
auto result = script->Evaluate();
|
|
REQUIRE(result->EvaluateString() == u"b");
|
|
delete script;
|
|
}
|
|
|
|
TEST_CASE( "Identifier Index", "[integration]" ) {
|
|
auto script = Script::Create(uR"(
|
|
foo = {
|
|
bar = "test"
|
|
}
|
|
return foo.bar
|
|
)");
|
|
REQUIRE(!script->Diagnostics -> HasErrors());
|
|
auto result = script->Evaluate();
|
|
REQUIRE(result->EvaluateString() == u"test");
|
|
delete script;
|
|
}
|
|
|
|
|
|
#endif
|