diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-05 10:26:16 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-05 10:26:16 +0300 |
| commit | 1433f7a13ede0c819ec4f8fd4027ad3df8daa94f (patch) | |
| tree | d3e98bc150711350585dd8203c5b50cc93243e52 /internal/askcli/command_complete_uuids_test.go | |
| parent | 0a52adf5752835da01e8a29df15e415398165c48 (diff) | |
Add 'ask edit' subcommand and collapse multi-line task descriptionsv0.40.0
- ask edit opens $EDITOR and creates a task from the (multi-line) content,
reusing the shared internal/editor package
- collapse newlines in list output and fish completion so multi-line
descriptions render on one line and don't break completion
Bump version to 0.40.0
Amp-Thread-ID: https://ampcode.com/threads/T-019e96a1-9c8e-73d6-95b4-b55cb12cc762
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'internal/askcli/command_complete_uuids_test.go')
| -rw-r--r-- | internal/askcli/command_complete_uuids_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/askcli/command_complete_uuids_test.go b/internal/askcli/command_complete_uuids_test.go index 0859acc..2c1b5fd 100644 --- a/internal/askcli/command_complete_uuids_test.go +++ b/internal/askcli/command_complete_uuids_test.go @@ -255,3 +255,31 @@ func TestTruncateDescription_Unicode(t *testing.T) { t.Fatalf("truncateDescription = %q, want %q", got, "日本語…") } } + +func TestTruncateDescription_CollapsesNewlines(t *testing.T) { + // Multi-line descriptions must collapse to a single line so the + // tab-separated completion output is not broken into bogus entries. + got := truncateDescription("first line\nsecond line\n\nfourth", 100) + if got != "first line second line fourth" { + t.Fatalf("truncateDescription = %q, want single-line collapse", got) + } + if strings.ContainsAny(got, "\r\n") { + t.Fatalf("truncateDescription left a newline in %q", got) + } +} + +func TestOneLineDescription(t *testing.T) { + cases := map[string]string{ + "plain": "plain", + "a\nb": "a b", + "a\r\nb": "a b", + "a\n\n\nb": "a b", + " leading\n indented ": "leading indented", + "keep internal spaces": "keep internal spaces", + } + for in, want := range cases { + if got := oneLineDescription(in); got != want { + t.Fatalf("oneLineDescription(%q) = %q, want %q", in, got, want) + } + } +} |
