aboutsummaryrefslogtreecommitdiffstats
path: root/cc/cc_test.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-05-17 13:44:16 -0700
committerColin Cross <ccross@android.com>2017-05-17 14:22:22 -0700
commitdd84e056ed497f6b1ff8d7914489c64148240ec7 (patch)
treedc114f9c158bb719b837b1a66befe722e1dc9fbf /cc/cc_test.go
parent67a5c132c53ce0715f4d169fc26dd537294feaca (diff)
downloadbuild_soong-dd84e056ed497f6b1ff8d7914489c64148240ec7.tar.gz
build_soong-dd84e056ed497f6b1ff8d7914489c64148240ec7.tar.bz2
build_soong-dd84e056ed497f6b1ff8d7914489c64148240ec7.zip
Dedup exported flags from dependencies
Soong command lines have gotten very long due to hidl modules reexporting lots of libraries. Dedup the include dir flags. Test: m -j checkbuild Change-Id: I6ada1251012da42344e2c00ae66001a649023d2c
Diffstat (limited to 'cc/cc_test.go')
-rw-r--r--cc/cc_test.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 6e779e75..92120a54 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -6,6 +6,56 @@ import (
"testing"
)
+var firstUniqueElementsTestCases = []struct {
+ in []string
+ out []string
+}{
+ {
+ in: []string{"a"},
+ out: []string{"a"},
+ },
+ {
+ in: []string{"a", "b"},
+ out: []string{"a", "b"},
+ },
+ {
+ in: []string{"a", "a"},
+ out: []string{"a"},
+ },
+ {
+ in: []string{"a", "b", "a"},
+ out: []string{"a", "b"},
+ },
+ {
+ in: []string{"b", "a", "a"},
+ out: []string{"b", "a"},
+ },
+ {
+ in: []string{"a", "a", "b"},
+ out: []string{"a", "b"},
+ },
+ {
+ in: []string{"a", "b", "a", "b"},
+ out: []string{"a", "b"},
+ },
+ {
+ in: []string{"liblog", "libdl", "libc++", "libdl", "libc", "libm"},
+ out: []string{"liblog", "libdl", "libc++", "libc", "libm"},
+ },
+}
+
+func TestFirstUniqueElements(t *testing.T) {
+ for _, testCase := range firstUniqueElementsTestCases {
+ out := firstUniqueElements(testCase.in)
+ if !reflect.DeepEqual(out, testCase.out) {
+ t.Errorf("incorrect output:")
+ t.Errorf(" input: %#v", testCase.in)
+ t.Errorf(" expected: %#v", testCase.out)
+ t.Errorf(" got: %#v", out)
+ }
+ }
+}
+
var lastUniqueElementsTestCases = []struct {
in []string
out []string