Loading cc/cc_test.go +23 −0 Original line number Diff line number Diff line Loading @@ -2387,6 +2387,17 @@ func TestStaticLibDepReorderingWithShared(t *testing.T) { } } func checkEquals(t *testing.T, message string, expected, actual interface{}) { if !reflect.DeepEqual(actual, expected) { t.Errorf(message+ "\nactual: %v"+ "\nexpected: %v", actual, expected, ) } } func TestLlndkHeaders(t *testing.T) { ctx := testCc(t, ` llndk_headers { Loading Loading @@ -2817,6 +2828,18 @@ func TestVersionedStubs(t *testing.T) { } } func TestVersioningMacro(t *testing.T) { for _, tc := range []struct{ moduleName, expected string }{ {"libc", "__LIBC_API__"}, {"libfoo", "__LIBFOO_API__"}, {"libfoo@1", "__LIBFOO_1_API__"}, {"libfoo-v1", "__LIBFOO_V1_API__"}, {"libfoo.v1", "__LIBFOO_V1_API__"}, } { checkEquals(t, tc.moduleName, tc.expected, versioningMacroName(tc.moduleName)) } } func TestStaticExecutable(t *testing.T) { ctx := testCc(t, ` cc_binary { Loading cc/library.go +1 −1 Original line number Diff line number Diff line Loading @@ -1329,7 +1329,7 @@ var charsNotForMacro = regexp.MustCompile("[^a-zA-Z0-9_]+") func versioningMacroName(moduleName string) string { macroName := charsNotForMacro.ReplaceAllString(moduleName, "_") macroName = strings.ToUpper(moduleName) macroName = strings.ToUpper(macroName) return "__" + macroName + "_API__" } Loading Loading
cc/cc_test.go +23 −0 Original line number Diff line number Diff line Loading @@ -2387,6 +2387,17 @@ func TestStaticLibDepReorderingWithShared(t *testing.T) { } } func checkEquals(t *testing.T, message string, expected, actual interface{}) { if !reflect.DeepEqual(actual, expected) { t.Errorf(message+ "\nactual: %v"+ "\nexpected: %v", actual, expected, ) } } func TestLlndkHeaders(t *testing.T) { ctx := testCc(t, ` llndk_headers { Loading Loading @@ -2817,6 +2828,18 @@ func TestVersionedStubs(t *testing.T) { } } func TestVersioningMacro(t *testing.T) { for _, tc := range []struct{ moduleName, expected string }{ {"libc", "__LIBC_API__"}, {"libfoo", "__LIBFOO_API__"}, {"libfoo@1", "__LIBFOO_1_API__"}, {"libfoo-v1", "__LIBFOO_V1_API__"}, {"libfoo.v1", "__LIBFOO_V1_API__"}, } { checkEquals(t, tc.moduleName, tc.expected, versioningMacroName(tc.moduleName)) } } func TestStaticExecutable(t *testing.T) { ctx := testCc(t, ` cc_binary { Loading
cc/library.go +1 −1 Original line number Diff line number Diff line Loading @@ -1329,7 +1329,7 @@ var charsNotForMacro = regexp.MustCompile("[^a-zA-Z0-9_]+") func versioningMacroName(moduleName string) string { macroName := charsNotForMacro.ReplaceAllString(moduleName, "_") macroName = strings.ToUpper(moduleName) macroName = strings.ToUpper(macroName) return "__" + macroName + "_API__" } Loading