| 1 | //===-- DumpRecordLayoutTests.cpp -------------------------------*- C++ -*-===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "TweakTesting.h" |
| 10 | #include "gmock/gmock.h" |
| 11 | #include "gtest/gtest.h" |
| 12 | |
| 13 | using ::testing::AllOf; |
| 14 | using ::testing::HasSubstr; |
| 15 | using ::testing::StartsWith; |
| 16 | |
| 17 | namespace clang { |
| 18 | namespace clangd { |
| 19 | namespace { |
| 20 | |
| 21 | TWEAK_TEST(DumpRecordLayout); |
| 22 | |
| 23 | TEST_F(DumpRecordLayoutTest, Test) { |
| 24 | EXPECT_AVAILABLE("^s^truct ^X ^{ int x; ^};"); |
| 25 | EXPECT_UNAVAILABLE("struct X { int ^a; };"); |
| 26 | EXPECT_UNAVAILABLE("struct ^X;"); |
| 27 | EXPECT_UNAVAILABLE("template <typename T> struct ^X { T t; };"); |
| 28 | EXPECT_UNAVAILABLE("enum ^X {};"); |
| 29 | |
| 30 | EXPECT_THAT(apply("struct ^X { int x; int y; };"), |
| 31 | AllOf(StartsWith("message:"), HasSubstr( "0 | int x"))); |
| 32 | } |
| 33 | |
| 34 | } // namespace |
| 35 | } // namespace clangd |
| 36 | } // namespace clang |
| 37 |
