blob: 2382b1848c635795a1187555684af86c51ee8b73 [file] [log] [blame]
Chih-Hung Hsieha5f22ed2019-10-24 20:47:54 -07001// 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
15package rust
16
17import (
18 "strings"
19 "testing"
20)
21
Chih-Hung Hsieha5f22ed2019-10-24 20:47:54 -070022func TestRustTest(t *testing.T) {
23 ctx := testRust(t, `
24 rust_test_host {
25 name: "my_test",
Chih-Hung Hsieh41805be2019-10-31 20:56:47 -070026 srcs: ["foo.rs"],
Chih-Hung Hsieh41805be2019-10-31 20:56:47 -070027 }`)
28
Ivan Lozanofc80fe72020-06-11 13:25:36 -040029 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 Hsieh41805be2019-10-31 20:56:47 -070034 }
35}