Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use upper camel case to unify the case name of unit testing cases #3402

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
68a0448
up
oldme-git Mar 19, 2024
544004d
up
oldme-git Mar 20, 2024
c067b63
up
oldme-git Mar 20, 2024
559e36f
up
oldme-git Mar 20, 2024
d10c5fb
Merge branch 'master' into unify
oldme-git Mar 20, 2024
115016b
up
oldme-git Mar 20, 2024
63dd58f
up
oldme-git Mar 20, 2024
9058d8d
up
oldme-git Mar 20, 2024
a0b5327
up
oldme-git Mar 20, 2024
9492373
up
oldme-git Mar 20, 2024
103b0bf
Merge branch 'master' into unify
oldme-git Mar 20, 2024
ee5f2e4
up
oldme-git Mar 20, 2024
c6457fd
up
oldme-git Mar 20, 2024
8fed2b0
Merge branch 'master' into unify
oldme-git Mar 20, 2024
f8fa8f8
up
oldme-git Mar 20, 2024
717e935
up
oldme-git Mar 20, 2024
e73b871
up
oldme-git Mar 20, 2024
cb3f8ef
up
oldme-git Mar 20, 2024
0b7ccfc
Merge branch 'master' into unify
oldme-git Apr 1, 2024
e83e8ef
up
oldme-git Mar 19, 2024
8f3c5e2
up
oldme-git Mar 20, 2024
ba53e7d
up
oldme-git Mar 20, 2024
d03b814
up
oldme-git Mar 20, 2024
898bd57
up
oldme-git Mar 20, 2024
2751751
up
oldme-git Mar 20, 2024
f55285a
up
oldme-git Mar 20, 2024
6e4bbc2
up
oldme-git Mar 20, 2024
30e4265
up
oldme-git Mar 20, 2024
fc423d5
up
oldme-git Mar 20, 2024
a870fdb
up
oldme-git Mar 20, 2024
994a535
up
oldme-git Mar 20, 2024
5a29f06
up
oldme-git Mar 20, 2024
2586d55
up
oldme-git Mar 20, 2024
21faa96
up
oldme-git Mar 20, 2024
2f0e098
Merge remote-tracking branch 'origin/unify' into unify
oldme-git Apr 1, 2024
6aef363
更改最新pr的测试名
oldme-git Apr 1, 2024
1e16310
更改metric的测试名
oldme-git Apr 1, 2024
07f48e9
更改最新pr的测试名
oldme-git Apr 1, 2024
1d9d5b8
更改最新pr的测试名
oldme-git Apr 1, 2024
f1b3f11
更改最新pr的测试名
oldme-git Apr 1, 2024
566f9c8
更改最新pr的测试名
oldme-git Apr 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 15 additions & 2 deletions .github/workflows/before_script.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/usr/bin/env bash

find . -name "*.go" | xargs gofmt -w
git diff --name-only --exit-code || if [ $? != 0 ]; then echo "Notice: gofmt check failed,please gofmt before pr." && exit 1; fi
echo "gofmt check pass."
git diff --name-only --exit-code || if [ $? != 0 ]; then
echo "Notice: gofmt checks have failed, please gofmt before pr." && exit 1;
fi
echo "gofmt checks have passed."

