Rewrite testcase to not depend on Foundation implementation details.

TODO: Add a separate testcase testing *only* Foundation implementation details!

<rdar://problem/37252738>

llvm-svn: 324655
This commit is contained in:
Adrian Prantl 2018-02-08 21:52:28 +00:00
parent 606cf6f64f
commit 244cccfce8
7 changed files with 22 additions and 31 deletions

View File

@ -4,5 +4,5 @@ OBJC_SOURCES := main.m myModule.m
include $(LEVEL)/Makefile.rules
CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS) -I$(PWD)
CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS)
LDFLAGS += -framework Foundation

View File

@ -22,15 +22,12 @@ class IncompleteModulesTestCase(TestBase):
# Find the line number to break inside main().
self.line = line_number('main.m', '// Set breakpoint 0 here.')
@skipIfDarwin
@skipUnlessDarwin
@skipIf(macos_version=["<", "10.12"], debug_info=no_match(["gmodules"]))
@skipIf(debug_info=no_match(["gmodules"]))
def test_expr(self):
self.build()
exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
lldbutil.run_break_set_by_file_and_line(
self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
@ -54,14 +51,14 @@ class IncompleteModulesTestCase(TestBase):
substrs=["int", "3"])
self.expect(
"expr [myObject privateMethod]",
"expr private_func()",
VARIABLES_DISPLAYED_CORRECTLY,
substrs=[
"int",
"5"])
self.expect("expr MIN(2,3)", "#defined macro was found",
self.expect("expr MY_MIN(2,3)", "#defined macro was found",
substrs=["int", "2"])
self.expect("expr MAX(2,3)", "#undefd macro was correcltly not found",
self.expect("expr MY_MAX(2,3)", "#undefd macro was correctly not found",
error=True)

View File

@ -1,11 +1,7 @@
@import Foundation;
@import myModule;
@import minmax;
int main()
{
@autoreleasepool
{
MyClass *myObject = [MyClass alloc];
[myObject publicMethod]; // Set breakpoint 0 here.
}
int main(int argc, char **argv) {
public_func(); // Set breakpoint 0 here.
return 0;
}

View File

@ -0,0 +1,2 @@
#define MY_MIN(A, B) (((A) < (B)) ? (A) : (B))
#define MY_MAX(A, B) (((A) < (B)) ? (B) : (A))

View File

@ -2,3 +2,8 @@ module myModule {
header "myModule.h"
export *
}
module minmax {
header "minmax.h"
export *
}

View File

@ -1,8 +1,5 @@
@import Foundation;
@import minmax;
#undef MAX
#undef MY_MAX
@interface MyClass : NSObject {
};
-(void)publicMethod;
@end
extern void public_func();

View File

@ -1,14 +1,8 @@
#include "myModule.h"
#include "stdio.h"
@implementation MyClass {
};
-(void)publicMethod {
printf("Hello public!\n");
}
-(int)privateMethod {
printf("Hello private!\n");
void public_func() {}
int private_func() {
return 5;
}
@end