Add implementations for firstword/lastword

Bug: 226974242
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: Ibb992f42a59212bae48acd55647b2d0872c2f69e
This commit is contained in:
Cole Faust
2022-04-27 17:50:55 -07:00
parent 63e1012b05
commit c93109dc36
2 changed files with 26 additions and 0 deletions

View File

@@ -81,6 +81,15 @@ assert_eq("/foo/baz", rblf.abspath("/foo/bar/../baz"))
assert_eq(cwd+"/foo/bar "+cwd+"/foo/baz", rblf.abspath("foo/bar foo/baz"))
assert_eq("/baz", rblf.abspath("/../../../../../../../../../../../../../../../../baz"))
assert_eq("foo", rblf.first_word("foo bar"))
assert_eq("foo", rblf.first_word(["foo", "bar"]))
assert_eq("", rblf.first_word(""))
assert_eq("", rblf.first_word([]))
assert_eq("bar", rblf.last_word("foo bar"))
assert_eq("bar", rblf.last_word(["foo", "bar"]))
assert_eq("", rblf.last_word(""))
assert_eq("", rblf.last_word([]))
assert_eq(
["build/make/tests/board.rbc", "build/make/tests/board_input_vars.rbc"],
rblf.expand_wildcard("build/make/tests/board*.rbc")