-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decouple test TerminalReader from TestTty (#731)
- Loading branch information
1 parent
0898ab6
commit 7edf0ff
Showing
6 changed files
with
68 additions
and
48 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
18 changes: 18 additions & 0 deletions
18
mosaic-terminal/src/commonTest/kotlin/com/jakewharton/mosaic/terminal/TestTerminalReader.kt
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,18 @@ | ||
package com.jakewharton.mosaic.terminal | ||
|
||
import com.jakewharton.mosaic.terminal.event.Event | ||
import kotlinx.coroutines.channels.Channel | ||
import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED | ||
|
||
internal fun TestTerminalReader(): TestTerminalReader { | ||
val events = Channel<Event>(UNLIMITED) | ||
val platformEventHandler = PlatformEventHandler(events, emitDebugEvents = false) | ||
val testTty = TestTty.create(platformEventHandler) | ||
val reader = TerminalReader(testTty.tty, events, emitDebugEvents = false) | ||
return TestTerminalReader(testTty, reader) | ||
} | ||
|
||
internal class TestTerminalReader( | ||
val testTty: TestTty, | ||
val terminalReader: TerminalReader, | ||
) |
8 changes: 4 additions & 4 deletions
8
mosaic-terminal/src/commonTest/kotlin/com/jakewharton/mosaic/terminal/TestTty.kt
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