aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-10-01 12:53:23 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-10-01 12:53:23 -0400
commit36afd7fbc7fbc5c4df041a4662cbc1da4cfc6441 (patch)
tree6a80fd6f6b9c8c7c61f8a4b6abb0b5cfb1088bc7
parent6583fe9b389a6b4698f9364945885e6783506886 (diff)
parent3d5332493c50b32c683bda8f4d40ec4f12a323ec (diff)
Merge branch 'dev' into zero-nones
-rw-r--r--src/naming.c2
-rw-r--r--test/paths.tm6
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)