Skip to content

Commit d4983cc

Browse files
committed
Undelete scripted tests
1 parent c32ac73 commit d4983cc

19 files changed

Lines changed: 118 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version := "0.1"
2+
3+
ThisBuild / envFileName := "dotenv"
4+
5+
TaskKey[Unit]("check") := {
6+
val lastLog: File = BuiltinCommands.lastLogFile(state.value).get
7+
val last: String = IO.read(lastLog)
8+
val contains = last.contains("Configured .env environment")
9+
if (!contains)
10+
sys.error("expected log message")
11+
if (sys.env.get("LINE_ONE").isEmpty || sys.env.get("LINE_TWO").isEmpty)
12+
sys.error("environment variables not set")
13+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
LINE_ONE=abc
2+
LINE_TWO=xyz
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sys.props.get("plugin.version") match {
2+
case Some(x) => addSbtPlugin("nl.gn0s1s" %% "sbt-dotenv" % x)
3+
case _ =>
4+
sys.error(
5+
"""|The system property 'plugin.version' is not defined.
6+
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
7+
)
8+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
> check
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
LINE_ONE=abc
2+
LINE_TWO=xyz
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version := "0.1"
2+
3+
TaskKey[Unit]("check") := {
4+
val lastLog: File = BuiltinCommands.lastLogFile(state.value).get
5+
val last: String = IO.read(lastLog)
6+
val contains = last.contains("Configured .env environment")
7+
if (!contains)
8+
sys.error("expected log message")
9+
if (sys.env.get("LINE_ONE").isEmpty || sys.env.get("LINE_TWO").isEmpty)
10+
sys.error("environment variables not set")
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sys.props.get("plugin.version") match {
2+
case Some(x) => addSbtPlugin("nl.gn0s1s" %% "sbt-dotenv" % x)
3+
case _ =>
4+
sys.error(
5+
"""|The system property 'plugin.version' is not defined.
6+
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
7+
)
8+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
> check
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version := "0.1"
2+
3+
TaskKey[Unit]("check") := {
4+
val lastLog: File = BuiltinCommands.lastLogFile(state.value).get
5+
val last: String = IO.read(lastLog)
6+
val contains = last.contains(
7+
".env file not found (fileName=.env), no .env environment configured."
8+
)
9+
if (!contains)
10+
sys.error("expected log message")
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
sys.props.get("plugin.version") match {
2+
case Some(x) => addSbtPlugin("nl.gn0s1s" %% "sbt-dotenv" % x)
3+
case _ =>
4+
sys.error(
5+
"""|The system property 'plugin.version' is not defined.
6+
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
7+
)
8+
}

0 commit comments

Comments
 (0)