Skip to content

Commit

Permalink
test compat with cats-effect IOApp.Simple
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Dec 17, 2020
1 parent 8ce25b8 commit a4236c4
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/tasty/run/src-2/tastytest/TestIOApp.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package tastytest

/** test calling $init$ on IOApp parent */
object TestIOApp extends Suite("TestIOApp") {

def randOver5 = scala.util.Random.nextInt(5) + 5

object Static extends IOApp.Simple {
def run = assert(randOver5 >= 5)
}

test("static IOApp")(Static.run)

test("local IOApp") {
val Local = new IOApp.Simple {
def run = assert(randOver5 >= 5)
}
Local.run
}


}
15 changes: 15 additions & 0 deletions test/tasty/run/src-2/tastytest/TestTraitInitsBase.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package tastytest

/** test calling $init$ on TraitInitsBase.SubTrait parent */
object TestTraitInitsBase extends Suite("TestTraitInitsBase") {

object Static extends TraitInitsBase.SubTrait {}

test("static SubTrait")(assert(Static.foo === 23))

test("local SubTrait") {
val Local = new TraitInitsBase.SubTrait {}
assert(Local.foo === 23)
}

}
23 changes: 23 additions & 0 deletions test/tasty/run/src-3/tastytest/IOApp.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package tastytest

trait IOApp {
protected val foo = 23

def run(args: List[String]): Int

final def main(args: Array[String]): Unit = {
sys.exit(run(args.toList))
}

}

object IOApp {
trait Simple extends IOApp {
def run: Unit

final def run(args: List[String]): Int = {
run
0
}
}
}
8 changes: 8 additions & 0 deletions test/tasty/run/src-3/tastytest/TraitInitsBase.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package tastytest

trait TraitInitsBase {
val foo = 23
}
object TraitInitsBase {
trait SubTrait extends TraitInitsBase
}

0 comments on commit a4236c4

Please sign in to comment.