PorygonLang/tests/integration/IndexTests.cpp

15 lines
367 B
C++
Raw Normal View History

#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