Map Key to Control
This commit is contained in:
24
test/mpv/control_test.gleam
Normal file
24
test/mpv/control_test.gleam
Normal file
@@ -0,0 +1,24 @@
|
||||
import gleam/list
|
||||
import gleeunit
|
||||
|
||||
import mpv/control.{type Control}
|
||||
import mpv/key.{type Key, Char}
|
||||
|
||||
pub fn main() -> Nil {
|
||||
gleeunit.main()
|
||||
}
|
||||
|
||||
type TestCase {
|
||||
TestCase(key: Key, expected: Result(Control, Nil))
|
||||
}
|
||||
|
||||
pub fn control_from_key_test() {
|
||||
let test_cases = [
|
||||
TestCase(Char(" "), Ok(control.TogglePlayPause)),
|
||||
TestCase(Char("q"), Ok(control.Exit)),
|
||||
]
|
||||
|
||||
list.each(test_cases, fn(tc) {
|
||||
assert tc.expected == control.from_key(tc.key)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user