1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Add tests for wtf/colors.go exported functions

This commit is contained in:
Chris Cummer 2018-07-31 17:46:03 -07:00
parent 22c9da9923
commit f592e09a93
7 changed files with 59 additions and 5 deletions

View File

@ -9,4 +9,4 @@ before_install:
- export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/senorprogrammer/wtf - export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/senorprogrammer/wtf
- cd $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
weather.txt Normal file
View File

@ -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

View File

@ -1,4 +1,4 @@
package bargraphtests package bargraph_test
import ( import (
"testing" "testing"

14
wtf_tests/colors_test.go Normal file
View File

@ -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/"))
}

View File

@ -1,4 +1,4 @@
package wtftests package wtf_tests
import ( import (
"testing" "testing"

View File

@ -1,4 +1,4 @@
package wtftests package wtf_tests
import ( import (
"testing" "testing"

View File

@ -1,4 +1,4 @@
package wtftests package wtf_tests
import ( import (
"testing" "testing"