Restructure mpv/internal package

This commit is contained in:
Alexander Heldt
2025-11-16 16:04:06 +01:00
parent ebdba09bc2
commit 702313eac2
5 changed files with 51 additions and 48 deletions

29
test/mpv/key_test.gleam Normal file
View File

@@ -0,0 +1,29 @@
import gleam/list
import gleeunit
import mpv/key.{type Key, Char, csi, esc}
pub fn main() -> Nil {
gleeunit.main()
}
type TestCase {
TestCase(input: List(String), expected: Key)
}
pub fn key_from_list_test() {
let test_cases = [
TestCase(["c"], Char("c")),
TestCase([esc, csi, "D"], key.Left),
TestCase([esc, csi, "C"], key.Right),
TestCase([esc, csi, "A"], key.Up),
TestCase([esc, csi, "B"], key.Down),
TestCase([esc, csi], key.Continue),
TestCase([esc], key.Continue),
TestCase([], key.Continue),
]
list.each(test_cases, fn(tc) {
assert tc.expected == key.from_list(tc.input)
})
}

View File

@@ -1,29 +0,0 @@
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)
})
}