Marcel Hlopko | b10e49b | 2022-05-09 03:57:32 -0700 | [diff] [blame] | 1 | // Part of the Crubit project, under the Apache License v2.0 with LLVM |
| 2 | // Exceptions. See /LICENSE for license information. |
| 3 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 | |
| 5 | #include "rs_bindings_from_cc/collect_instantiations.h" |
| 6 | |
| 7 | #include <climits> |
| 8 | |
Luca Versari | c21d92f | 2022-05-25 00:56:30 -0700 | [diff] [blame] | 9 | #include "gmock/gmock.h" |
| 10 | #include "gtest/gtest.h" |
| 11 | #include "common/status_test_matchers.h" |
Marcel Hlopko | b10e49b | 2022-05-09 03:57:32 -0700 | [diff] [blame] | 12 | #include "common/test_utils.h" |
| 13 | |
| 14 | namespace crubit { |
| 15 | namespace { |
| 16 | |
| 17 | using ::testing::ElementsAre; |
| 18 | using ::testing::IsEmpty; |
| 19 | using ::testing::StrEq; |
Marcel Hlopko | b10e49b | 2022-05-09 03:57:32 -0700 | [diff] [blame] | 20 | |
| 21 | // A minimal test showing that C++ and Rust link and talk to each other. |
| 22 | TEST(CollectInstantiationsTest, EmptyRustFileReturnsEmptyCollectionTest) { |
| 23 | EXPECT_THAT(CollectInstantiations({}), IsOkAndHolds(IsEmpty())); |
| 24 | } |
| 25 | |
| 26 | // A minimal test showing that C++ and Rust link and talk to each other. |
| 27 | TEST(CollectInstantiationsTest, ReturnInstantiationsFromRustTest) { |
| 28 | std::string path = |
| 29 | WriteFileForCurrentTest("a.rs", "cc_template!(std::vector<bool>);"); |
| 30 | EXPECT_THAT(CollectInstantiations({std::move(path)}), |
Lukasz Anforowicz | 51953ac | 2022-10-05 07:29:18 -0700 | [diff] [blame] | 31 | IsOkAndHolds(ElementsAre(StrEq("std :: vector < bool >")))); |
Marcel Hlopko | b10e49b | 2022-05-09 03:57:32 -0700 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | } // namespace |
| 35 | } // namespace crubit |