mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-06-16 20:23:19 +08:00
25 lines
558 B
Go
25 lines
558 B
Go
package test
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
"github.com/bestnite/sub2clash/model/proxy"
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
func validateResult(t *testing.T, expected proxy.Proxy, result proxy.Proxy) {
|
|
t.Helper()
|
|
|
|
if result.Type != expected.Type {
|
|
t.Errorf("Type mismatch: expected %s, got %s", expected.Type, result.Type)
|
|
}
|
|
|
|
if !reflect.DeepEqual(expected, result) {
|
|
expectedYaml, _ := yaml.Marshal(expected)
|
|
resultYaml, _ := yaml.Marshal(result)
|
|
|
|
t.Errorf("Structure mismatch: \nexpected:\n %s\ngot:\n %s", string(expectedYaml), string(resultYaml))
|
|
}
|
|
}
|