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

Method TestLess

migrate_test.go:476–494  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

474}
475
476func (*SqliteMigrateSuite) TestLess(c *C) {
477 c.Assert((Migration{Id: "1"}).Less(&Migration{Id: "2"}), Equals, true) // 1 less than 2
478 c.Assert((Migration{Id: "2"}).Less(&Migration{Id: "1"}), Equals, false) // 2 not less than 1
479 c.Assert((Migration{Id: "1"}).Less(&Migration{Id: "a"}), Equals, true) // 1 less than a
480 c.Assert((Migration{Id: "a"}).Less(&Migration{Id: "1"}), Equals, false) // a not less than 1
481 c.Assert((Migration{Id: "a"}).Less(&Migration{Id: "a"}), Equals, false) // a not less than a
482 c.Assert((Migration{Id: "1-a"}).Less(&Migration{Id: "1-b"}), Equals, true) // 1-a less than 1-b
483 c.Assert((Migration{Id: "1-b"}).Less(&Migration{Id: "1-a"}), Equals, false) // 1-b not less than 1-a
484 c.Assert((Migration{Id: "1"}).Less(&Migration{Id: "10"}), Equals, true) // 1 less than 10
485 c.Assert((Migration{Id: "10"}).Less(&Migration{Id: "1"}), Equals, false) // 10 not less than 1
486 c.Assert((Migration{Id: "1_foo"}).Less(&Migration{Id: "10_bar"}), Equals, true) // 1_foo not less than 1
487 c.Assert((Migration{Id: "10_bar"}).Less(&Migration{Id: "1_foo"}), Equals, false) // 10 not less than 1
488 // 20160126_1100 less than 20160126_1200
489 c.Assert((Migration{Id: "20160126_1100"}).
490 Less(&Migration{Id: "20160126_1200"}), Equals, true)
491 // 20160126_1200 not less than 20160126_1100
492 c.Assert((Migration{Id: "20160126_1200"}).
493 Less(&Migration{Id: "20160126_1100"}), Equals, false)
494}
495
496func (s *SqliteMigrateSuite) TestPlanMigrationWithUnknownDatabaseMigrationApplied(c *C) {
497 migrations := &MemoryMigrationSource{

Callers

nothing calls this directly

Calls 1

LessMethod · 0.45

Tested by

no test coverage detected