github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/cue/errors/errors_test.go (about)

     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  	"github.com/joomcode/cue/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.Pos
    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.AddNewf(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, nil)
   188  		if gotW := w.String(); gotW != tt.wantW {
   189  			t.Errorf("%q. PrintError() = %v, want %v", tt.name, gotW, tt.wantW)
   190  		}
   191  	}
   192  }