diff --git a/internal/analyzer/parser_validation_test.go b/internal/analyzer/parser_validation_test.go index 1e32a1f..18cefe3 100644 --- a/internal/analyzer/parser_validation_test.go +++ b/internal/analyzer/parser_validation_test.go @@ -8,7 +8,7 @@ import ( "github.com/opencodeco/validgen/types" ) -func Test_ValidParserValidation(t *testing.T) { +func TestValidParserValidation(t *testing.T) { tests := []struct { name string validation string @@ -148,7 +148,7 @@ func Test_ValidParserValidation(t *testing.T) { } } -func Test_ParserInvalidValidation(t *testing.T) { +func TestParserInvalidValidation(t *testing.T) { tests := []struct { name string validation string diff --git a/internal/common/normalized_base_type_test.go b/internal/common/normalized_base_type_test.go index 33bf8d0..6e218de 100644 --- a/internal/common/normalized_base_type_test.go +++ b/internal/common/normalized_base_type_test.go @@ -2,7 +2,7 @@ package common import "testing" -func TestNormalizedBaseType_String(t *testing.T) { +func TestNormalizedBaseTypeString(t *testing.T) { tests := []struct { name string n NormalizedBaseType diff --git a/internal/common/types_test.go b/internal/common/types_test.go index 0aa1361..e7d72a7 100644 --- a/internal/common/types_test.go +++ b/internal/common/types_test.go @@ -4,7 +4,7 @@ import ( "testing" ) -func TestFieldType_ToString(t *testing.T) { +func TestFieldTypeToString(t *testing.T) { type fields struct { ComposedType string BaseType string @@ -67,7 +67,7 @@ func TestFieldType_ToString(t *testing.T) { } } -func TestFieldType_IsGoType(t *testing.T) { +func TestFieldTypeIsGoType(t *testing.T) { type args struct { fieldType FieldType } diff --git a/tests/endtoend/array_string.go b/tests/endtoend/array_string.go index b1ab9c0..ad076a4 100644 --- a/tests/endtoend/array_string.go +++ b/tests/endtoend/array_string.go @@ -9,7 +9,7 @@ type ArrayString struct { TypesNotIn [8]string `valid:"nin=a b c"` } -func array_string_tests() { +func arrayStringTests() { log.Println("starting array string tests") var expectedMsgErrors []string diff --git a/tests/endtoend/bool.go b/tests/endtoend/bool.go index 3c41612..70c6574 100644 --- a/tests/endtoend/bool.go +++ b/tests/endtoend/bool.go @@ -9,7 +9,7 @@ type BoolType struct { FieldNeqFieldEqTrue bool `valid:"neqfield=FieldEqTrue"` } -func bool_tests() { +func boolTests() { log.Println("starting bool tests") var expectedMsgErrors []string diff --git a/tests/endtoend/cmp_between_inner_fields.go b/tests/endtoend/cmp_between_inner_fields.go index 663332d..0da154a 100644 --- a/tests/endtoend/cmp_between_inner_fields.go +++ b/tests/endtoend/cmp_between_inner_fields.go @@ -4,12 +4,12 @@ import ( "log" ) -func cmp_between_inner_fields_tests() { +func cmpBetweenInnerFieldsTests() { log.Println("starting between inner fields tests") - cmp_between_inner_string_fields_tests() - cmp_between_inner_uint8_fields_tests() - cmp_between_inner_bool_fields_tests() + cmpBetweenInnerStringFieldsTests() + cmpBetweenInnerUint8FieldsTests() + cmpBetweenInnerBoolFieldsTests() log.Println("cmp between inner fields tests ok") } @@ -20,7 +20,7 @@ type CmpInnerStringFields struct { Field3neq1 string `valid:"neqfield=Field1"` } -func cmp_between_inner_string_fields_tests() { +func cmpBetweenInnerStringFieldsTests() { log.Println("starting between inner string fields tests") var expectedMsgErrors []string @@ -67,7 +67,7 @@ type CmpInnerUint8Fields struct { Field8lt4 uint8 `valid:"ltfield=Field4"` } -func cmp_between_inner_uint8_fields_tests() { +func cmpBetweenInnerUint8FieldsTests() { log.Println("starting between inner uint8 fields tests") var expectedMsgErrors []string @@ -123,7 +123,7 @@ type CmpInnerBoolFields struct { Field3neq1 bool `valid:"neqfield=Field1"` } -func cmp_between_inner_bool_fields_tests() { +func cmpBetweenInnerBoolFieldsTests() { log.Println("starting between inner bool fields tests") var expectedMsgErrors []string diff --git a/tests/endtoend/cmp_between_nested_fields.go b/tests/endtoend/cmp_between_nested_fields.go index 8114499..e5383bb 100644 --- a/tests/endtoend/cmp_between_nested_fields.go +++ b/tests/endtoend/cmp_between_nested_fields.go @@ -4,11 +4,11 @@ import ( "log" ) -func cmp_between_nested_fields_tests() { +func cmpBetweenNestedFieldsTests() { log.Println("starting between nested fields tests") - cmp_between_nested_string_fields_tests() - cmp_between_nested_uint8_fields_tests() + cmpBetweenNestedStringFieldsTests() + cmpBetweenNestedUint8FieldsTests() log.Println("cmp between nested fields tests ok") } @@ -23,7 +23,7 @@ type NestedStringFields struct { Field1 string } -func cmp_between_nested_string_fields_tests() { +func cmpBetweenNestedStringFieldsTests() { log.Println("starting between nested string fields tests") var expectedMsgErrors []string @@ -78,7 +78,7 @@ type NestedUint8Fields struct { Field2 uint8 } -func cmp_between_nested_uint8_fields_tests() { +func cmpBetweenNestedUint8FieldsTests() { log.Println("starting between nested uint8 fields tests") var expectedMsgErrors []string diff --git a/tests/endtoend/generate_tests/numeric.tpl b/tests/endtoend/generate_tests/numeric.tpl index cc9747b..fddf95b 100644 --- a/tests/endtoend/generate_tests/numeric.tpl +++ b/tests/endtoend/generate_tests/numeric.tpl @@ -4,10 +4,10 @@ package main import "log" -func numeric_tests() { +func numericTests() { log.Println("starting numeric tests") - {{range .FieldTypes}}numeric_{{.}}_tests() + {{range .FieldTypes}}numeric{{. | title }}Tests() {{end}} log.Println("numeric tests ok") } @@ -25,7 +25,7 @@ type NumericType{{. | title }} struct { FieldNotIn {{.}} `valid:"nin=8 9 10"` } -func numeric_{{.}}_tests() { +func numeric{{. | title }}Tests() { log.Println("starting numeric {{.}} tests") var expectedMsgErrors []string diff --git a/tests/endtoend/main.go b/tests/endtoend/main.go index f546e35..ff077fb 100644 --- a/tests/endtoend/main.go +++ b/tests/endtoend/main.go @@ -31,25 +31,25 @@ type NoValidateInfo struct { func main() { log.Println("starting tests") - all_types1_tests() - all_types2_tests() - struct_in_pkg_tests() - string_tests() - nested_struct_tests() - slice_string_tests() - slice_integer_tests() - array_string_tests() - cmp_between_inner_fields_tests() - cmp_between_nested_fields_tests() - bool_tests() - map_string_tests() - map_uint8_tests() - numeric_tests() + allTypes1Tests() + allTypes2Tests() + structInPkgTests() + stringTests() + nestedStructTests() + sliceStringTests() + sliceIntegerTests() + arrayStringTests() + cmpBetweenInnerFieldsTests() + cmpBetweenNestedFieldsTests() + boolTests() + mapStringTests() + mapUint8Tests() + numericTests() log.Println("finishing tests") } -func all_types1_tests() { +func allTypes1Tests() { var expectedMsgErrors []string var errs []error @@ -78,7 +78,7 @@ func all_types1_tests() { log.Println("all_types1 tests ok") } -func all_types2_tests() { +func allTypes2Tests() { var expectedMsgErrors []string var errs []error @@ -128,7 +128,7 @@ func all_types2_tests() { log.Println("all_types2 tests ok") } -func struct_in_pkg_tests() { +func structInPkgTests() { var expectedMsgErrors []string var errs []error diff --git a/tests/endtoend/map_numeric.go b/tests/endtoend/map_numeric.go index 1d2676d..06f9adf 100644 --- a/tests/endtoend/map_numeric.go +++ b/tests/endtoend/map_numeric.go @@ -13,7 +13,7 @@ type MapUint8 struct { FieldNotIn map[uint8]string `valid:"nin=1 2 3"` } -func map_uint8_tests() { +func mapUint8Tests() { log.Println("starting map uint8 tests") var expectedMsgErrors []string diff --git a/tests/endtoend/map_string.go b/tests/endtoend/map_string.go index 5523338..b5307e1 100644 --- a/tests/endtoend/map_string.go +++ b/tests/endtoend/map_string.go @@ -13,7 +13,7 @@ type MapString struct { FieldNotIn map[string]string `valid:"nin=a b c"` } -func map_string_tests() { +func mapStringTests() { log.Println("starting map string tests") var expectedMsgErrors []string diff --git a/tests/endtoend/nested_struct.go b/tests/endtoend/nested_struct.go index 8a00502..d1be7bd 100644 --- a/tests/endtoend/nested_struct.go +++ b/tests/endtoend/nested_struct.go @@ -23,16 +23,16 @@ type UserWithStructInPkg struct { Address structsinpkg.Address `valid:"required"` } -func nested_struct_tests() { +func nestedStructTests() { log.Println("starting nested struct tests") - nested_struct_tests1() - nested_struct_tests2() + nestedStructTests1() + nestedStructTests2() log.Println("nested struct tests ok") } -func nested_struct_tests1() { +func nestedStructTests1() { log.Println("starting nested struct tests 1") var expectedMsgErrors []string @@ -73,7 +73,7 @@ func nested_struct_tests1() { log.Println("nested struct tests 1 ok") } -func nested_struct_tests2() { +func nestedStructTests2() { log.Println("starting nested struct tests 2") var expectedMsgErrors []string diff --git a/tests/endtoend/numeric.go b/tests/endtoend/numeric.go index 3d5c769..c994683 100644 --- a/tests/endtoend/numeric.go +++ b/tests/endtoend/numeric.go @@ -4,24 +4,23 @@ package main import "log" -func numeric_tests() { +func numericTests() { log.Println("starting numeric tests") - numeric_int_tests() - numeric_int8_tests() - numeric_int16_tests() - numeric_int32_tests() - numeric_int64_tests() - numeric_uint_tests() - numeric_uint8_tests() - numeric_uint16_tests() - numeric_uint32_tests() - numeric_uint64_tests() - + numericIntTests() + numericInt8Tests() + numericInt16Tests() + numericInt32Tests() + numericInt64Tests() + numericUintTests() + numericUint8Tests() + numericUint16Tests() + numericUint32Tests() + numericUint64Tests() + log.Println("numeric tests ok") } - type NumericTypeInt struct { FieldReq int `valid:"required"` FieldEq int `valid:"eq=5"` @@ -34,7 +33,7 @@ type NumericTypeInt struct { FieldNotIn int `valid:"nin=8 9 10"` } -func numeric_int_tests() { +func numericIntTests() { log.Println("starting numeric int tests") var expectedMsgErrors []string @@ -101,7 +100,7 @@ type NumericTypeInt8 struct { FieldNotIn int8 `valid:"nin=8 9 10"` } -func numeric_int8_tests() { +func numericInt8Tests() { log.Println("starting numeric int8 tests") var expectedMsgErrors []string @@ -168,7 +167,7 @@ type NumericTypeInt16 struct { FieldNotIn int16 `valid:"nin=8 9 10"` } -func numeric_int16_tests() { +func numericInt16Tests() { log.Println("starting numeric int16 tests") var expectedMsgErrors []string @@ -235,7 +234,7 @@ type NumericTypeInt32 struct { FieldNotIn int32 `valid:"nin=8 9 10"` } -func numeric_int32_tests() { +func numericInt32Tests() { log.Println("starting numeric int32 tests") var expectedMsgErrors []string @@ -302,7 +301,7 @@ type NumericTypeInt64 struct { FieldNotIn int64 `valid:"nin=8 9 10"` } -func numeric_int64_tests() { +func numericInt64Tests() { log.Println("starting numeric int64 tests") var expectedMsgErrors []string @@ -369,7 +368,7 @@ type NumericTypeUint struct { FieldNotIn uint `valid:"nin=8 9 10"` } -func numeric_uint_tests() { +func numericUintTests() { log.Println("starting numeric uint tests") var expectedMsgErrors []string @@ -436,7 +435,7 @@ type NumericTypeUint8 struct { FieldNotIn uint8 `valid:"nin=8 9 10"` } -func numeric_uint8_tests() { +func numericUint8Tests() { log.Println("starting numeric uint8 tests") var expectedMsgErrors []string @@ -503,7 +502,7 @@ type NumericTypeUint16 struct { FieldNotIn uint16 `valid:"nin=8 9 10"` } -func numeric_uint16_tests() { +func numericUint16Tests() { log.Println("starting numeric uint16 tests") var expectedMsgErrors []string @@ -570,7 +569,7 @@ type NumericTypeUint32 struct { FieldNotIn uint32 `valid:"nin=8 9 10"` } -func numeric_uint32_tests() { +func numericUint32Tests() { log.Println("starting numeric uint32 tests") var expectedMsgErrors []string @@ -637,7 +636,7 @@ type NumericTypeUint64 struct { FieldNotIn uint64 `valid:"nin=8 9 10"` } -func numeric_uint64_tests() { +func numericUint64Tests() { log.Println("starting numeric uint64 tests") var expectedMsgErrors []string @@ -691,4 +690,3 @@ func numeric_uint64_tests() { log.Println("numeric uint64 tests ok") } - diff --git a/tests/endtoend/slice_integer.go b/tests/endtoend/slice_integer.go index dac9c03..45ce1f0 100644 --- a/tests/endtoend/slice_integer.go +++ b/tests/endtoend/slice_integer.go @@ -13,7 +13,7 @@ type SliceInteger struct { TypesNotIn []int `valid:"nin=1 2 3"` } -func slice_integer_tests() { +func sliceIntegerTests() { log.Println("starting slice integer tests") var expectedMsgErrors []string diff --git a/tests/endtoend/slice_string.go b/tests/endtoend/slice_string.go index 7669fa8..2a7d426 100644 --- a/tests/endtoend/slice_string.go +++ b/tests/endtoend/slice_string.go @@ -13,7 +13,7 @@ type SliceString struct { TypesNotIn []string `valid:"nin=a b c"` } -func slice_string_tests() { +func sliceStringTests() { log.Println("starting slice string tests") var expectedMsgErrors []string diff --git a/tests/endtoend/string.go b/tests/endtoend/string.go index 13ca0cb..f16e5ad 100644 --- a/tests/endtoend/string.go +++ b/tests/endtoend/string.go @@ -16,7 +16,7 @@ type StringType struct { EmailOpt string `valid:"email"` } -func string_tests() { +func stringTests() { log.Println("starting string tests") var expectedMsgErrors []string