(c *C)
| 96 | } |
| 97 | |
| 98 | func (*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 | |
| 129 | var functxt = `-- +migrate Up |
| 130 | CREATE TABLE IF NOT EXISTS histories ( |
nothing calls this directly
no test coverage detected