Skip to content

Commit

Permalink
add tests for pixiv.net and fix conparing strings
Browse files Browse the repository at this point in the history
  • Loading branch information
kohei-kimura committed Sep 1, 2017
1 parent 5ab2aca commit cd4e8e0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
23 changes: 14 additions & 9 deletions command/list_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package command

import (
"strings"
"testing"
)

Expand All @@ -22,9 +21,10 @@ func TestCmdList_All(t *testing.T) {
| Negative Space | https://www.negativespace.co |
| Magdeleine | http://magdeleine.co/ |
| Picography | https://picography.co |
+----------------+------------------------------+`
+----------------+------------------------------+
`

if !strings.Contains(outStream.String(), expected) {
if outStream.String() != expected {
t.Errorf("\nexpected: \n%s\n got: \n%s", expected, outStream.String())
}
}
Expand All @@ -42,9 +42,10 @@ https://picjumbo.com
https://stocksnap.io
https://www.negativespace.co
http://magdeleine.co/
https://picography.co`
https://picography.co
`

if !strings.Contains(outStream.String(), expected) {
if outStream.String() != expected {
t.Errorf("\nexpected: \n%s\n got: \n%s", expected, outStream.String())
}
}
Expand All @@ -69,9 +70,11 @@ func TestCmdList_All_Jp(t *testing.T) {
| いらすとや | http://www.irasutoya.com |
| マンガルー | https://www.mangaloo.jp |
| ぱくたそ | https://www.pakutaso.com |
+----------------+------------------------------+`
| ピクシブ | https://www.pixiv.net |
+----------------+------------------------------+
`

if !strings.Contains(outStream.String(), expected) {
if outStream.String() != expected {
t.Errorf("\nexpected: \n%s\n got: \n%s", expected, outStream.String())
}
}
Expand All @@ -92,9 +95,11 @@ http://magdeleine.co/
https://picography.co
http://www.irasutoya.com
https://www.mangaloo.jp
https://www.pakutaso.com`
https://www.pakutaso.com
https://www.pixiv.net
`

if !strings.Contains(outStream.String(), expected) {
if outStream.String() != expected {
t.Errorf("\nexpected: \n%s\n got: \n%s", expected, outStream.String())
}
}
27 changes: 17 additions & 10 deletions command/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ func TestCmdSearch_All(t *testing.T) {
| Negative Space | https://www.negativespace.co/?s=term |
| Magdeleine | http://magdeleine.co/?s=term |
| Picography | https://picography.co/?s=term |
+----------------+--------------------------------------+`
+----------------+--------------------------------------+
`

if !strings.Contains(outStream.String(), expected) {
if outStream.String() != expected {
t.Errorf("\nexpected: \n%s\n got: \n%s", expected, outStream.String())
}
}
Expand All @@ -57,9 +58,10 @@ https://picjumbo.com/?s=term
https://stocksnap.io/search/term
https://www.negativespace.co/?s=term
http://magdeleine.co/?s=term
https://picography.co/?s=term`
https://picography.co/?s=term
`

if !strings.Contains(outStream.String(), expected) {
if outStream.String() != expected {
t.Errorf("\nexpected: \n%s\n got: \n%s", expected, outStream.String())
}
}
Expand All @@ -84,9 +86,11 @@ func TestCmdSearch_All_Jp(t *testing.T) {
| いらすとや | http://www.irasutoya.com/search?q=term |
| マンガルー | https://www.mangaloo.jp/m/comas?coma_search_form%5Bkeyword%5D=term |
| ぱくたそ | https://www.pakutaso.com/search.html?search=term |
+----------------+--------------------------------------------------------------------+`
| ピクシブ | https://www.pixiv.net/search.php?word=term |
+----------------+--------------------------------------------------------------------+
`

if !strings.Contains(outStream.String(), expected) {
if outStream.String() != expected {
t.Errorf("\nexpected: \n%s\n got: \n%s", expected, outStream.String())
}
}
Expand All @@ -107,9 +111,11 @@ http://magdeleine.co/?s=term
https://picography.co/?s=term
http://www.irasutoya.com/search?q=term
https://www.mangaloo.jp/m/comas?coma_search_form%5Bkeyword%5D=term
https://www.pakutaso.com/search.html?search=term`
https://www.pakutaso.com/search.html?search=term
https://www.pixiv.net/search.php?word=term
`

if !strings.Contains(outStream.String(), expected) {
if outStream.String() != expected {
t.Errorf("\nexpected: \n%s\n got: \n%s", expected, outStream.String())
}
}
Expand Down Expand Up @@ -141,9 +147,10 @@ func TestCmdSearch_WithSiteName(t *testing.T) {
| NAME | URL |
+--------------+----------------------------------+
| StockSnap.io | https://stocksnap.io/search/term |
+--------------+----------------------------------+`
+--------------+----------------------------------+
`

if !strings.Contains(outStream.String(), expected) {
if outStream.String() != expected {
t.Errorf("\nexpected: \n%s\n got: \n%s", expected, outStream.String())
}
}

0 comments on commit cd4e8e0

Please sign in to comment.