diff options
| -rw-r--r-- | src/naming.c | 2 | ||||
| -rw-r--r-- | test/paths.tm | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/naming.c b/src/naming.c index 8f18b70e..e3ae7550 100644 --- a/src/naming.c +++ b/src/naming.c @@ -74,7 +74,7 @@ static CONSTFUNC bool is_keyword(const char *word, size_t len) { int64_t lo = 0, hi = sizeof(c_keywords) / sizeof(c_keywords[0]) - 1; while (lo <= hi) { int64_t mid = (lo + hi) / 2; - int32_t cmp = strncmp(word, c_keywords[mid], len); + int32_t cmp = strncmp(word, c_keywords[mid], len + 1); if (cmp == 0) return true; else if (cmp > 0) lo = mid + 1; else if (cmp < 0) hi = mid - 1; diff --git a/test/paths.tm b/test/paths.tm index e72cddec..a76575e8 100644 --- a/test/paths.tm +++ b/test/paths.tm @@ -99,3 +99,9 @@ func main() say("Globbing:") >> (./*.tm).glob() + + assert (./foo).type == Relative + assert (/foo).type == Absolute + assert (~/foo).type == Home + assert (/foo/baz).components == ["foo", "baz"] + assert Path(type=Relative, ["foo", "baz"]) == (./foo/baz) |
