Implements indexing, currently can only be used with strings

This commit is contained in:
2019-06-06 17:35:51 +02:00
parent b275e1fbd6
commit cb5d9e2f62
15 changed files with 140 additions and 9 deletions

View File

@@ -0,0 +1,14 @@
#ifdef TESTS_BUILD
#include <catch.hpp>
#include "../src/Script.hpp"
TEST_CASE( "String indexing", "[integration]" ) {
auto script = Script::Create("'foobar'[4]");
REQUIRE(!script->Diagnostics -> HasErrors());
script->Evaluate();
auto lastValue = script->GetLastValue();
REQUIRE(*lastValue->EvaluateString() == "b");
delete script;
}
#endif