expect method logger to be nil
(t *testing.T)
| 106 | |
| 107 | // expect method logger to be nil |
| 108 | func (s) TestGetMethodLoggerOff(t *testing.T) { |
| 109 | testCases := []struct { |
| 110 | in string |
| 111 | method string |
| 112 | }{ |
| 113 | // method not specified. |
| 114 | { |
| 115 | in: "s1/m", |
| 116 | method: "/s/m", |
| 117 | }, |
| 118 | { |
| 119 | in: "s/m1", |
| 120 | method: "/s/m", |
| 121 | }, |
| 122 | { |
| 123 | in: "s1/*", |
| 124 | method: "/s/m", |
| 125 | }, |
| 126 | { |
| 127 | in: "s1/*,s/m1", |
| 128 | method: "/s/m", |
| 129 | }, |
| 130 | |
| 131 | // blacklisted. |
| 132 | { |
| 133 | in: "*,-s/m", |
| 134 | method: "/s/m", |
| 135 | }, |
| 136 | { |
| 137 | in: "s/*,-s/m", |
| 138 | method: "/s/m", |
| 139 | }, |
| 140 | { |
| 141 | in: "-s/m,s/*", |
| 142 | method: "/s/m", |
| 143 | }, |
| 144 | } |
| 145 | for _, tc := range testCases { |
| 146 | l := NewLoggerFromConfigString(tc.in) |
| 147 | if l == nil { |
| 148 | t.Errorf("in: %q, failed to create logger from config string", tc.in) |
| 149 | continue |
| 150 | } |
| 151 | ml := l.GetMethodLogger(tc.method) |
| 152 | if ml != nil { |
| 153 | t.Errorf("in: %q, method logger is non-nil, want nil", tc.in) |
| 154 | } |
| 155 | } |
| 156 | } |
nothing calls this directly
no test coverage detected