Revised tests

This commit is contained in:
2026-05-30 10:53:21 +10:00
parent 75cb1dfa86
commit d194bff5fe
36 changed files with 266 additions and 199 deletions
+27
View File
@@ -0,0 +1,27 @@
//declare, define and manipulate strings
{
var string: String = "Hello World";
assert string[5] == " ", "String indexing failed";
var greeting: String = string[0:5];
assert greeting == "Hello", "String slicing failed";
var parting: String = "Goodbye " .. string[6:5];
print parting;
assert parting == "Goodbye World", "String concat from an index failed";
//WARN: Unbounded slice not possible without indexing from the end of a string
//var simple: String = parting[5:-1];
//assert simple == "bye World", "String unbounded slice failed";
}
//var greeting: String = "Hello World";
//var parting: String = "Goodbye " .. greeting[6:5];
//String attributes
{
var string: String = "Hello World";
assert string.length == 11, "string.length failed";
assert string.asUpper == "HELLO WORLD", "string.asUpper failed";
assert string.asLower == "hello world", "string.asLower failed";
}