| 1 | package ansi |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestUrxvtExt(t *testing.T) { |
| 6 | tests := []struct { |
| 7 | extension string |
| 8 | params []string |
| 9 | expected string |
| 10 | }{ |
| 11 | { |
| 12 | extension: "foo", |
| 13 | params: []string{"bar", "baz"}, |
| 14 | expected: "\x1b]777;foo;bar;baz\x07", |
| 15 | }, |
| 16 | { |
| 17 | extension: "test", |
| 18 | params: []string{}, |
| 19 | expected: "\x1b]777;test;\x07", |
| 20 | }, |
| 21 | { |
| 22 | extension: "example", |
| 23 | params: []string{"param1"}, |
| 24 | expected: "\x1b]777;example;param1\x07", |
| 25 | }, |
| 26 | { |
| 27 | extension: "notify", |
| 28 | params: []string{"message", "info"}, |
| 29 | expected: "\x1b]777;notify;message;info\x07", |
| 30 | }, |
| 31 | } |
| 32 | |
| 33 | for _, tt := range tests { |
| 34 | result := URxvtExt(tt.extension, tt.params...) |
| 35 | if result != tt.expected { |
| 36 | t.Errorf("URxvtExt(%q, %v) = %q; want %q", tt.extension, tt.params, result, tt.expected) |
| 37 | } |
| 38 | } |
| 39 | } |