Marcel van Lohuizen | 0df062f | 2018-12-10 15:27:18 +0100 | [diff] [blame^] | 1 | // Copyright 2018 The CUE Authors |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package errors |
| 16 | |
| 17 | import ( |
| 18 | "bytes" |
| 19 | "testing" |
| 20 | |
| 21 | "cuelang.org/go/cue/token" |
| 22 | ) |
| 23 | |
| 24 | func TestError_Error(t *testing.T) { |
| 25 | tests := []struct { |
| 26 | name string |
| 27 | e Error |
| 28 | want string |
| 29 | }{ |
| 30 | // TODO: Add test cases. |
| 31 | } |
| 32 | for _, tt := range tests { |
| 33 | if got := tt.e.Error(); got != tt.want { |
| 34 | t.Errorf("%q. Error.Error() = %v, want %v", tt.name, got, tt.want) |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | func TestErrorList_Add(t *testing.T) { |
| 40 | type args struct { |
| 41 | pos token.Position |
| 42 | msg string |
| 43 | } |
| 44 | tests := []struct { |
| 45 | name string |
| 46 | p *List |
| 47 | args args |
| 48 | }{ |
| 49 | // TODO: Add test cases. |
| 50 | } |
| 51 | for _, tt := range tests { |
| 52 | tt.p.AddNew(tt.args.pos, tt.args.msg) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | func TestErrorList_Reset(t *testing.T) { |
| 57 | tests := []struct { |
| 58 | name string |
| 59 | p *List |
| 60 | }{ |
| 61 | // TODO: Add test cases. |
| 62 | } |
| 63 | for _, tt := range tests { |
| 64 | tt.p.Reset() |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | func TestErrorList_Len(t *testing.T) { |
| 69 | tests := []struct { |
| 70 | name string |
| 71 | p List |
| 72 | want int |
| 73 | }{ |
| 74 | // TODO: Add test cases. |
| 75 | } |
| 76 | for _, tt := range tests { |
| 77 | if got := tt.p.Len(); got != tt.want { |
| 78 | t.Errorf("%q. List.Len() = %v, want %v", tt.name, got, tt.want) |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | func TestErrorList_Swap(t *testing.T) { |
| 84 | type args struct { |
| 85 | i int |
| 86 | j int |
| 87 | } |
| 88 | tests := []struct { |
| 89 | name string |
| 90 | p List |
| 91 | args args |
| 92 | }{ |
| 93 | // TODO: Add test cases. |
| 94 | } |
| 95 | for _, tt := range tests { |
| 96 | tt.p.Swap(tt.args.i, tt.args.j) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | func TestErrorList_Less(t *testing.T) { |
| 101 | type args struct { |
| 102 | i int |
| 103 | j int |
| 104 | } |
| 105 | tests := []struct { |
| 106 | name string |
| 107 | p List |
| 108 | args args |
| 109 | want bool |
| 110 | }{ |
| 111 | // TODO: Add test cases. |
| 112 | } |
| 113 | for _, tt := range tests { |
| 114 | if got := tt.p.Less(tt.args.i, tt.args.j); got != tt.want { |
| 115 | t.Errorf("%q. List.Less() = %v, want %v", tt.name, got, tt.want) |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | func TestErrorList_Sort(t *testing.T) { |
| 121 | tests := []struct { |
| 122 | name string |
| 123 | p List |
| 124 | }{ |
| 125 | // TODO: Add test cases. |
| 126 | } |
| 127 | for _, tt := range tests { |
| 128 | tt.p.Sort() |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | func TestErrorList_RemoveMultiples(t *testing.T) { |
| 133 | tests := []struct { |
| 134 | name string |
| 135 | p *List |
| 136 | }{ |
| 137 | // TODO: Add test cases. |
| 138 | } |
| 139 | for _, tt := range tests { |
| 140 | tt.p.RemoveMultiples() |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | func TestErrorList_Error(t *testing.T) { |
| 145 | tests := []struct { |
| 146 | name string |
| 147 | p List |
| 148 | want string |
| 149 | }{ |
| 150 | // TODO: Add test cases. |
| 151 | } |
| 152 | for _, tt := range tests { |
| 153 | if got := tt.p.Error(); got != tt.want { |
| 154 | t.Errorf("%q. List.Error() = %v, want %v", tt.name, got, tt.want) |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | func TestErrorList_Err(t *testing.T) { |
| 160 | tests := []struct { |
| 161 | name string |
| 162 | p List |
| 163 | wantErr bool |
| 164 | }{ |
| 165 | // TODO: Add test cases. |
| 166 | } |
| 167 | for _, tt := range tests { |
| 168 | if err := tt.p.Err(); (err != nil) != tt.wantErr { |
| 169 | t.Errorf("%q. List.Err() error = %v, wantErr %v", tt.name, err, tt.wantErr) |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | func TestPrintError(t *testing.T) { |
| 175 | type args struct { |
| 176 | err error |
| 177 | } |
| 178 | tests := []struct { |
| 179 | name string |
| 180 | args args |
| 181 | wantW string |
| 182 | }{ |
| 183 | // TODO: Add test cases. |
| 184 | } |
| 185 | for _, tt := range tests { |
| 186 | w := &bytes.Buffer{} |
| 187 | Print(w, tt.args.err) |
| 188 | if gotW := w.String(); gotW != tt.wantW { |
| 189 | t.Errorf("%q. PrintError() = %v, want %v", tt.name, gotW, tt.wantW) |
| 190 | } |
| 191 | } |
| 192 | } |