Skip to content

Commit 6831c51

Browse files
author
Lars Moastuen
committed
Add more test cases for Migration.Less()
1 parent 3c91f41 commit 6831c51

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

migrate_test.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,18 @@ func (s *SqliteMigrateSuite) TestPlanMigrationWithHoles(c *C) {
360360
c.Assert(plannedMigrations[2].Queries[0], Equals, down)
361361
}
362362

363-
func (s *SqliteMigrateSuite) TestLessTwoNumeric(c *C) {
364-
c.Assert((Migration{Id: "1"}).Less(&Migration{Id: "2"}), Equals, true) // 1 less than 2
365-
c.Assert((Migration{Id: "2"}).Less(&Migration{Id: "1"}), Equals, false) // 2 not less than 1
366-
c.Assert((Migration{Id: "1"}).Less(&Migration{Id: "a"}), Equals, true) // 1 less than a
367-
c.Assert((Migration{Id: "a"}).Less(&Migration{Id: "1"}), Equals, false) // a not less than 1
368-
c.Assert((Migration{Id: "a"}).Less(&Migration{Id: "a"}), Equals, false) // a not less than a
369-
c.Assert((Migration{Id: "1-a"}).Less(&Migration{Id: "1-b"}), Equals, true) // 1-a less than 1-b
370-
c.Assert((Migration{Id: "1-b"}).Less(&Migration{Id: "1-a"}), Equals, false) // 1-b not less than 1-a
363+
func (s *SqliteMigrateSuite) TestLess(c *C) {
364+
c.Assert((Migration{Id: "1"}).Less(&Migration{Id: "2"}), Equals, true) // 1 less than 2
365+
c.Assert((Migration{Id: "2"}).Less(&Migration{Id: "1"}), Equals, false) // 2 not less than 1
366+
c.Assert((Migration{Id: "1"}).Less(&Migration{Id: "a"}), Equals, true) // 1 less than a
367+
c.Assert((Migration{Id: "a"}).Less(&Migration{Id: "1"}), Equals, false) // a not less than 1
368+
c.Assert((Migration{Id: "a"}).Less(&Migration{Id: "a"}), Equals, false) // a not less than a
369+
c.Assert((Migration{Id: "1-a"}).Less(&Migration{Id: "1-b"}), Equals, true) // 1-a less than 1-b
370+
c.Assert((Migration{Id: "1-b"}).Less(&Migration{Id: "1-a"}), Equals, false) // 1-b not less than 1-a
371+
c.Assert((Migration{Id: "1"}).Less(&Migration{Id: "10"}), Equals, true) // 1 less than 10
372+
c.Assert((Migration{Id: "10"}).Less(&Migration{Id: "1"}), Equals, false) // 10 not less than 1
373+
c.Assert((Migration{Id: "1_foo"}).Less(&Migration{Id: "10_bar"}), Equals, true) // 1_foo not less than 1
374+
c.Assert((Migration{Id: "10_bar"}).Less(&Migration{Id: "1_foo"}), Equals, false) // 10 not less than 1
371375
// 20160126_1100 less than 20160126_1200
372376
c.Assert((Migration{Id: "20160126_1100"}).
373377
Less(&Migration{Id: "20160126_1200"}), Equals, true)

0 commit comments

Comments
 (0)