MCPcopy
hub / github.com/rubenv/sql-migrate / TestCustomTerminator

Method TestCustomTerminator

sqlparse/sqlparse_test.go:98–127  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

96}
97
98func (*SqlParseSuite) TestCustomTerminator(c *C) {
99 LineSeparator = "GO"
100 defer func() { LineSeparator = "" }()
101
102 type testData struct {
103 sql string
104 upCount int
105 downCount int
106 }
107
108 tests := []testData{
109 {
110 sql: functxtSplitByGO,
111 upCount: 2,
112 downCount: 2,
113 },
114 {
115 sql: multitxtSplitByGO,
116 upCount: 2,
117 downCount: 2,
118 },
119 }
120
121 for _, test := range tests {
122 migration, err := ParseMigration(strings.NewReader(test.sql))
123 c.Assert(err, IsNil)
124 c.Assert(migration.UpStatements, HasLen, test.upCount)
125 c.Assert(migration.DownStatements, HasLen, test.downCount)
126 }
127}
128
129var functxt = `-- +migrate Up
130CREATE TABLE IF NOT EXISTS histories (

Callers

nothing calls this directly

Calls 1

ParseMigrationFunction · 0.70

Tested by

no test coverage detected