feat(dbml): support case-insensitive table note parsing
This commit is contained in:
@@ -1037,12 +1037,13 @@ func TestReader_ColumnPKOrderPreserved(t *testing.T) {
|
||||
func TestReader_MultilineTableNote(t *testing.T) {
|
||||
dbmlContent := "Table \"info\".\"city\" {\n" +
|
||||
" \"id_city\" serial [pk, not null, increment]\n" +
|
||||
" \"name\" text [not null]\n\n" +
|
||||
" Note: '''\n" +
|
||||
" \"name\" text [not null, note: 'first, second, third']\n\n" +
|
||||
" note: '''\n" +
|
||||
" Cities and municipalities worldwide.\n\n" +
|
||||
" SPATIAL:\n" +
|
||||
" Proximity queries use a GiST index.\n" +
|
||||
" '''\n" +
|
||||
" Note: 'Short summary'\n" +
|
||||
"}\n"
|
||||
path := filepath.Join(t.TempDir(), "city.dbml")
|
||||
if err := os.WriteFile(path, []byte(dbmlContent), 0o644); err != nil {
|
||||
@@ -1058,7 +1059,13 @@ func TestReader_MultilineTableNote(t *testing.T) {
|
||||
if got, want := table.Description, "Cities and municipalities worldwide.\n\nSPATIAL:\nProximity queries use a GiST index."; got != want {
|
||||
t.Errorf("table description = %q, want %q", got, want)
|
||||
}
|
||||
if got, want := table.Comment, "Short summary"; got != want {
|
||||
t.Errorf("table comment = %q, want %q", got, want)
|
||||
}
|
||||
if got, want := len(table.Columns), 2; got != want {
|
||||
t.Errorf("column count = %d, want %d; note body must not be parsed as columns", got, want)
|
||||
}
|
||||
if got, want := table.Columns["name"].Comment, "first, second, third"; got != want {
|
||||
t.Errorf("column note = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user