-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Simple Library Server (#1952)
- Loading branch information
1 parent
2b894ad
commit e936148
Showing
11 changed files
with
152 additions
and
38 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
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
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
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
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
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
40 changes: 40 additions & 0 deletions
40
lib/scala/cli/src/test/scala/org/enso/cli/task/MappedTaskSpec.scala
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,40 @@ | ||
package org.enso.cli.task | ||
|
||
import org.scalatest.matchers.should.Matchers | ||
import org.scalatest.wordspec.AnyWordSpec | ||
|
||
import scala.util.{Success, Try} | ||
|
||
class MappedTaskSpec extends AnyWordSpec with Matchers { | ||
"TaskProgress.map" should { | ||
"run only once even with multiple listeners" in { | ||
var runs = 0 | ||
val task1 = new TaskProgressImplementation[String]() | ||
val task2 = task1.map { str => | ||
runs += 1 | ||
str + "bar" | ||
} | ||
|
||
val emptyListener = new ProgressListener[String] { | ||
override def progressUpdate(done: Long, total: Option[Long]): Unit = () | ||
override def done(result: Try[String]): Unit = () | ||
} | ||
task2.addProgressListener(emptyListener) | ||
task2.addProgressListener(emptyListener) | ||
|
||
task1.setComplete(Success("foo")) | ||
|
||
task2.addProgressListener(emptyListener) | ||
var answer: Option[Try[String]] = None | ||
task2.addProgressListener(new ProgressListener[String] { | ||
override def progressUpdate(done: Long, total: Option[Long]): Unit = () | ||
override def done(result: Try[String]): Unit = { | ||
answer = Some(result) | ||
} | ||
}) | ||
|
||
answer shouldEqual Some(Success("foobar")) | ||
runs shouldEqual 1 | ||
} | ||
} | ||
} |
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
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
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
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 |
---|---|---|
|
@@ -19,5 +19,8 @@ | |
"multer": "^1.4.2", | ||
"semver": "^7.3.5", | ||
"yargs": "^17.0.1" | ||
}, | ||
"engines": { | ||
"node": ">=14.17.2" | ||
} | ||
} |