mirror of
https://github.com/kbwo/testing-language-server.git
synced 2025-08-03 15:18:16 +00:00
refactor: rename directory
This commit is contained in:
parent
4782784122
commit
1d6dd6623e
41 changed files with 54 additions and 67 deletions
49
demo/go/cases_test.go
Normal file
49
demo/go/cases_test.go
Normal file
|
@ -0,0 +1,49 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSubtract(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
a int
|
||||
b int
|
||||
want int
|
||||
}{
|
||||
{
|
||||
desc: "test one",
|
||||
a: 1,
|
||||
b: 2,
|
||||
want: 3,
|
||||
},
|
||||
{
|
||||
desc: "test two",
|
||||
a: 1,
|
||||
b: 2,
|
||||
want: 7,
|
||||
},
|
||||
}
|
||||
for _, tC := range testCases {
|
||||
t.Run(tC.desc, func(t *testing.T) {
|
||||
assert.Equal(t, tC.want, subtract(tC.a, tC.b))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdd(t *testing.T) {
|
||||
t.Run("test one", func(t *testing.T) {
|
||||
assert.Equal(t, 3, add(1, 2))
|
||||
})
|
||||
|
||||
t.Run("test two", func(t *testing.T) {
|
||||
assert.Equal(t, 5, add(1, 2))
|
||||
})
|
||||
|
||||
variable := "string"
|
||||
t.Run(variable, func(t *testing.T) {
|
||||
assert.Equal(t, 3, add(1, 2))
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue