Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.

Commit 1d4a0de

Browse files
author
Nyah Check
committed
Update main package and tests
1 parent b82baa7 commit 1d4a0de

File tree

2 files changed

+7
-55
lines changed

2 files changed

+7
-55
lines changed

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ func main() {
8181
//Get Video Id
8282
if ids == "" {
8383
url := os.Args[1]
84-
startProcessing([]string{url})
84+
beginDownload([]string{url})
8585
} else {
86-
startProcessing(strings.Split(ids, ","))
86+
beginDownload(strings.Split(ids, ","))
8787
}
8888
}
8989

90-
func startProcessing(urls []string) {
90+
func beginDownload(urls []string) {
9191
ch := downloadStreams(defaultMaxDownloads, format, path, bitrate, urls)
9292
for err := range ch {
9393
//Extract Video data and decode

main_test.go

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,13 @@ package main
22

33
import (
44
"fmt"
5-
"reflect"
65
"testing"
76
)
87

9-
//Version combines the OS and architecture
10-
type Version struct {
11-
OS string
12-
Arch string
8+
func TestDownloader(t *testing.T) {
9+
urls := []string{"https://www.youtube.com/watch?v=HpNluHOAJFA&list=RDHpNluHOAJFA"}
1310

14-
Default bool // indicates whether Version is a build target
15-
}
16-
17-
func (vs *Version) String() string {
18-
return fmt.Sprintf("%s/%s", vs.OS, vs.Arch)
19-
}
20-
21-
var (
22-
Versions_1_0 = []Version{
23-
{"darwin", "amd64", true},
24-
{"linux", "amd64", true},
25-
{"windows", "amd64", true},
26-
}
27-
28-
Versions_1_1 = append(Versions_1_0)
29-
Versions_1_2 = append(Versions_1_1)
30-
Versions_1_3 = append(Versions_1_2)
31-
)
32-
33-
func SupportedVersions(v string) []Version {
34-
return []Version{
35-
{"darwin", "amd64", true},
36-
{"linux", "amd64", true},
37-
}
38-
}
39-
40-
func TestGoVersions(t *testing.T) {
41-
var versions []Version
42-
43-
versions = SupportedVersions("go1.10")
44-
if !reflect.DeepEqual(versions, Versions_1_0) {
45-
t.Fatalf("bad: %#v", versions)
46-
}
47-
48-
versions = SupportedVersions("go1.11")
49-
if !reflect.DeepEqual(versions, Versions_1_1) {
50-
t.Fatalf("bad: %#v", versions)
51-
}
52-
53-
versions = SupportedVersions("go1.12")
54-
if !reflect.DeepEqual(versions, Versions_1_2) {
55-
t.Fatalf("bad: %#v", versions)
56-
}
57-
58-
versions = SupportedVersions("go1.13")
59-
if !reflect.DeepEqual(versions, Versions_1_3) {
60-
t.Fatalf("bad: %#v", versions)
11+
if err := beginDownload(urls); err != nil {
12+
fmt.Fprintln("Error occured testing downloader", err)
6113
}
6214
}

0 commit comments

Comments
 (0)