-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test compat with cats-effect IOApp.Simple
- Loading branch information
1 parent
8ce25b8
commit a4236c4
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |