github.com/westcoastroms/westcoastroms-build@v0.0.0-20190928114312-2350e5a73030/build/soong/cc/config/tidy_test.go (about) 1 // Copyright 2016 Google Inc. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package config 16 17 import ( 18 "testing" 19 ) 20 21 func TestTidyChecksForDir(t *testing.T) { 22 testCases := []struct { 23 input string 24 expected string 25 }{ 26 {"foo/bar", tidyDefault}, 27 {"vendor/foo/bar", tidyExternalVendor}, 28 {"vendor/google", tidyDefault}, 29 {"vendor/google/foo", tidyDefault}, 30 {"vendor/google_devices/foo", tidyExternalVendor}, 31 } 32 33 for _, testCase := range testCases { 34 t.Run(testCase.input, func(t *testing.T) { 35 output := TidyChecksForDir(testCase.input) 36 if output != testCase.expected { 37 t.Error("Output doesn't match expected", output, testCase.expected) 38 } 39 }) 40 } 41 }