github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/utils/readline/preview_test.go (about)

     1  package readline
     2  
     3  /*func TestGetPreviewWidth(t *testing.T) {
     4  	tests := []struct {
     5  		Term    int
     6  		Preview int
     7  		Forward int
     8  	}{
     9  		{
    10  			Term:    79,
    11  			Preview: 75,
    12  			Forward: 2,
    13  		},
    14  		{
    15  			Term:    92,
    16  			Preview: 80,
    17  			Forward: 10,
    18  		},
    19  		{
    20  			Term:    80,
    21  			Preview: 76,
    22  			Forward: 2,
    23  		},
    24  		{
    25  			Term:    120,
    26  			Preview: 116,
    27  			Forward: 2,
    28  		},
    29  		{
    30  			Term:    300,
    31  			Preview: 120,
    32  			Forward: 178,
    33  		},
    34  	}
    35  
    36  	count.Tests(t, len(tests))
    37  
    38  	for i, test := range tests {
    39  		preview, forward := getPreviewWidth(test.Term)
    40  		if preview != test.Preview || forward != test.Forward {
    41  			t.Errorf("Maths fail in test %d", i)
    42  			t.Logf("  Term Width:  %d", test.Term)
    43  			t.Logf("  Exp Preview: %d", test.Preview)
    44  			t.Logf("  Act Preview: %d", preview)
    45  			t.Logf("  Exp Forward: %d", test.Forward)
    46  			t.Logf("  Act Forward: %d", forward)
    47  		}
    48  	}
    49  }*/