Unbewohnte
3 years ago
8 changed files with 84 additions and 26 deletions
@ -0,0 +1,23 @@
|
||||
package id3ed |
||||
|
||||
import ( |
||||
"os" |
||||
"testing" |
||||
) |
||||
|
||||
func TestGetID3v1Tags(t *testing.T) { |
||||
testfile, err := os.Open("./testData/testmp3id3v1.mp3") |
||||
if err != nil { |
||||
t.Errorf("could not open file for testing: %s", err) |
||||
} |
||||
tags, err := GetID3v1Tags(testfile) |
||||
if err != nil { |
||||
t.Errorf("GetID3v1Tags failed: %s", err) |
||||
} |
||||
|
||||
comment := tags.GetComment() |
||||
|
||||
if comment != "Comment here " { |
||||
t.Errorf("GetID3v1Tags failed: expected %s; got %s", "Comment here ", comment) |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
package id3ed |
||||
|
||||
import ( |
||||
"fmt" |
||||
"os" |
||||
"testing" |
||||
) |
||||
|
||||
func TestGetID3v11Tags(t *testing.T) { |
||||
testfile, err := os.Open("./testData/testmp3id3v1.mp3") |
||||
if err != nil { |
||||
t.Errorf("could not open file for testing: %s", err) |
||||
} |
||||
mp3tags, err := GetID3v11Tags(testfile) |
||||
if err != nil { |
||||
t.Errorf("GetID3v1Tags failed: %s", err) |
||||
} |
||||
|
||||
if mp3tags.GetArtist() != "Artist" { |
||||
fmt.Printf("%v", mp3tags.Artist) |
||||
t.Errorf("GetID3v1Tags has failed: expected %v; got %v", "Artist", mp3tags.GetArtist()) |
||||
} |
||||
|
||||
if mp3tags.GetTrack() != 8 { |
||||
t.Errorf("GetID3v1Tags has failed: expected %v; got %v", 8, mp3tags.GetTrack()) |
||||
} |
||||
} |
@ -1,17 +0,0 @@
|
||||
package id3ed |
||||
|
||||
import ( |
||||
"os" |
||||
"testing" |
||||
) |
||||
|
||||
func TestGetID3v1Tags(t *testing.T) { |
||||
testfile, err := os.Open("./testData/id3v1.txt") |
||||
if err != nil { |
||||
t.Errorf("could not open file for testing: %s", err) |
||||
} |
||||
_, err = GetID3v1Tags(testfile) |
||||
if err != nil { |
||||
t.Errorf("GetID3v1Tags failed: %s", err) |
||||
} |
||||
} |
Loading…
Reference in new issue