tests/playlist, tests/subtitle: comments: specs only
This commit is contained in:
1 parent
e0ab895027
commit
928ac9b39f
6 files changed
+10
-44
No files matched your search
@@ -1,7 +1,5 @@
|
||||
-- playlist/pls tests: Python-written PLS files (tools/fixtures/playlist.py) decode to their entries; keys in any case
|
||||
-- and order, gaps in the numbering, comments, NumberOfEntries mismatches, Windows-1252, relative locations; the
|
||||
-- writer round-trips (titles, unknown lengths, line breaks); the api; the fuzz pass. (The playlist-luau PLS cases run
|
||||
-- in tests/playlist/m3u.luau.) Fixtures: tools/fixtures/playlist.py.
|
||||
-- playlist/pls tests: Python-written PLS files decode to their entries; writer round trips.
|
||||
-- Fixtures: tools/fixtures/playlist.py.
|
||||
local T = require("@tests/T")
|
||||
local Pls = require("@rosetta/playlist/pls")
|
||||
local Bytes = require("@rosetta/core/Bytes")
|
||||
@@ -44,13 +42,11 @@ do
|
||||
t:eq(cp.entries[1].title, "Bj\u{f6}rk", "Windows-1252 text")
|
||||
local loc = decode("[playlist]\nFile1=C:\\Music\\a.mp3\nNumberOfEntries=1\n")
|
||||
t:check(not loc.entries[1].playable and loc.entries[1].reason == "local path", "local path")
|
||||
-- the writer
|
||||
local out = buffer.tostring(Pls.encode({ { url = "http://a/1.mp3", title = "One\nTwo", duration = 61.6 }, { url = "http://a/2.mp3" }, { url = 5 } } :: any) :: buffer)
|
||||
t:eq(out, "[playlist]\nFile1=http://a/1.mp3\nTitle1=One Two\nLength1=62\nFile2=http://a/2.mp3\nLength2=-1\nNumberOfEntries=2\nVersion=2\n", "writer output")
|
||||
t:check(select(2, Pls.encode(5 :: any)) ~= nil, "encode a number")
|
||||
t:eq(Pls.sniff(Bytes.reader(buffer.fromstring("\239\187\191 [playlist]\r\nFile1=a"))), 0.95, "sniff")
|
||||
t:eq(Pls.sniff(Bytes.reader(buffer.fromstring("#EXTM3U"))), 0, "sniff m3u")
|
||||
-- the api
|
||||
t:eq(F.detect(Cases[1].pls), "pls", "F.detect")
|
||||
local a = F.playlist.load(Cases[1].pls)
|
||||
t:check(a and a.format == "pls", "F.playlist.load")
|
||||
|
||||
Reference in new issue
Block a user