@@ -28,6 +28,7 @@ func BenchmarkFormat(i *testing.B) {
2828func TestProcessSessions (t * testing.T ) {
2929 testCases := map [string ]struct {
3030 Input []string
31+ Options Options
3132 Expected []* TmuxSession
3233 }{
3334 "Single active session" : {
@@ -36,6 +37,15 @@ func TestProcessSessions(t *testing.T) {
3637 },
3738 Expected : make ([]* TmuxSession , 1 ),
3839 },
40+ "Hide single active session" : {
41+ Input : []string {
42+ "1705879337 1 /dev/ttys000 1705878987 1 0 $2 1705879328 0 0 session-1 /some/test/path 1 1" ,
43+ },
44+ Options : Options {
45+ HideAttached : true ,
46+ },
47+ Expected : make ([]* TmuxSession , 0 ),
48+ },
3949 "Single inactive session" : {
4050 Input : []string {
4151 "1705879002 0 1705878987 1 0 $2 1705878987 0 0 session-1 /some/test/path 1 1" ,
@@ -70,15 +80,15 @@ func TestProcessSessions(t *testing.T) {
7080
7181 for name , tc := range testCases {
7282 t .Run (name , func (t * testing.T ) {
73- got := processSessions (tc .Input )
83+ got := processSessions (tc .Options , tc . Input )
7484 require .Equal (t , len (tc .Expected ), len (got ))
7585 })
7686 }
7787}
7888
7989func BenchmarkProcessSessions (b * testing.B ) {
8090 for n := 0 ; n < b .N ; n ++ {
81- processSessions ([]string {
91+ processSessions (Options {}, []string {
8292 "1705879337 1 /dev/ttys000 1705878987 1 0 $2 1705879328 0 0 session-1 /some/test/path 1 1" ,
8393 "1705879337 1 /dev/ttys000 1705878987 1 0 $2 1705879328 0 0 session-1 /some/test/path 1 1" ,
8494 })
0 commit comments