Chih-Hung Hsieh | a5f22ed | 2019-10-24 20:47:54 -0700 | [diff] [blame] | 1 | // Copyright 2019 The Android Open Source Project |
| 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 rust |
| 16 | |
| 17 | import ( |
| 18 | "strings" |
| 19 | "testing" |
| 20 | ) |
| 21 | |
Chih-Hung Hsieh | a5f22ed | 2019-10-24 20:47:54 -0700 | [diff] [blame] | 22 | func TestRustTest(t *testing.T) { |
| 23 | ctx := testRust(t, ` |
| 24 | rust_test_host { |
| 25 | name: "my_test", |
Chih-Hung Hsieh | 41805be | 2019-10-31 20:56:47 -0700 | [diff] [blame] | 26 | srcs: ["foo.rs"], |
Chih-Hung Hsieh | 41805be | 2019-10-31 20:56:47 -0700 | [diff] [blame] | 27 | }`) |
| 28 | |
Ivan Lozano | fc80fe7 | 2020-06-11 13:25:36 -0400 | [diff] [blame^] | 29 | testingModule := ctx.ModuleForTests("my_test", "linux_glibc_x86_64") |
| 30 | expectedOut := "my_test/linux_glibc_x86_64/my_test" |
| 31 | outPath := testingModule.Output("my_test").Output.String() |
| 32 | if !strings.Contains(outPath, expectedOut) { |
| 33 | t.Errorf("wrong output path: %v; expected: %v", outPath, expectedOut) |
Chih-Hung Hsieh | 41805be | 2019-10-31 20:56:47 -0700 | [diff] [blame] | 34 | } |
| 35 | } |