-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathmain_test.go
More file actions
43 lines (41 loc) · 868 Bytes
/
main_test.go
File metadata and controls
43 lines (41 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"os"
"sort"
"testing"
)
func TestCreateAllInitSegments(t *testing.T) {
tmpDir := t.TempDir()
err := run(tmpDir)
if err != nil {
t.Error(err)
}
files, err := os.ReadDir(tmpDir)
if err != nil {
t.Error(err)
}
fileNames := []string{}
for _, f := range files {
fileNames = append(fileNames, f.Name())
}
sort.Strings(fileNames)
fmt.Println(fileNames)
wantedFileNames := []string{
"audio_aac_init.cmfa",
"audio_ac3_init.cmfa",
"audio_ec3_init.cmfa",
"subtitles_stpp_init.cmft",
"subtitles_wvtt_init.cmft",
"video_avc_init.cmfv",
"video_hevc_init.cmfv",
}
if len(fileNames) != len(wantedFileNames) {
t.Errorf("got %d files, wanted %d", len(fileNames), len(wantedFileNames))
}
for i, f := range fileNames {
if f != wantedFileNames[i] {
t.Errorf("got %s, wanted %s", f, wantedFileNames[i])
}
}
}