Skip to content

Commit

Permalink
add test code
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <[email protected]>
  • Loading branch information
kpango committed May 31, 2021
1 parent f05499b commit b79f99f
Show file tree
Hide file tree
Showing 26 changed files with 13,197 additions and 70 deletions.
82 changes: 82 additions & 0 deletions cmd/filter/ingress/tensorflow/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
// Copyright (C) 2019-2021 vdaas.org vald team <[email protected]>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

// Package main provides program main
package main

import (
"testing"

"go.uber.org/goleak"
)

func Test_main(t *testing.T) {
type want struct {
}
type test struct {
name string
want want
checkFunc func(want) error
beforeFunc func()
afterFunc func()
}
defaultCheckFunc := func(w want) error {
return nil
}
tests := []test{
// TODO test cases
/*
{
name: "test_case_1",
want: want{},
checkFunc: defaultCheckFunc,
},
*/

// TODO test cases
/*
func() test {
return test {
name: "test_case_2",
want: want{},
checkFunc: defaultCheckFunc,
}
}(),
*/
}

for _, tc := range tests {
test := tc
t.Run(test.name, func(tt *testing.T) {
tt.Parallel()
defer goleak.VerifyNone(tt, goleak.IgnoreCurrent())
if test.beforeFunc != nil {
test.beforeFunc()
}
if test.afterFunc != nil {
defer test.afterFunc()
}
if test.checkFunc == nil {
test.checkFunc = defaultCheckFunc
}

main()
if err := test.checkFunc(test.want); err != nil {
tt.Errorf("error = %v", err)
}
})
}
}
Loading

0 comments on commit b79f99f

Please sign in to comment.