forked from goplus/llcppg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix multiple fields with the same name issue
- Loading branch information
Showing
4 changed files
with
132 additions
and
6 deletions.
There are no files selected for viewing
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
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,73 @@ | ||
package names | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Test_getSuffixUndercores(t *testing.T) { | ||
type args struct { | ||
name string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
}{ | ||
{ | ||
"_", | ||
args{"_PyCfgBasicblock_"}, | ||
"_", | ||
}, | ||
{ | ||
"__", | ||
args{"_PyCfgBasicblock__"}, | ||
"__", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := getSuffixUndercores(tt.args.name); got != tt.want { | ||
t.Errorf("getSuffixUndercores() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestPubName(t *testing.T) { | ||
type args struct { | ||
name string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
}{ | ||
{ | ||
"_name", | ||
args{"_PyCfgBasicblock"}, | ||
"X_PyCfgBasicblock", | ||
}, | ||
{ | ||
"_name_", | ||
args{"_PyCfgBasicblock_"}, | ||
"X_PyCfgBasicblock_", | ||
}, | ||
{ | ||
"_name__", | ||
args{"_PyCfgBasicblock__"}, | ||
"X_PyCfgBasicblock__", | ||
}, | ||
{ | ||
"__name__", | ||
args{"__PyCfgBasicblock__"}, | ||
"X__PyCfgBasicblock__", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := PubName(tt.args.name); got != tt.want { | ||
t.Errorf("PubName() = %v, want %v", got, tt.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
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