WIP/BROKEN: handling and testing nested alts
This commit is contained in:
11
src/Util.hx
11
src/Util.hx
@@ -65,10 +65,17 @@ class Util {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
Strip whichever of the given prefix list comes first at the start of a string
|
||||
**/
|
||||
public static function stripPrefixes(str: String, prefixes: Array<String>) {
|
||||
for (prefix in prefixes) {
|
||||
str = StringTools.replace(str, prefix, '');
|
||||
if (str.indexOf(prefix) == 0) {
|
||||
str = StringTools.replace(str, prefix, '');
|
||||
return StringTools.trim(str);
|
||||
}
|
||||
}
|
||||
return StringTools.trim(str);
|
||||
|
||||
return str;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,6 @@ import utest.Test;
|
||||
|
||||
class TestMain extends Test {
|
||||
public static function main() {
|
||||
utest.UTest.run([new AltTest(), new StoryTest()]);
|
||||
utest.UTest.run([new AltTest(), new StoryTest(), new UtilTest()]);
|
||||
}
|
||||
}
|
||||
10
tests/UtilTest.hx
Normal file
10
tests/UtilTest.hx
Normal file
@@ -0,0 +1,10 @@
|
||||
package tests;
|
||||
|
||||
import utest.Test;
|
||||
|
||||
class UtilTest extends Test {
|
||||
var exampleStr1 = "here is a string {with enclosures {all nested} {up in it}}";
|
||||
public function testNestedEnclosure1() {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user