mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
35 lines
568 B
Go
35 lines
568 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
)
|
|
|
|
func init() {
|
|
log.Println("plugin init function called")
|
|
}
|
|
|
|
func SumInt(args ...interface{}) (interface{}, error) {
|
|
var sum int
|
|
for _, arg := range args {
|
|
v, ok := arg.(int)
|
|
if !ok {
|
|
return nil, fmt.Errorf("unexpected type: %T", arg)
|
|
}
|
|
sum += v
|
|
}
|
|
return sum, nil
|
|
}
|
|
|
|
func ConcatenateString(args ...interface{}) (interface{}, error) {
|
|
var result string
|
|
for _, arg := range args {
|
|
v, ok := arg.(string)
|
|
if !ok {
|
|
return nil, fmt.Errorf("unexpected type: %T", arg)
|
|
}
|
|
result += v
|
|
}
|
|
return result, nil
|
|
}
|