Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdWaterLW committed Aug 14, 2023
1 parent 6adbfa2 commit 9edf942
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sqle/api/controller/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ func TestValidateName(t *testing.T) {
assert.Equal(t, true, validateName("姓名name_1"))
assert.Equal(t, true, validateName("name_1"))

len60 := `test_name_length_60_0000000000000000000000000000000000000000`
assert.Equal(t, 60, len(len60))
assert.Equal(t, true, validateName(len60))
len120 := `test_name_length_120_000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`
assert.Equal(t, 120, len(len120))
assert.Equal(t, true, validateName(len120))

assert.Equal(t, false, validateName(""))
assert.Equal(t, false, validateName("1name姓名"))
Expand All @@ -28,10 +28,10 @@ func TestValidateName(t *testing.T) {
assert.Equal(t, false, validateName("name*name"))
assert.Equal(t, false, validateName("*name姓名"))

len61 := `test_name_length_61_00000000000000000000000000000000000000000`
assert.Equal(t, 61, len(len61))
assert.Equal(t, false, validateName(len61))
assert.Equal(t, false, validateName(len61+"*"))
len121 := `test_name_length_121_0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`
assert.Equal(t, 121, len(len121))
assert.Equal(t, false, validateName(len121))
assert.Equal(t, false, validateName(len121+"*"))
}

func TestValidatePort(t *testing.T) {
Expand Down

0 comments on commit 9edf942

Please sign in to comment.