Implements indexing, currently can only be used with strings
This commit is contained in:
14
tests/integration/IndexTests.cpp
Normal file
14
tests/integration/IndexTests.cpp
Normal 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
|
||||
Reference in New Issue
Block a user