Skip to content

Commit

Permalink
Add tests for wtf/colors.go exported functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Cummer committed Aug 1, 2018
1 parent 22c9da9 commit f592e09
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ before_install:
- export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/senorprogrammer/wtf
- cd $HOME/gopath/src/github.com/senorprogrammer/wtf

script: go get ./... && go get github.com/go-test/deep && go test -v github.com/senorprogrammer/wtf/wtftests/...
script: go get ./... && go get github.com/go-test/deep && go test -v github.com/senorprogrammer/wtf/wtf_tests/...
40 changes: 40 additions & 0 deletions weather.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Weather report: Vancouver, Canada

 \ / Partly cloudy
 _ /"".-.  24-25 °C
 \_( ).  ← 24 km/h
 /(___(__)  48 km
0.1 mm
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Tue 31 Jul ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│  _`/"".-.  Patchy rain po…│  \ / Partly cloudy │  \ /  Sunny │  \ /  Clear │
│  ,\_( ).  19-20 °C │  _ /"".-.  20 °C │  .-.  21-22 °C │  .-.  20-21 °C │
│  /(___(__)  ↖ 15-24 km/h │  \_( ).  ↑ 14-21 km/h │  ― ( ) ―  ↖ 10-17 km/h │  ― ( ) ―  ← 9-21 km/h │
│  ‘ ‘ ‘ ‘  16 km │  /(___(__)  16 km │  `-’  16 km │  `-’  16 km │
│  ‘ ‘ ‘ ‘  0.1 mm | 82% │ 0.1 mm | 54% │  / \  0.0 mm | 0% │  / \  0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Wed 01 Aug ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│  \ / Partly cloudy │  \ / Partly cloudy │  \ / Partly cloudy │  \ / Partly cloudy │
│  _ /"".-.  18 °C │  _ /"".-.  19 °C │  _ /"".-.  19-20 °C │  _ /"".-.  19-20 °C │
│  \_( ).  ↖ 20-23 km/h │  \_( ).  ↖ 18-23 km/h │  \_( ).  ↖ 12-21 km/h │  \_( ).  ← 11-24 km/h │
│  /(___(__)  16 km │  /(___(__)  16 km │  /(___(__)  15 km │  /(___(__)  15 km │
│ 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
┌─────────────┐
┌──────────────────────────────┬───────────────────────┤ Thu 02 Aug ├───────────────────────┬──────────────────────────────┐
│ Morning │ Noon └──────┬──────┘ Evening │ Night │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│  \ / Partly cloudy │  \ / Partly cloudy │ Cloudy │  \ / Partly cloudy │
│  _ /"".-.  16 °C │  _ /"".-.  16-17 °C │  .--.  17-18 °C │  _ /"".-.  17-18 °C │
│  \_( ).  ↖ 20-25 km/h │  \_( ).  ↖ 17-29 km/h │  .-( ).  ↖ 12-26 km/h │  \_( ).  ← 11-21 km/h │
│  /(___(__)  15 km │  /(___(__)  14 km │  (___.__)__)  13 km │  /(___(__)  11 km │
│ 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │ 0.0 mm | 0% │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘

New feature: multilingual location names wttr.in/станция+Восток (in UTF-8) and location search wttr.in/~Kilimanjaro (just add ~ before)
Follow @igor_chubin for wttr.in updates
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bargraphtests
package bargraph_test

import (
"testing"
Expand Down
14 changes: 14 additions & 0 deletions wtf_tests/colors_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package wtf_tests

import (
"testing"

. "github.com/senorprogrammer/wtf/wtf"
. "github.com/stretchr/testify/assert"
)

func TestASCIItoTviewColors(t *testing.T) {
Equal(t, "", ASCIItoTviewColors(""))
Equal(t, "cat", ASCIItoTviewColors("cat"))
Equal(t, "[38;5;226mcat/[-]", ASCIItoTviewColors("[38;5;226mcat/"))
}
2 changes: 1 addition & 1 deletion wtftests/datetime_test.go → wtf_tests/datetime_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wtftests
package wtf_tests

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion wtftests/position_test.go → wtf_tests/position_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wtftests
package wtf_tests

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion wtftests/utils_test.go → wtf_tests/utils_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wtftests
package wtf_tests

import (
"testing"
Expand Down

0 comments on commit f592e09

Please sign in to comment.