• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-matchers.h"
11 #include "gmock/gmock.h"
12 #include "gtest/gtest.h"
13 
14 using ::testing::AllOf;
15 using ::testing::HasSubstr;
16 using ::testing::StartsWith;
17 
18 namespace clang {
19 namespace clangd {
20 namespace {
21 
22 TWEAK_TEST(DumpRecordLayout);
23 
TEST_F(DumpRecordLayoutTest,Test)24 TEST_F(DumpRecordLayoutTest, Test) {
25   EXPECT_AVAILABLE("^s^truct ^X ^{ int x; ^};");
26   EXPECT_THAT("struct X { int ^a; };", Not(isAvailable()));
27   EXPECT_THAT("struct ^X;", Not(isAvailable()));
28   EXPECT_THAT("template <typename T> struct ^X { T t; };", Not(isAvailable()));
29   EXPECT_THAT("enum ^X {};", Not(isAvailable()));
30 
31   EXPECT_THAT(apply("struct ^X { int x; int y; };"),
32               AllOf(StartsWith("message:"), HasSubstr("0 |   int x")));
33 }
34 
35 } // namespace
36 } // namespace clangd
37 } // namespace clang
38