...

Source file src/cuelang.org/go/cue/literal/indent_test.go

Documentation: cuelang.org/go/cue/literal

     1  // Copyright 2020 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 literal
    16  
    17  import (
    18  	"testing"
    19  )
    20  
    21  func TestIndentTabs(t *testing.T) {
    22  	testCases := []struct {
    23  		in  string
    24  		out string
    25  	}{{
    26  		in: `"""
    27  		foo
    28  		bar
    29  		"""`,
    30  		out: `"""
    31  			foo
    32  			bar
    33  			"""`,
    34  	}, {
    35  		in: `"""
    36  			foo
    37  			bar
    38  			"""`,
    39  		out: `"""
    40  			foo
    41  			bar
    42  			"""`,
    43  	}, {
    44  		in:  `""`,
    45  		out: `""`,
    46  	}}
    47  	for _, tc := range testCases {
    48  		t.Run("", func(t *testing.T) {
    49  			got := IndentTabs(tc.in, 3)
    50  			if got != tc.out {
    51  				t.Errorf("got %s; want %s", got, tc.out)
    52  			}
    53  		})
    54  	}
    55  }
    56  

View as plain text