mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 19:45:49 +00:00
url: carefully extend test cases
Extend existing test cases with `~`, `$VAR`, and bare .-prefixed paths and embedded `,` comma handling. See following issue comments: - https://github.com/ghostty-org/ghostty/pull/10570#issuecomment-3853842036 - https://github.com/ghostty-org/ghostty/issues/1972#issuecomment-3859329233 - https://github.com/ghostty-org/ghostty/issues/1972#issuecomment-3857881196
This commit is contained in:
@@ -155,7 +155,7 @@ test "url regex" {
|
||||
.expect = "https://example.com",
|
||||
},
|
||||
.{
|
||||
.input = "Link trailing colon https://example.com, more text.",
|
||||
.input = "Link trailing comma https://example.com, more text.",
|
||||
.expect = "https://example.com",
|
||||
},
|
||||
.{
|
||||
@@ -369,6 +369,47 @@ test "url regex" {
|
||||
.input = "some-pkg/src/file.txt more text",
|
||||
.expect = "some-pkg/src/file.txt",
|
||||
},
|
||||
.{
|
||||
.input = "~/foo/bar.txt",
|
||||
.expect = "~/foo/bar.txt",
|
||||
},
|
||||
.{
|
||||
.input = "open ~/Documents/notes.md please",
|
||||
.expect = "~/Documents/notes.md",
|
||||
},
|
||||
.{
|
||||
.input = "~/.config/ghostty/config",
|
||||
.expect = "~/.config/ghostty/config",
|
||||
},
|
||||
.{
|
||||
.input = "directory: ~/src/ghostty-org/ghostty",
|
||||
.expect = "~/src/ghostty-org/ghostty",
|
||||
},
|
||||
.{
|
||||
.input = "$HOME/src/config/url.zig",
|
||||
.expect = "$HOME/src/config/url.zig",
|
||||
},
|
||||
.{
|
||||
.input = "project dir: $PWD/src/ghostty/main.zig",
|
||||
.expect = "$PWD/src/ghostty/main.zig",
|
||||
},
|
||||
.{
|
||||
.input = ".config/ghostty/config",
|
||||
.expect = ".config/ghostty/config",
|
||||
},
|
||||
.{
|
||||
.input = "loaded from .local/share/ghostty/state.db now",
|
||||
.expect = ".local/share/ghostty/state.db",
|
||||
},
|
||||
.{
|
||||
.input = "../some/where",
|
||||
.expect = "../some/where",
|
||||
},
|
||||
// comma-separated file paths
|
||||
.{
|
||||
.input = " - shared/src/foo/SomeItem.m:12, shared/src/",
|
||||
.expect = "shared/src/foo/SomeItem.m:12",
|
||||
},
|
||||
};
|
||||
|
||||
for (cases) |case| {
|
||||
|
||||
Reference in New Issue
Block a user