fix: add nolint:gosmopolitan for CJK test fixtures, fix gci formatting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dj-oyu 2026-03-19 15:32:13 +09:00
parent 4ecd54eaab
commit 7dec2f8dc8
2 changed files with 10 additions and 12 deletions

View file

@ -280,9 +280,9 @@ func TestRender_Table_EmptyCells(t *testing.T) {
} }
func TestRender_Table_CJK(t *testing.T) { func TestRender_Table_CJK(t *testing.T) {
input := "| 名前 | バージョン |\n|---|---|\n| Go | 1.22 |" input := "| 名前 | バージョン |\n|---|---|\n| Go | 1.22 |" //nolint:gosmopolitan
htmlGot := renderHTML(input) htmlGot := renderHTML(input)
assert.Contains(t, htmlGot, "名前") assert.Contains(t, htmlGot, "名前") //nolint:gosmopolitan
assert.Contains(t, htmlGot, "Go") assert.Contains(t, htmlGot, "Go")
} }

View file

@ -9,15 +9,15 @@ import (
func TestRuneWidth(t *testing.T) { func TestRuneWidth(t *testing.T) {
assert.Equal(t, 1, runeWidth('a')) assert.Equal(t, 1, runeWidth('a'))
assert.Equal(t, 1, runeWidth('1')) assert.Equal(t, 1, runeWidth('1'))
assert.Equal(t, 2, runeWidth('名')) assert.Equal(t, 2, runeWidth('名')) //nolint:gosmopolitan
assert.Equal(t, 2, runeWidth('ア')) assert.Equal(t, 2, runeWidth('ア')) //nolint:gosmopolitan
assert.Equal(t, 2, runeWidth('あ')) assert.Equal(t, 2, runeWidth('あ')) //nolint:gosmopolitan
} }
func TestStringWidth(t *testing.T) { func TestStringWidth(t *testing.T) {
assert.Equal(t, 5, stringWidth("hello")) assert.Equal(t, 5, stringWidth("hello"))
assert.Equal(t, 4, stringWidth("名前")) // 2+2 assert.Equal(t, 4, stringWidth("名前")) //nolint:gosmopolitan // CJK width test
assert.Equal(t, 4, stringWidth("Go言")) // 1+1+2 assert.Equal(t, 4, stringWidth("Go言")) //nolint:gosmopolitan // CJK width test
} }
func TestRenderTableMono(t *testing.T) { func TestRenderTableMono(t *testing.T) {
@ -56,16 +56,14 @@ func TestRenderTableMono_SingleColumn(t *testing.T) {
func TestRenderTableMono_CJK(t *testing.T) { func TestRenderTableMono_CJK(t *testing.T) {
td := tableData{ td := tableData{
headers: []string{"名前", "バージョン"}, headers: []string{"名前", "バージョン"}, //nolint:gosmopolitan
rows: [][]string{ rows: [][]string{
{"Go", "1.22"}, {"Go", "1.22"},
}, },
} }
got := renderTableMono(td) got := renderTableMono(td)
// "名前" width=4, "バージョン" width=10 expected := "名前 | バージョン\n" + //nolint:gosmopolitan
// "Go" width=2, "1.22" width=4
expected := "名前 | バージョン\n" +
"-----+-----------\n" + "-----+-----------\n" +
"Go | 1.22 " "Go | 1.22 "
assert.Equal(t, expected, got) assert.Equal(t, expected, got)
@ -142,7 +140,7 @@ func TestTableWidth(t *testing.T) {
func TestTableWidth_CJK(t *testing.T) { func TestTableWidth_CJK(t *testing.T) {
td := tableData{ td := tableData{
headers: []string{"名前", "値"}, headers: []string{"名前", "値"}, //nolint:gosmopolitan
rows: [][]string{{"Go", "ok"}}, rows: [][]string{{"Go", "ok"}},
} }
// "名前"=4, "値"=2 → max col widths: 4, 2 → total=4+2+3=9 // "名前"=4, "値"=2 → max col widths: 4, 2 → total=4+2+3=9