test(format): select_wrap respects commas setting
This commit is contained in:
@@ -694,3 +694,19 @@ func TestJoinWrap(t *testing.T) {
|
|||||||
t.Errorf("when_long long should equal always")
|
t.Errorf("when_long long should equal always")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSelectWrapBrokenHonoursCommaStyle(t *testing.T) {
|
||||||
|
src := "select a, b, c from t"
|
||||||
|
st := config.Default()
|
||||||
|
st.SelectWrap = config.WrapWhenLong
|
||||||
|
st.LineWidth = 8
|
||||||
|
st.Commas = config.CommaTrailing
|
||||||
|
got := File(parser.Parse(src), st)
|
||||||
|
if !strings.Contains(got, " a,\n") || strings.Contains(got, "\n ,b") {
|
||||||
|
t.Errorf("trailing commas expected when broken:\n%s", got)
|
||||||
|
}
|
||||||
|
st.Commas = config.CommaLeading
|
||||||
|
if got := File(parser.Parse(src), st); !strings.Contains(got, "\n ,b") {
|
||||||
|
t.Errorf("leading commas expected when broken:\n%s", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user