1 //===---- ObjCModuleTest.cpp - clang-tidy ---------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "ClangTidyTest.h"
10 #include "gtest/gtest.h"
11 #include "objc/ForbiddenSubclassingCheck.h"
13 using namespace clang::tidy::objc
;
19 TEST(ObjCForbiddenSubclassing
, AllowedSubclass
) {
20 std::vector
<ClangTidyError
> Errors
;
21 runCheckOnCode
<ForbiddenSubclassingCheck
>(
24 "@interface Bar : Foo\n"
28 EXPECT_EQ(0ul, Errors
.size());
31 TEST(ObjCForbiddenSubclassing
, ForbiddenSubclass
) {
32 std::vector
<ClangTidyError
> Errors
;
33 runCheckOnCode
<ForbiddenSubclassingCheck
>(
34 "@interface UIImagePickerController\n"
36 "@interface Foo : UIImagePickerController\n"
40 EXPECT_EQ(1ul, Errors
.size());
42 "Objective-C interface 'Foo' subclasses 'UIImagePickerController', which is not intended to be subclassed",
43 Errors
[0].Message
.Message
);