trap 'exit 1' ERR
find . -name "*_test.go" -print0 | while IFS= read -r -d '' file; do
grep -oP 'func \KTest\w+' "$file" | while read -r funcName; do
if ! [[ ${funcName#Test} =~ ^[A-Z0-9][a-zA-Z0-9]*$ ]]; then
echo "Notice: Func name $funcName in file $file checks have failed, please check that it is upper camel case before pr." && exit 1;
fi
done || exit 1
done
echo "Func name of unit test checks have passed."

sudo echo "127.0.0.1 local" | sudo tee -a /etc/hosts
10 changes: 5 additions & 5 deletions cmd/gf/internal/cmd/cmd_z_unit_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/gogf/gf/v2/text/gstr"
)

func Test_Build_Single(t *testing.T) {
func TestBuildSingle(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
buildPath = gtest.DataPath(`build`, `single`)
Expand All @@ -39,7 +39,7 @@ func Test_Build_Single(t *testing.T) {
})
}

func Test_Build_Single_Output(t *testing.T) {
func TestBuildSingleOutput(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
buildPath = gtest.DataPath(`build`, `single`)
Expand All @@ -63,7 +63,7 @@ func Test_Build_Single_Output(t *testing.T) {
})
}

func Test_Build_Single_Path(t *testing.T) {
func TestBuildSinglePath(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
buildPath = gtest.DataPath(`build`, `single`)
Expand All @@ -88,7 +88,7 @@ func Test_Build_Single_Path(t *testing.T) {
})
}

func Test_Build_Single_VarMap(t *testing.T) {
func TestBuildSingleVarMap(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
buildPath = gtest.DataPath(`build`, `varmap`)
Expand Down Expand Up @@ -119,7 +119,7 @@ func Test_Build_Single_VarMap(t *testing.T) {
})
}

func Test_Build_Multiple(t *testing.T) {
func TestBuildMultiple(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
buildPath = gtest.DataPath(`build`, `multiple`)
Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/cmd_z_unit_fix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/gogf/gf/v2/test/gtest"
)

func Test_Fix_doFixV25Content(t *testing.T) {
func TestFixdoFixV25Content(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
content = gtest.DataContent(`fix`, `fix25_content.go`)
Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/cmd_z_unit_gen_ctrl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/gogf/gf/v2/util/gutil"
)

func Test_Gen_Ctrl_Default(t *testing.T) {
func TestGenCtrlDefault(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
path = gfile.Temp(guid.S())
Expand Down
10 changes: 5 additions & 5 deletions cmd/gf/internal/cmd/cmd_z_unit_gen_dao_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/gogf/gf/v2/util/gutil"
)

func Test_Gen_Dao_Default(t *testing.T) {
func TestGenDaoDefault(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
err error
Expand Down Expand Up @@ -111,7 +111,7 @@ func Test_Gen_Dao_Default(t *testing.T) {
})
}

func Test_Gen_Dao_TypeMapping(t *testing.T) {
func TestGenDaoTypeMapping(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
err error
Expand Down Expand Up @@ -225,7 +225,7 @@ func execSqlFile(db gdb.DB, filePath string, args ...any) error {
return nil
}

func Test_Gen_Dao_Issue2572(t *testing.T) {
func TestGenDaoIssue2572(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
err error
Expand Down Expand Up @@ -304,7 +304,7 @@ func Test_Gen_Dao_Issue2572(t *testing.T) {
})
}

func Test_Gen_Dao_Issue2616(t *testing.T) {
func TestGenDaoIssue2616(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
err error
Expand Down Expand Up @@ -395,7 +395,7 @@ func Test_Gen_Dao_Issue2616(t *testing.T) {
}

// https://github.com/gogf/gf/issues/2746
func Test_Gen_Dao_Issue2746(t *testing.T) {
func TestGenDaoIssue2746(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
err error
Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/cmd_z_unit_gen_pbentity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/gogf/gf/v2/util/guid"
)

func Test_Gen_Pbentity_NameCase(t *testing.T) {
func TestGenPbentityNameCase(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
err error
Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/cmd/cmd_z_unit_gen_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/gogf/gf/v2/util/gutil"
)

func Test_Gen_Service_Default(t *testing.T) {
func TestGenServiceDefault(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
path = gfile.Temp(guid.S())
Expand Down
5 changes: 1 addition & 4 deletions cmd/gf/internal/cmd/testdata/fix/fix25_content.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package testdata

import (
"fmt"
"testing"
"time"

"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/test/gtest"
"github.com/gogf/gf/v2/util/guid"
)

func Test_Router_Hook_Multi(t *testing.T) {
func TestRouterHookMulti(t *testing.T) {
s := g.Server(guid.S())
s.BindHandler("/multi-hook", func(r *ghttp.Request) {
r.Response.Write("show")
Expand Down
2 changes: 1 addition & 1 deletion cmd/gf/internal/utility/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/gogf/gf/v2/test/gtest"
)

func Test_GetModPath(t *testing.T) {
func TestGetModPath(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
goModPath := utils.GetModPath()
fmt.Println(goModPath)
Expand Down
26 changes: 8 additions & 18 deletions container/garray/garray_z_unit_all_basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/gogf/gf/v2/util/gutil"
)

func Test_Array_Var(t *testing.T) {
func TestArrayVar(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var array garray.Array
expect := []int{2, 3, 1}
Expand Down Expand Up @@ -58,7 +58,7 @@ func Test_Array_Var(t *testing.T) {
})
}

func Test_SortedIntArray_Var(t *testing.T) {
func TestSortedIntArrayVar(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var array garray.SortedIntArray
expect := []int{1, 2, 3}
Expand All @@ -67,17 +67,7 @@ func Test_SortedIntArray_Var(t *testing.T) {
})
}

func Test_IntArray_Unique(t *testing.T) {
hailaz marked this conversation as resolved.
Show resolved Hide resolved
gtest.C(t, func(t *gtest.T) {
expect := []int{1, 2, 3, 4, 5, 6}
array := garray.NewIntArray()
array.Append(1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6)
array.Unique()
t.Assert(array.Slice(), expect)
})
}

func Test_SortedIntArray1(t *testing.T) {
func TestSortedIntArray1(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
expect := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
array := garray.NewSortedIntArray()
Expand All @@ -89,7 +79,7 @@ func Test_SortedIntArray1(t *testing.T) {
})
}

func Test_SortedIntArray2(t *testing.T) {
func TestSortedIntArray2(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
expect := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
array := garray.NewSortedIntArray()
Expand All @@ -100,7 +90,7 @@ func Test_SortedIntArray2(t *testing.T) {
})
}

func Test_SortedStrArray1(t *testing.T) {
func TestSortedStrArray1(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
expect := []string{"0", "1", "10", "2", "3", "4", "5", "6", "7", "8", "9"}
array1 := garray.NewSortedStrArray()
Expand All @@ -115,7 +105,7 @@ func Test_SortedStrArray1(t *testing.T) {

}

func Test_SortedStrArray2(t *testing.T) {
func TestSortedStrArray2(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
expect := []string{"0", "1", "10", "2", "3", "4", "5", "6", "7", "8", "9"}
array := garray.NewSortedStrArray()
Expand All @@ -128,7 +118,7 @@ func Test_SortedStrArray2(t *testing.T) {
})
}

func Test_SortedArray1(t *testing.T) {
func TestSortedArray1(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
expect := []string{"0", "1", "10", "2", "3", "4", "5", "6", "7", "8", "9"}
array := garray.NewSortedArray(func(v1, v2 interface{}) int {
Expand All @@ -141,7 +131,7 @@ func Test_SortedArray1(t *testing.T) {
})
}

func Test_SortedArray2(t *testing.T) {
func TestSortedArray2(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
expect := []string{"0", "1", "10", "2", "3", "4", "5", "6", "7", "8", "9"}
func1 := func(v1, v2 interface{}) int {
Expand Down