Skip to content

Commit

Permalink
Fix CommandsTests for scala 2.13
Browse files Browse the repository at this point in the history
Scala 2.12 and 2.13 give different outputs for toString
  • Loading branch information
karolchmist committed Apr 24, 2020
1 parent ef1d398 commit 3363571
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 66 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.liyaos.forklift.slick.tests.unittests

object CommandTestsPreview {

val CommandTests_PreviewSeq: Seq[String] = List(
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

1 SqlMigration:
${"\t"}[create table "users" ("id" INTEGER NOT NULL PRIMARY KEY,"first" VARCHAR(255) NOT NULL,"last" VARCHAR(255) NOT NULL)]

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

2 DBIOMigration:
${"\t"}CommandTests.profile.api.queryInsertActionExtensionMethods[CommandTests.this.UsersV2#TableElementType, Seq](CommandTests.UsersV2).++=(scala.collection.Seq[com.liyaos.forklift.slick.tests.unittests.UsersRow](UsersRow(1, "Chris", "Vogt"), UsersRow(2, "Yao", "Li")))

--------------------------------------------------------------------------------
""")

val CommandTests_PreviewSeq_MySql = List(
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

1 SqlMigration:
${"\t"}[create table `users` (`id` INTEGER NOT NULL PRIMARY KEY,`first` VARCHAR(255) NOT NULL,`last` VARCHAR(255) NOT NULL)]

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

2 DBIOMigration:
${"\t"}MySQLCommandTests.profile.api.queryInsertActionExtensionMethods[MySQLCommandTests.this.UsersV2#TableElementType, Seq](MySQLCommandTests.UsersV2).++=(scala.collection.Seq[com.liyaos.forklift.slick.tests.unittests.UsersRow](UsersRow(1, "Chris", "Vogt"), UsersRow(2, "Yao", "Li")))

--------------------------------------------------------------------------------
""")

val CommandTests_PreviewSeq_Derby = List(
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

1 SqlMigration:
${"\t"}[create table "users" ("id" INTEGER NOT NULL PRIMARY KEY,"first" VARCHAR(255) NOT NULL,"last" VARCHAR(255) NOT NULL)]

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

2 DBIOMigration:
${"\t"}DerbyCommandTests.profile.api.queryInsertActionExtensionMethods[DerbyCommandTests.this.UsersV2#TableElementType, Seq](DerbyCommandTests.UsersV2).++=(scala.collection.Seq[com.liyaos.forklift.slick.tests.unittests.UsersRow](UsersRow(1, "Chris", "Vogt"), UsersRow(2, "Yao", "Li")))

--------------------------------------------------------------------------------
""")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.liyaos.forklift.slick.tests.unittests

object CommandTestsPreview {

val CommandTests_PreviewSeq: Seq[String] = List(
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

1 SqlMigration:
${"\t"}[create table "users" ("id" INTEGER NOT NULL PRIMARY KEY,"first" VARCHAR(255) NOT NULL,"last" VARCHAR(255) NOT NULL)]

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

2 DBIOMigration:
${"\t"}CommandTests.profile.api.queryInsertActionExtensionMethods[CommandTests.this.UsersV2#TableElementType, [+A]Seq[A]](CommandTests.UsersV2).++=(scala.collection.immutable.Seq[com.liyaos.forklift.slick.tests.unittests.UsersRow](UsersRow(1, "Chris", "Vogt"), UsersRow(2, "Yao", "Li")))

--------------------------------------------------------------------------------
""")

val CommandTests_PreviewSeq_MySql = List(
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

1 SqlMigration:
${"\t"}[create table `users` (`id` INTEGER NOT NULL PRIMARY KEY,`first` VARCHAR(255) NOT NULL,`last` VARCHAR(255) NOT NULL)]

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

2 DBIOMigration:
${"\t"}MySQLCommandTests.profile.api.queryInsertActionExtensionMethods[MySQLCommandTests.this.UsersV2#TableElementType, [+A]Seq[A]](MySQLCommandTests.UsersV2).++=(scala.collection.immutable.Seq[com.liyaos.forklift.slick.tests.unittests.UsersRow](UsersRow(1, "Chris", "Vogt"), UsersRow(2, "Yao", "Li")))

--------------------------------------------------------------------------------
""")

val CommandTests_PreviewSeq_Derby = List(
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

1 SqlMigration:
${"\t"}[create table "users" ("id" INTEGER NOT NULL PRIMARY KEY,"first" VARCHAR(255) NOT NULL,"last" VARCHAR(255) NOT NULL)]

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

2 DBIOMigration:
${"\t"}DerbyCommandTests.profile.api.queryInsertActionExtensionMethods[DerbyCommandTests.this.UsersV2#TableElementType, [+A]Seq[A]](DerbyCommandTests.UsersV2).++=(scala.collection.immutable.Seq[com.liyaos.forklift.slick.tests.unittests.UsersRow](UsersRow(1, "Chris", "Vogt"), UsersRow(2, "Yao", "Li")))

--------------------------------------------------------------------------------
""")
}
69 changes: 3 additions & 66 deletions migrations/slick/src/test/scala/UnitTests/CommandsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,7 @@ trait CommandTests extends FlatSpec {
)))
}

val PreviewSeq: Seq[String] = List(
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

1 SqlMigration:
${"\t"}[create table "users" ("id" INTEGER NOT NULL PRIMARY KEY,"first" VARCHAR(255) NOT NULL,"last" VARCHAR(255) NOT NULL)]

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

2 DBIOMigration:
${"\t"}CommandTests.profile.api.queryInsertActionExtensionMethods[CommandTests.this.UsersV2#TableElementType, Seq](CommandTests.UsersV2).++=(scala.collection.Seq[com.liyaos.forklift.slick.tests.unittests.UsersRow](UsersRow(1, "Chris", "Vogt"), UsersRow(2, "Yao", "Li")))

--------------------------------------------------------------------------------
""")
val PreviewSeq: Seq[String] = CommandTestsPreview.CommandTests_PreviewSeq

"initOp" should "create migration tables" in {
val m = new SlickMigrationManager
Expand Down Expand Up @@ -255,28 +234,7 @@ class MySQLCommandTests extends CommandTests with MySQLConfigFile {
)))
}

override val PreviewSeq: Seq[String] = List(
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

1 SqlMigration:
${"\t"}[create table `users` (`id` INTEGER NOT NULL PRIMARY KEY,`first` VARCHAR(255) NOT NULL,`last` VARCHAR(255) NOT NULL)]

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

2 DBIOMigration:
${"\t"}MySQLCommandTests.profile.api.queryInsertActionExtensionMethods[MySQLCommandTests.this.UsersV2#TableElementType, Seq](MySQLCommandTests.UsersV2).++=(scala.collection.Seq[com.liyaos.forklift.slick.tests.unittests.UsersRow](UsersRow(1, "Chris", "Vogt"), UsersRow(2, "Yao", "Li")))

--------------------------------------------------------------------------------
""")
override val PreviewSeq: Seq[String] = CommandTestsPreview.CommandTests_PreviewSeq_MySql
}

class PostgresCommandTests extends CommandTests with PostgresConfigFile
Expand All @@ -300,26 +258,5 @@ class DerbyCommandTests extends CommandTests with DerbyConfigFile {
)))
}

override val PreviewSeq: Seq[String] = List(
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

1 SqlMigration:
${"\t"}[create table "users" ("id" INTEGER NOT NULL PRIMARY KEY,"first" VARCHAR(255) NOT NULL,"last" VARCHAR(255) NOT NULL)]

--------------------------------------------------------------------------------
""",
s"""--------------------------------------------------------------------------------
NOT YET APPLIED MIGRATIONS PREVIEW:

2 DBIOMigration:
${"\t"}DerbyCommandTests.profile.api.queryInsertActionExtensionMethods[DerbyCommandTests.this.UsersV2#TableElementType, Seq](DerbyCommandTests.UsersV2).++=(scala.collection.Seq[com.liyaos.forklift.slick.tests.unittests.UsersRow](UsersRow(1, "Chris", "Vogt"), UsersRow(2, "Yao", "Li")))

--------------------------------------------------------------------------------
""")
override val PreviewSeq: Seq[String] = CommandTestsPreview.CommandTests_PreviewSeq_Derby
}

0 comments on commit 3363571

Please sign in to comment.