-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move lint.Name to name.go file (#1084)
- Loading branch information
1 parent
a213a5f
commit 14babf2
Showing
3 changed files
with
44 additions
and
41 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package lint | ||
|
||
import "testing" | ||
|
||
// TestName tests Name function | ||
func TestName(t *testing.T) { //revive:disable-line:exported | ||
tests := []struct { | ||
name, want string | ||
}{ | ||
{"foo_bar", "fooBar"}, | ||
{"foo_bar_baz", "fooBarBaz"}, | ||
{"Foo_bar", "FooBar"}, | ||
{"foo_WiFi", "fooWiFi"}, | ||
{"id", "id"}, | ||
{"Id", "ID"}, | ||
{"foo_id", "fooID"}, | ||
{"fooId", "fooID"}, | ||
{"fooUid", "fooUID"}, | ||
{"idFoo", "idFoo"}, | ||
{"uidFoo", "uidFoo"}, | ||
{"midIdDle", "midIDDle"}, | ||
{"APIProxy", "APIProxy"}, | ||
{"ApiProxy", "APIProxy"}, | ||
{"apiProxy", "apiProxy"}, | ||
{"_Leading", "_Leading"}, | ||
{"___Leading", "_Leading"}, | ||
{"trailing_", "trailing"}, | ||
{"trailing___", "trailing"}, | ||
{"a_b", "aB"}, | ||
{"a__b", "aB"}, | ||
{"a___b", "aB"}, | ||
{"Rpc1150", "RPC1150"}, | ||
{"case3_1", "case3_1"}, | ||
{"case3__1", "case3_1"}, | ||
{"IEEE802_16bit", "IEEE802_16bit"}, | ||
{"IEEE802_16Bit", "IEEE802_16Bit"}, | ||
} | ||
for _, test := range tests { | ||
got := Name(test.name, nil, nil) | ||
if got != test.want { | ||
t.Errorf("Name(%q) = %q, want %q", test.name, got, test.want) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters