Skip to content

Instantly share code, notes, and snippets.

@haru01
haru01 / result
Created May 28, 2017 23:48
step1
--- FAIL: TestToRoman (0.00s)
/Users/eiji/go/src/sandbox/roman/roman_test.go:30: Fail ToRoman(1): want I got _
FAIL
FAIL sandbox/roman 0.006s
Error: Tests failed.
@haru01
haru01 / keybinds.json
Created May 28, 2017 23:53
setup keybinds vcode
[
{
"key": "cmd+r",
"command": "go.test.workspace"
},
{
"key": "alt+down",
"command": "editor.action.goToDeclaration",
"when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
},
@haru01
haru01 / roman.go
Created May 28, 2017 23:56
step2 fake it
package roman
func ToRoman(n int) string {
return "I"
}
@haru01
haru01 / result
Created May 28, 2017 23:58
step2 fake it result
Running tool: /usr/local/bin/go test -timeout 30s -tags ./...
ok sandbox/roman 0.006s
Success: Tests passed.
@haru01
haru01 / roman_test.go
Created May 29, 2017 00:30
step 3 testCase & t.Run
package roman
import "testing"
func TestToRoman(t *testing.T) {
testCases := []struct {
name string
in int
want string
}{
@haru01
haru01 / roman.go
Created May 29, 2017 00:31
step3 testCases & t.Run
package roman
func ToRoman(n int) string {
return "_"
}
@haru01
haru01 / result
Created May 29, 2017 00:32
step3 result
--- FAIL: TestToRoman (0.00s)
--- FAIL: TestToRoman/1=>Iと変換できること (0.00s)
roman_test.go:36: ToRoman(1): got _ want I
FAIL
FAIL sandbox/roman 0.006s
Error: Tests failed.
ok sandbox/roman 0.006s
Success: Tests passed.
@haru01
haru01 / roman_test.go
Last active May 29, 2017 23:52
step4 add test case 5 V
package roman
import "testing"
func TestToRoman(t *testing.T) {
testCases := []struct {
name string
in uint16
want string
}{
@haru01
haru01 / result
Last active May 29, 2017 23:53
step4 result
--- FAIL: TestToRoman (0.00s)
--- FAIL: TestToRoman/5=>Vと変換できること (0.00s)
roman_test.go:37: ToRoman(5): got I want V
FAIL
FAIL sandbox/roman 0.006s
Error: Tests failed.