mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge branch 'master' into top-exchanges
This commit is contained in:
commit
e407dc8a4a
@ -210,6 +210,13 @@
|
|||||||
"name": "Amr Tamimi",
|
"name": "Amr Tamimi",
|
||||||
"avatar_url": "https://avatars3.githubusercontent.com/u/21756?v=4",
|
"avatar_url": "https://avatars3.githubusercontent.com/u/21756?v=4",
|
||||||
"profile": "https://tamimi.se",
|
"profile": "https://tamimi.se",
|
||||||
|
"contributions": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "jdsingh",
|
||||||
|
"name": "Jagdeep Singh",
|
||||||
|
"avatar_url": "https://avatars3.githubusercontent.com/u/3717137?v=4",
|
||||||
|
"profile": "https://jagdeep.me",
|
||||||
"contributions": [
|
"contributions": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ Thanks goes to these wonderful people:
|
|||||||
| [<img src="https://avatars2.githubusercontent.com/u/9014288?v=4" width="48px;"/><br /><sub><b>baustinanki</b></sub>](https://github.com/baustinanki)<br /> | [<img src="https://avatars0.githubusercontent.com/u/371475?v=4" width="48px;"/><br /><sub><b>lucus lee</b></sub>](https://github.com/lixin9311)<br /> | [<img src="https://avatars1.githubusercontent.com/u/7537841?v=4" width="48px;"/><br /><sub><b>Mike Lloyd</b></sub>](https://github.com/mxplusb)<br /> | [<img src="https://avatars3.githubusercontent.com/u/10998?v=4" width="48px;"/><br /><sub><b>Sergio Rubio</b></sub>](http://rubiojr.rbel.co)<br /> | [<img src="https://avatars3.githubusercontent.com/u/17374492?v=4" width="48px;"/><br /><sub><b>Farhad Farahi</b></sub>](https://github.com/FarhadF)<br /> | [<img src="https://avatars1.githubusercontent.com/u/634604?v=4" width="48px;"/><br /><sub><b>Lasantha Kularatne</b></sub>](http://lasantha.blogspot.com/)<br /> | [<img src="https://avatars1.githubusercontent.com/u/823331?v=4" width="48px;"/><br /><sub><b>Mark Old</b></sub>](https://github.com/dlom)<br /> |
|
| [<img src="https://avatars2.githubusercontent.com/u/9014288?v=4" width="48px;"/><br /><sub><b>baustinanki</b></sub>](https://github.com/baustinanki)<br /> | [<img src="https://avatars0.githubusercontent.com/u/371475?v=4" width="48px;"/><br /><sub><b>lucus lee</b></sub>](https://github.com/lixin9311)<br /> | [<img src="https://avatars1.githubusercontent.com/u/7537841?v=4" width="48px;"/><br /><sub><b>Mike Lloyd</b></sub>](https://github.com/mxplusb)<br /> | [<img src="https://avatars3.githubusercontent.com/u/10998?v=4" width="48px;"/><br /><sub><b>Sergio Rubio</b></sub>](http://rubiojr.rbel.co)<br /> | [<img src="https://avatars3.githubusercontent.com/u/17374492?v=4" width="48px;"/><br /><sub><b>Farhad Farahi</b></sub>](https://github.com/FarhadF)<br /> | [<img src="https://avatars1.githubusercontent.com/u/634604?v=4" width="48px;"/><br /><sub><b>Lasantha Kularatne</b></sub>](http://lasantha.blogspot.com/)<br /> | [<img src="https://avatars1.githubusercontent.com/u/823331?v=4" width="48px;"/><br /><sub><b>Mark Old</b></sub>](https://github.com/dlom)<br /> |
|
||||||
| [<img src="https://avatars0.githubusercontent.com/u/5546718?v=4" width="48px;"/><br /><sub><b>flw</b></sub>](http://flw.tools/)<br /> | [<img src="https://avatars0.githubusercontent.com/u/6024927?v=4" width="48px;"/><br /><sub><b>David Barda</b></sub>](https://github.com/davebarda)<br /> | [<img src="https://avatars2.githubusercontent.com/u/4261980?v=4" width="48px;"/><br /><sub><b>Geoff Lee</b></sub>](https://github.com/matrinox)<br /> | [<img src="https://avatars3.githubusercontent.com/u/1022918?v=4" width="48px;"/><br /><sub><b>George Opritescu</b></sub>](http://international.github.io)<br /> | [<img src="https://avatars3.githubusercontent.com/u/497310?v=4" width="48px;"/><br /><sub><b>Grazfather</b></sub>](https://twitter.com/Grazfather)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1691120?v=4" width="48px;"/><br /><sub><b>Michael Cordell</b></sub>](http://www.mikecordell.com/)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1215497?v=4" width="48px;"/><br /><sub><b>Patrick José Pereira</b></sub>](http://patrick.ibexcps.com)<br /> |
|
| [<img src="https://avatars0.githubusercontent.com/u/5546718?v=4" width="48px;"/><br /><sub><b>flw</b></sub>](http://flw.tools/)<br /> | [<img src="https://avatars0.githubusercontent.com/u/6024927?v=4" width="48px;"/><br /><sub><b>David Barda</b></sub>](https://github.com/davebarda)<br /> | [<img src="https://avatars2.githubusercontent.com/u/4261980?v=4" width="48px;"/><br /><sub><b>Geoff Lee</b></sub>](https://github.com/matrinox)<br /> | [<img src="https://avatars3.githubusercontent.com/u/1022918?v=4" width="48px;"/><br /><sub><b>George Opritescu</b></sub>](http://international.github.io)<br /> | [<img src="https://avatars3.githubusercontent.com/u/497310?v=4" width="48px;"/><br /><sub><b>Grazfather</b></sub>](https://twitter.com/Grazfather)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1691120?v=4" width="48px;"/><br /><sub><b>Michael Cordell</b></sub>](http://www.mikecordell.com/)<br /> | [<img src="https://avatars2.githubusercontent.com/u/1215497?v=4" width="48px;"/><br /><sub><b>Patrick José Pereira</b></sub>](http://patrick.ibexcps.com)<br /> |
|
||||||
| [<img src="https://avatars2.githubusercontent.com/u/1483092?v=4" width="48px;"/><br /><sub><b>sherod taylor</b></sub>](https://github.com/sherodtaylor)<br /> | [<img src="https://avatars2.githubusercontent.com/u/3062663?v=4" width="48px;"/><br /><sub><b>Andrew Scott</b></sub>](http://cogentia.io)<br /> | [<img src="https://avatars2.githubusercontent.com/u/3252403?v=4" width="48px;"/><br /><sub><b>Anand Sudhir Prayaga</b></sub>](https://github.com/anandsudhir)<br /> | [<img src="https://avatars1.githubusercontent.com/u/12018440?v=4" width="48px;"/><br /><sub><b>Lassi Piironen</b></sub>](https://github.com/lsipii)<br /> | [<img src="https://avatars0.githubusercontent.com/u/14799210?v=4" width="48px;"/><br /><sub><b>BlackWebWolf</b></sub>](https://github.com/BlackWebWolf)<br /> | [<img src="https://avatars0.githubusercontent.com/u/1894885?v=4" width="48px;"/><br /><sub><b>andrewzolotukhin</b></sub>](https://github.com/andrewzolotukhin)<br /> | [<img src="https://avatars1.githubusercontent.com/u/8568280?v=4" width="48px;"/><br /><sub><b>Leon Stigter</b></sub>](https://retgits.github.io)<br /> |
|
| [<img src="https://avatars2.githubusercontent.com/u/1483092?v=4" width="48px;"/><br /><sub><b>sherod taylor</b></sub>](https://github.com/sherodtaylor)<br /> | [<img src="https://avatars2.githubusercontent.com/u/3062663?v=4" width="48px;"/><br /><sub><b>Andrew Scott</b></sub>](http://cogentia.io)<br /> | [<img src="https://avatars2.githubusercontent.com/u/3252403?v=4" width="48px;"/><br /><sub><b>Anand Sudhir Prayaga</b></sub>](https://github.com/anandsudhir)<br /> | [<img src="https://avatars1.githubusercontent.com/u/12018440?v=4" width="48px;"/><br /><sub><b>Lassi Piironen</b></sub>](https://github.com/lsipii)<br /> | [<img src="https://avatars0.githubusercontent.com/u/14799210?v=4" width="48px;"/><br /><sub><b>BlackWebWolf</b></sub>](https://github.com/BlackWebWolf)<br /> | [<img src="https://avatars0.githubusercontent.com/u/1894885?v=4" width="48px;"/><br /><sub><b>andrewzolotukhin</b></sub>](https://github.com/andrewzolotukhin)<br /> | [<img src="https://avatars1.githubusercontent.com/u/8568280?v=4" width="48px;"/><br /><sub><b>Leon Stigter</b></sub>](https://retgits.github.io)<br /> |
|
||||||
| [<img src="https://avatars3.githubusercontent.com/u/21756?v=4" width="48px;"/><br /><sub><b>Amr Tamimi</b></sub>](https://tamimi.se)<br /> |
|
| [<img src="https://avatars3.githubusercontent.com/u/21756?v=4" width="48px;"/><br /><sub><b>Amr Tamimi</b></sub>](https://tamimi.se)<br /> | [<img src="https://avatars3.githubusercontent.com/u/3717137?v=4" width="48px;"/><br /><sub><b>Jagdeep Singh</b></sub>](https://jagdeep.me)<br /> |
|
||||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||||
|
|
||||||
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
|
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
|
||||||
|
@ -133,22 +133,6 @@ func LoadConfigFile(filePath string) *config.Config {
|
|||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReadConfigFile(fileName string) (string, error) {
|
|
||||||
configDir, err := ConfigDir()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
filePath := fmt.Sprintf("%s/%s", configDir, fileName)
|
|
||||||
|
|
||||||
fileData, err := wtf.ReadFileBytes(filePath)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
return string(fileData), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
const simpleConfig = `wtf:
|
const simpleConfig = `wtf:
|
||||||
colors:
|
colors:
|
||||||
border:
|
border:
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gdamore/tcell"
|
"github.com/gdamore/tcell"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Colors = map[string]tcell.Color{
|
var colors = map[string]tcell.Color{
|
||||||
"aliceblue": tcell.ColorAliceBlue,
|
"aliceblue": tcell.ColorAliceBlue,
|
||||||
"antiquewhite": tcell.ColorAntiqueWhite,
|
"antiquewhite": tcell.ColorAntiqueWhite,
|
||||||
"aqua": tcell.ColorAqua,
|
"aqua": tcell.ColorAqua,
|
||||||
@ -148,8 +148,8 @@ var Colors = map[string]tcell.Color{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ColorFor(label string) tcell.Color {
|
func ColorFor(label string) tcell.Color {
|
||||||
if _, ok := Colors[label]; ok {
|
if _, ok := colors[label]; ok {
|
||||||
return Colors[label]
|
return colors[label]
|
||||||
} else {
|
} else {
|
||||||
return tcell.ColorGreen
|
return tcell.ColorGreen
|
||||||
}
|
}
|
||||||
|
35
wtf/datetime.go
Normal file
35
wtf/datetime.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package wtf
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DateFormat defines the format we expect to receive dates from BambooHR in
|
||||||
|
const DateFormat = "2006-01-02"
|
||||||
|
const TimeFormat = "15:04"
|
||||||
|
|
||||||
|
func IsToday(date time.Time) bool {
|
||||||
|
now := Now()
|
||||||
|
|
||||||
|
return (date.Year() == now.Year()) &&
|
||||||
|
(date.Month() == now.Month()) &&
|
||||||
|
(date.Day() == now.Day())
|
||||||
|
}
|
||||||
|
|
||||||
|
func Now() time.Time {
|
||||||
|
return time.Now().Local()
|
||||||
|
}
|
||||||
|
|
||||||
|
func PrettyDate(dateStr string) string {
|
||||||
|
newTime, _ := time.Parse(DateFormat, dateStr)
|
||||||
|
return fmt.Sprint(newTime.Format("Jan 2, 2006"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func Tomorrow() time.Time {
|
||||||
|
return Now().AddDate(0, 0, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func UnixTime(unix int64) time.Time {
|
||||||
|
return time.Unix(unix, 0)
|
||||||
|
}
|
36
wtf/utils.go
36
wtf/utils.go
@ -6,7 +6,6 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/rivo/tview"
|
"github.com/rivo/tview"
|
||||||
)
|
)
|
||||||
@ -18,6 +17,10 @@ const FriendlyDateTimeFormat = "Mon, Jan 2, 15:04"
|
|||||||
const TimestampFormat = "2006-01-02T15:04:05-0700"
|
const TimestampFormat = "2006-01-02T15:04:05-0700"
|
||||||
|
|
||||||
func CenterText(str string, width int) string {
|
func CenterText(str string, width int) string {
|
||||||
|
if width < 0 {
|
||||||
|
width = 0
|
||||||
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("%[1]*s", -width, fmt.Sprintf("%[1]*s", (width+len(str))/2, str))
|
return fmt.Sprintf("%[1]*s", -width, fmt.Sprintf("%[1]*s", (width+len(str))/2, str))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,34 +154,3 @@ func ToStrs(slice []interface{}) []string {
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Date/Time -------------------- */
|
|
||||||
|
|
||||||
// DateFormat defines the format we expect to receive dates from BambooHR in
|
|
||||||
const DateFormat = "2006-01-02"
|
|
||||||
const TimeFormat = "15:04"
|
|
||||||
|
|
||||||
func IsToday(date time.Time) bool {
|
|
||||||
now := Now()
|
|
||||||
|
|
||||||
return (date.Year() == now.Year()) &&
|
|
||||||
(date.Month() == now.Month()) &&
|
|
||||||
(date.Day() == now.Day())
|
|
||||||
}
|
|
||||||
|
|
||||||
func Now() time.Time {
|
|
||||||
return time.Now().Local()
|
|
||||||
}
|
|
||||||
|
|
||||||
func PrettyDate(dateStr string) string {
|
|
||||||
newTime, _ := time.Parse(DateFormat, dateStr)
|
|
||||||
return fmt.Sprint(newTime.Format("Jan 2, 2006"))
|
|
||||||
}
|
|
||||||
|
|
||||||
func Tomorrow() time.Time {
|
|
||||||
return Now().AddDate(0, 0, 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
func UnixTime(unix int64) time.Time {
|
|
||||||
return time.Unix(unix, 0)
|
|
||||||
}
|
|
||||||
|
14
wtf_tests/colors_test.go
Normal file
14
wtf_tests/colors_test.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package wtf_tests
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/gdamore/tcell"
|
||||||
|
. "github.com/senorprogrammer/wtf/wtf"
|
||||||
|
. "github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestColorFor(t *testing.T) {
|
||||||
|
Equal(t, tcell.ColorRed, ColorFor("red"))
|
||||||
|
Equal(t, tcell.ColorGreen, ColorFor("cat"))
|
||||||
|
}
|
21
wtf_tests/datetime_test.go
Normal file
21
wtf_tests/datetime_test.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package wtf_tests
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
. "github.com/senorprogrammer/wtf/wtf"
|
||||||
|
. "github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestIsToday(t *testing.T) {
|
||||||
|
Equal(t, true, IsToday(time.Now().Local()))
|
||||||
|
Equal(t, false, IsToday(time.Now().AddDate(0, 0, -1)))
|
||||||
|
Equal(t, false, IsToday(time.Now().AddDate(0, 0, +1)))
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------- PrettyDate() -------------------- */
|
||||||
|
|
||||||
|
func TestPrettyDate(t *testing.T) {
|
||||||
|
Equal(t, "Oct 21, 1999", PrettyDate("1999-10-21"))
|
||||||
|
}
|
@ -3,62 +3,60 @@ package wtf_tests
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/go-test/deep"
|
|
||||||
. "github.com/senorprogrammer/wtf/wtf"
|
. "github.com/senorprogrammer/wtf/wtf"
|
||||||
|
. "github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/* -------------------- CenterText() -------------------- */
|
||||||
|
|
||||||
|
func TestCenterText(t *testing.T) {
|
||||||
|
Equal(t, "cat", CenterText("cat", -9))
|
||||||
|
Equal(t, "cat", CenterText("cat", 0))
|
||||||
|
Equal(t, " cat ", CenterText("cat", 9))
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------- FindMatch() -------------------- */
|
||||||
|
|
||||||
|
func TestFindMatch(t *testing.T) {
|
||||||
|
var result [][]string
|
||||||
|
|
||||||
|
expected := [][]string([][]string{[]string{"SSID: 7E5B5C", "7E5B5C"}})
|
||||||
|
result = FindMatch(`s*SSID: (.+)s*`, "SSID: 7E5B5C")
|
||||||
|
Equal(t, expected, result)
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------- Exclude() -------------------- */
|
/* -------------------- Exclude() -------------------- */
|
||||||
|
|
||||||
func TestExcludeWhenTrue(t *testing.T) {
|
func TestExcludeWhenTrue(t *testing.T) {
|
||||||
if Exclude([]string{"cat", "dog", "rat"}, "bat") != true {
|
Equal(t, true, Exclude([]string{"cat", "dog", "rat"}, "bat"))
|
||||||
t.Fatalf("Expected true but got false")
|
Equal(t, false, Exclude([]string{"cat", "dog", "rat"}, "dog"))
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestExcludeWhenFalse(t *testing.T) {
|
|
||||||
if Exclude([]string{"cat", "dog", "rat"}, "dog") != false {
|
|
||||||
t.Fatalf("Expected false but got true")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- NameFromEmail() -------------------- */
|
/* -------------------- NameFromEmail() -------------------- */
|
||||||
|
|
||||||
func TestNameFromEmailWhenEmpty(t *testing.T) {
|
func TestNameFromEmail(t *testing.T) {
|
||||||
expected := ""
|
Equal(t, "", NameFromEmail(""))
|
||||||
actual := NameFromEmail("")
|
Equal(t, "Chris Cummer", NameFromEmail("chris.cummer@me.com"))
|
||||||
|
|
||||||
if expected != actual {
|
|
||||||
t.Fatalf("Expected %s but got %s", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestNameFromEmailWithEmail(t *testing.T) {
|
|
||||||
expected := "Chris Cummer"
|
|
||||||
actual := NameFromEmail("chris.cummer@me.com")
|
|
||||||
|
|
||||||
if expected != actual {
|
|
||||||
t.Fatalf("Expected %s but got %s", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- NamesFromEmails() -------------------- */
|
/* -------------------- NamesFromEmails() -------------------- */
|
||||||
|
|
||||||
func TestNamesFromEmailsWhenEmpty(t *testing.T) {
|
func TestNamesFromEmails(t *testing.T) {
|
||||||
expected := []string{}
|
var result []string
|
||||||
actual := NamesFromEmails([]string{})
|
|
||||||
|
|
||||||
if diff := deep.Equal(expected, actual); diff != nil {
|
result = NamesFromEmails([]string{})
|
||||||
t.Fatalf("Expected %s but got %s", expected, actual)
|
Equal(t, []string{}, result)
|
||||||
}
|
|
||||||
|
result = NamesFromEmails([]string{"chris.cummer@me.com", "chriscummer@me.com"})
|
||||||
|
Equal(t, []string{"Chris Cummer", "Chriscummer"}, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNamesFromEmailsWithEmails(t *testing.T) {
|
/* -------------------- PadRow() -------------------- */
|
||||||
expected := []string{"Chris Cummer", "Chriscummer"}
|
|
||||||
actual := NamesFromEmails([]string{"chris.cummer@me.com", "chriscummer@me.com"})
|
|
||||||
|
|
||||||
if diff := deep.Equal(expected, actual); diff != nil {
|
func TestPadRow(t *testing.T) {
|
||||||
t.Fatalf("Expected %s but got %s", expected, actual)
|
Equal(t, "", PadRow(0, 0))
|
||||||
}
|
Equal(t, "", PadRow(5, 2))
|
||||||
|
Equal(t, " ", PadRow(1, 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- ToInts() -------------------- */
|
/* -------------------- ToInts() -------------------- */
|
||||||
@ -71,11 +69,7 @@ func TestToInts(t *testing.T) {
|
|||||||
source[idx] = val
|
source[idx] = val
|
||||||
}
|
}
|
||||||
|
|
||||||
actual := ToInts(source)
|
Equal(t, expected, ToInts(source))
|
||||||
|
|
||||||
if diff := deep.Equal(expected, actual); diff != nil {
|
|
||||||
t.Fatalf("Expected %v but got %v", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- ToStrs() -------------------- */
|
/* -------------------- ToStrs() -------------------- */
|
||||||
@ -88,20 +82,5 @@ func TestToStrs(t *testing.T) {
|
|||||||
source[idx] = val
|
source[idx] = val
|
||||||
}
|
}
|
||||||
|
|
||||||
actual := ToStrs(source)
|
Equal(t, expected, ToStrs(source))
|
||||||
|
|
||||||
if diff := deep.Equal(expected, actual); diff != nil {
|
|
||||||
t.Fatalf("Expected %s but got %s", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- PrettyDate() -------------------- */
|
|
||||||
|
|
||||||
func TestPrettyDate(t *testing.T) {
|
|
||||||
expected := "Oct 21, 1999"
|
|
||||||
actual := PrettyDate("1999-10-21")
|
|
||||||
|
|
||||||
if expected != actual {
|
|
||||||
t.Fatalf("Expected %s but got %s", expected, actual)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user