]> git.lizzy.rs Git - go-anidb.git/blobdiff - misc/episodelist_test.go
misc: Allow adding/removing arbitrary episodes to an EpisodeList
[go-anidb.git] / misc / episodelist_test.go
index a7567469e756badf55af9216e392ec81c8d59ca4..470e5d607b7325d8b89a5916baa9ed1c08e0e566 100644 (file)
@@ -11,3 +11,28 @@ func ExampleEpisodeList_Simplify() {
 
        // Output: 01-03,05,10-15,S1,S3-,C07-C10
 }
+
+func ExampleEpisodeList_Add() {
+       a := misc.ParseEpisodeList("1-3")
+       a.Add(misc.ParseEpisode("3.1"))
+       fmt.Println(a)
+
+       a.Add(misc.ParseEpisode("4.0"))
+       fmt.Println(a)
+
+       a.Add(misc.ParseEpisode("4"))
+       fmt.Println(a)
+
+       a.Add(misc.ParseEpisode("5.1"))
+       fmt.Println(a)
+
+       a.Add(misc.ParseEpisode("6"))
+       fmt.Println(a)
+
+       // Output:
+       // 1-3
+       // 1-4.0
+       // 1-4
+       // 1-4,5.1
+       // 1-4,5.1,6
+}