fix: unittest

This commit is contained in:
xucong053
2022-05-27 16:40:17 +08:00
parent f2a9e653df
commit 2bf916deb3
47 changed files with 87 additions and 1366 deletions

View File

@@ -0,0 +1,44 @@
package noplugin
import (
"fmt"
)
func SumTwoInt(a, b int) int {
return a + b
}
func SumInts(args ...int) int {
var sum int
for _, arg := range args {
sum += arg
}
return sum
}
func Sum(args ...interface{}) (interface{}, error) {
var sum float64
for _, arg := range args {
switch v := arg.(type) {
case int:
sum += float64(v)
case float64:
sum += v
default:
return nil, fmt.Errorf("unexpected type: %T", arg)
}
}
return sum, nil
}
func SetupHookExample(args string) string {
return fmt.Sprintf("step name: %v, setup...", args)
}
func TeardownHookExample(args string) string {
return fmt.Sprintf("step name: %v, teardown...", args)
}
func GetVersion() string {
return "v0.4"
}