| 74 | } |
| 75 | |
| 76 | func TestColumnSelects(t *testing.T) { |
| 77 | t.Parallel() |
| 78 | input := []string{ |
| 79 | "60916 s003 Ss+ 0:00.51 /bin/bash -l", |
| 80 | " 6653 s004 R+ 0:00.01 ps ax", |
| 81 | "short line", |
| 82 | "80159 s004 Ss 0:00.56 /bin/bash -l", |
| 83 | "60942 s006 Ss+ 0:00.53 /bin/bash -l", |
| 84 | "60943 s007 Ss+ 0:00.51 /bin/bash -l", |
| 85 | "60977 s009 Ss+ 0:00.52 /bin/bash -l", |
| 86 | " 60978 s010 Ss+ 0:00.53 /bin/bash -l", |
| 87 | "61356 s011 Ss 0:00.54 /bin/bash -l", |
| 88 | } |
| 89 | tcs := []struct { |
| 90 | col int |
| 91 | want []string |
| 92 | }{ |
| 93 | { |
| 94 | col: -1, |
| 95 | want: []string{}, |
| 96 | }, |
| 97 | { |
| 98 | col: 0, |
| 99 | want: []string{}, |
| 100 | }, |
| 101 | { |
| 102 | col: 1, |
| 103 | want: []string{ |
| 104 | "60916", |
| 105 | "6653", |
| 106 | "short", |
| 107 | "80159", |
| 108 | "60942", |
| 109 | "60943", |
| 110 | "60977", |
| 111 | "60978", |
| 112 | "61356", |
| 113 | }, |
| 114 | }, |
| 115 | { |
| 116 | col: 2, |
| 117 | want: []string{ |
| 118 | "s003", |
| 119 | "s004", |
| 120 | "line", |
| 121 | "s004", |
| 122 | "s006", |
| 123 | "s007", |
| 124 | "s009", |
| 125 | "s010", |
| 126 | "s011", |
| 127 | }, |
| 128 | }, |
| 129 | { |
| 130 | col: 3, |
| 131 | want: []string{ |
| 132 | "Ss+", |
| 133 | "R+", |