File: urxvt_test.go

package info (click to toggle)
golang-github-charmbracelet-x 0.0~git20251028.0cf22f8%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,940 kB
  • sloc: sh: 124; makefile: 5
file content (39 lines) | stat: -rw-r--r-- 803 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package ansi

import "testing"

func TestUrxvtExt(t *testing.T) {
	tests := []struct {
		extension string
		params    []string
		expected  string
	}{
		{
			extension: "foo",
			params:    []string{"bar", "baz"},
			expected:  "\x1b]777;foo;bar;baz\x07",
		},
		{
			extension: "test",
			params:    []string{},
			expected:  "\x1b]777;test;\x07",
		},
		{
			extension: "example",
			params:    []string{"param1"},
			expected:  "\x1b]777;example;param1\x07",
		},
		{
			extension: "notify",
			params:    []string{"message", "info"},
			expected:  "\x1b]777;notify;message;info\x07",
		},
	}

	for _, tt := range tests {
		result := URxvtExt(tt.extension, tt.params...)
		if result != tt.expected {
			t.Errorf("URxvtExt(%q, %v) = %q; want %q", tt.extension, tt.params, result, tt.expected)
		}
	}
}