Add ability to listen to input
This commit is contained in:
29
test/mpv/mpv_test.gleam
Normal file
29
test/mpv/mpv_test.gleam
Normal file
@@ -0,0 +1,29 @@
|
||||
import gleam/list
|
||||
import gleeunit
|
||||
|
||||
import mpv/internal.{Char, csi, esc}
|
||||
|
||||
pub fn main() -> Nil {
|
||||
gleeunit.main()
|
||||
}
|
||||
|
||||
type TestCase {
|
||||
TestCase(input: List(String), expected: internal.Key)
|
||||
}
|
||||
|
||||
pub fn mpv_key_from_list_test() {
|
||||
let test_cases = [
|
||||
TestCase(["c"], Char("c")),
|
||||
TestCase([esc, csi, "D"], internal.Left),
|
||||
TestCase([esc, csi, "C"], internal.Right),
|
||||
TestCase([esc, csi, "A"], internal.Up),
|
||||
TestCase([esc, csi, "B"], internal.Down),
|
||||
TestCase([esc, csi], internal.Continue),
|
||||
TestCase([esc], internal.Continue),
|
||||
TestCase([], internal.Continue),
|
||||
]
|
||||
|
||||
list.each(test_cases, fn(tc) {
|
||||
assert tc.expected == internal.from_list(tc.input)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user