mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
MSYS+mintty support; pkg renaming to hkexsh
This commit is contained in:
parent
dd746cf343
commit
5da70447b0
15 changed files with 281 additions and 377 deletions
52
spinsult/spinsult_test.go
Normal file
52
spinsult/spinsult_test.go
Normal file
|
@ -0,0 +1,52 @@
|
|||
//To show coverage for tests:
|
||||
//
|
||||
//1. go test -coverprofile=cov.out
|
||||
//2. go tool cover -func=cov.out
|
||||
//3. go tool cover -html=cov.out
|
||||
//4. Profit!!
|
||||
//
|
||||
// For heatmap coverage, change step 1 to:
|
||||
//2. go test -covermode=count -coverprofile=cov.out
|
||||
//
|
||||
// ref: https://blog.golang.org/cover
|
||||
|
||||
package spinsult
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test1Get(t *testing.T) {
|
||||
//if testing.Short() {
|
||||
// t.Skip("skipping test in short mode.")
|
||||
//}
|
||||
r = rand.New(rand.NewSource(42))
|
||||
out := Get()
|
||||
if out != "mammering doghearted codpiece!" {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func Test2Get(t *testing.T) {
|
||||
//if testing.Short() {
|
||||
// t.Skip("skipping test in short mode.")
|
||||
//}
|
||||
out := Get()
|
||||
if out != "dankish common-kissing coxcomb!" {
|
||||
t.Fail()
|
||||
}
|
||||
out = GetSentence()
|
||||
if out != "Thou wayward crook-pated fustilarian!" {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
// Example of calling Get() for a random insult.
|
||||
func ExampleGet() {
|
||||
r = rand.New(rand.NewSource(42))
|
||||
out := GetSentence()
|
||||
fmt.Println(out)
|
||||
//Output: Thou mammering doghearted codpiece!
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue