Skip to content

Commit 4984c96

Browse files
committed
fix tests for FileCheck behaviour (DAG edition)
FileCheck does not support the combination negation. These tests were incorrect and silently passing rather than checking what they intended.
1 parent fd7c2fb commit 4984c96

8 files changed

+96
-49
lines changed

test/IDE/complete_call_arg.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,21 +208,25 @@ class C3 {
208208
// OVERLOAD2-NEXT: End completions
209209

210210
// OVERLOAD3: Begin completions
211+
// OVERLOAD3-DAG: Decl[InstanceVar]/CurrNominal: C1I[#C1#]; name=C1I
212+
// OVERLOAD3-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: f1()[#Void#]; name=f1()
211213
// OVERLOAD3-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Identical]: C2I[#C2#]; name=C2I
212214
// OVERLOAD3-DAG: Decl[Class]/CurrModule/TypeRelation[Identical]: C2[#C2#]
213-
// OVERLOAD3-DAG-NOT: Decl[Class]{{.*}} C1
214-
// OVERLOAD3-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: f1()[#Void#]; name=f1()
215-
// OVERLOAD3-DAG: Decl[InstanceVar]/CurrNominal: C1I[#C1#]; name=C1I
216215
// OVERLOAD3: End completions
217216

217+
// FIXME: This should be a negative test case
218+
// NEGATIVE_OVERLOAD_3-NOT: Decl[Class]{{.*}} C1
219+
218220
// OVERLOAD4: Begin completions
219221
// OVERLOAD4-DAG: Decl[InstanceVar]/CurrNominal/TypeRelation[Identical]: C1I[#C1#]; name=C1I
222+
// OVERLOAD4-DAG: Decl[InstanceVar]/CurrNominal: C2I[#C2#]; name=C2I
220223
// OVERLOAD4-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: f1()[#Void#]; name=f1()
221224
// OVERLOAD4-DAG: Decl[Class]/CurrModule/TypeRelation[Identical]: C1[#C1#]
222-
// OVERLOAD4-DAG-NOT: Decl[Class]{{.*}} C2
223-
// OVERLOAD4-DAG: Decl[InstanceVar]/CurrNominal: C2I[#C2#]; name=C2I
224225
// OVERLOAD4: End completions
225226

227+
// FIXME: This should be a negative test case
228+
// NEGATIVE_OVERLOAD4-NOT: Decl[Class]{{.*}} C2
229+
226230
class C4 {
227231
func f1(G : Gen) {
228232
foo(1, b1: G.#^MEMBER1^#

test/IDE/complete_default_arguments.swift

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@
88
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_5 | FileCheck %s -check-prefix=DEFAULT_ARGS_5
99
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_6 | FileCheck %s -check-prefix=DEFAULT_ARGS_6
1010
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_7 | FileCheck %s -check-prefix=DEFAULT_ARGS_7
11-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_8 | FileCheck %s -check-prefix=DEFAULT_ARGS_8
12-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_9 | FileCheck %s -check-prefix=DEFAULT_ARGS_9
11+
//
12+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_8 > %t
13+
// RUN: FileCheck %s -check-prefix=DEFAULT_ARGS_8 < %t
14+
// RUN: FileCheck %s -check-prefix=NEGATIVE_DEFAULT_ARGS_8 < %t
15+
//
16+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_9 > %t
17+
// RUN: FileCheck %s -check-prefix=DEFAULT_ARGS_9 < %t
18+
// RUN: FileCheck %s -check-prefix=NEGATIVE_DEFAULT_ARGS_9 < %t
19+
//
1320
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_1 | FileCheck %s -check-prefix=DEFAULT_ARG_INIT
1421
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_2 | FileCheck %s -check-prefix=DEFAULT_ARG_INIT
1522
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_3 | FileCheck %s -check-prefix=DEFAULT_ARG_INIT
@@ -111,19 +118,19 @@ func testDefaultArgs8(x: C1) {
111118
// DEFAULT_ARGS_8: Begin completions
112119
// DEFAULT_ARGS_8-DAG: Decl[InstanceMethod]/CurrNominal: methodWithDefaultArgs1()[#Void#]{{; name=.+$}}
113120
// DEFAULT_ARGS_8-DAG: Decl[InstanceMethod]/CurrNominal: methodWithDefaultArgs1({#a: Int#})[#Void#]{{; name=.+$}}
114-
// DEFAULT_ARGS_8-DAG-NOT: methodWithDefaultArgsInSub1()
115121
// DEFAULT_ARGS_8-DAG: Decl[InstanceMethod]/CurrNominal: methodWithDefaultArgsInSub1({#(a): Int#})[#Void#]{{; name=.+$}}
116122
// DEFAULT_ARGS_8: End completions
123+
// NEGATIVE_DEFAULT_ARGS_8-NOT: methodWithDefaultArgsInSub1()
117124

118125
func testDefaultArgs9(x: C2) {
119126
x.#^DEFAULT_ARGS_9^#
120127
}
121128
// DEFAULT_ARGS_9: Begin completions
122-
// DEFAULT_ARGS_9-DAG-NOT: methodWithDefaultArgs1()
123129
// DEFAULT_ARGS_9-DAG: Decl[InstanceMethod]/CurrNominal: methodWithDefaultArgs1({#a: Int#})[#Void#]{{; name=.+$}}
124130
// DEFAULT_ARGS_9-DAG: Decl[InstanceMethod]/CurrNominal: methodWithDefaultArgsInSub1()[#Void#]{{; name=.+$}}
125131
// DEFAULT_ARGS_9-DAG: Decl[InstanceMethod]/CurrNominal: methodWithDefaultArgsInSub1({#(a): Int#})[#Void#]{{; name=.+$}}
126132
// DEFAULT_ARGS_9: End completions
133+
// NEGATIVE_DEFAULT_ARGS_9-NOT: methodWithDefaultArgs1()
127134

128135
let globalVar = 1
129136
func testDefaultArgInit1(x = #^DEFAULT_ARG_INIT_1^#) { }

test/IDE/complete_dynamic_lookup.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ protocol Bar { func bar() }
108108
// DL_INSTANCE_NO_DOT-DAG: Decl[InstanceVar]/OtherModule[swift_ide_test]: .nested1_Property1[#Int?#]{{; name=.+$}}
109109
// DL_INSTANCE_NO_DOT-DAG: Decl[InstanceMethod]/OtherModule[swift_ide_test]: .nested2_ObjcInstanceFunc1!()[#Void#]{{; name=.+$}}
110110
// DL_INSTANCE_NO_DOT-DAG: Decl[InstanceVar]/OtherModule[swift_ide_test]: .nested2_Property[#Int?#]{{; name=.+$}}
111-
// DL_INSTANCE_NO_DOT-DAG-NOT:.objectAtIndexedSubscript
112111
// DL_INSTANCE_NO_DOT-DAG: Decl[InstanceMethod]/OtherModule[swift_ide_test]: .returnsObjcClass!({#(i): Int#})[#TopLevelObjcClass#]{{; name=.+$}}
113112
// DL_INSTANCE_NO_DOT-DAG: Decl[InstanceMethod]/OtherModule[swift_ide_test]: .topLevelClass_ObjcInstanceFunc1!()[#Void#]{{; name=.+$}}
114113
// DL_INSTANCE_NO_DOT-DAG: Decl[InstanceVar]/OtherModule[swift_ide_test]: .topLevelClass_ObjcProperty1[#Int?#]{{; name=.+$}}
@@ -127,6 +126,7 @@ protocol Bar { func bar() }
127126
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[baz_clang_module]: [{#Int32#}][#AnyObject!?#]{{; name=.+$}}
128127
// DL_INSTANCE_NO_DOT-DAG: Decl[Subscript]/OtherModule[baz_clang_module]: [{#AnyObject!#}][#AnyObject!?#]{{; name=.+$}}
129128
// DL_INSTANCE_NO_DOT: End completions
129+
// GLOBAL_NEGATIVE-NOT:.objectAtIndexedSubscript
130130

131131
// DL_INSTANCE_DOT: Begin completions
132132
// DL_INSTANCE_DOT-DAG: Decl[InstanceMethod]/OtherModule[bar_swift_module]: bar_ImportedObjcClass_InstanceFunc1!()[#Void#]{{; name=.+$}}

test/IDE/complete_from_stdlib.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88

99
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_2B > %t.members2a.txt
1010
// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_2 < %t.members2a.txt
11+
// RUN: FileCheck %s -check-prefix=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2 < %t.members2a.txt
1112
// FIXME: filter?
1213
// RUN-disabled: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members2a.txt
1314

1415
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_2B > %t.members2b.txt
1516
// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_2 < %t.members2b.txt
17+
// RUN: FileCheck %s -check-prefix=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2 < %t.members2b.txt
1618
// FIXME: filter?
1719
// RUN-disabled: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members2b.txt
1820

1921
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_3 > %t.members3.txt
2022
// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_3 < %t.members3.txt
23+
// RUN: FileCheck %s -check-prefix=NEGATIVE_PRIVATE_NOMINAL_MEMBERS_3 < %t.members3.txt
2124
// FIXME: filter?
2225
// RUN-disabled: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members3.txt
2326

@@ -55,7 +58,10 @@
5558
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POSTFIX_INT_2 | FileCheck %s -check-prefix=POSTFIX_LVALUE_INT
5659
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POSTFIX_OPTIONAL_1 | FileCheck %s -check-prefix=POSTFIX_OPTIONAL
5760

58-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_INT_1 | FileCheck %s -check-prefix=INFIX_INT
61+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_INT_1 > %t
62+
// RUN: FileCheck %s -check-prefix=INFIX_INT < %t
63+
// RUN: FileCheck %s -check-prefix=NEGATIVE_INFIX_INT < %t
64+
5965
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_INT_2 | FileCheck %s -check-prefix=INFIX_LVALUE_INT
6066
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_STRING_1 | FileCheck %s -check-prefix=INFIX_STRING
6167
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INFIX_EXT_STRING_1 | FileCheck %s -check-prefix=INFIX_EXT_STRING
@@ -91,8 +97,8 @@ func protocolExtCollection1b(a: Collection) {
9197

9298
// PRIVATE_NOMINAL_MEMBERS_2: Begin completions
9399
// PRIVATE_NOMINAL_MEMBERS_2-DAG: map({#(transform): (Self.Iterator.Element) throws -> T##(Self.Iterator.Element) throws -> T#})[' rethrows'][#[T]#]{{; name=.+}}
94-
// PRIVATE_NOMINAL_MEMBERS_2-DAG-NOT: Decl{{.*}}: last
95100
// PRIVATE_NOMINAL_MEMBERS_2: End completions
101+
// NEGATIVE_PRIVATE_NOMINAL_MEMBERS_2-NOT: Decl{{.*}}: last
96102

97103
func protocolExtCollection2<C : Collection where C.Index : BidirectionalIndex>(a: C) {
98104
a.#^PRIVATE_NOMINAL_MEMBERS_3^#
@@ -101,9 +107,9 @@ func protocolExtCollection2<C : Collection where C.Index : BidirectionalIndex>(a
101107
// PRIVATE_NOMINAL_MEMBERS_3: Begin completions
102108
// PRIVATE_NOMINAL_MEMBERS_3-DAG: Decl[InstanceMethod]/Super: map({#(transform): (C.Iterator.Element) throws -> T##(C.Iterator.Element) throws -> T#})[' rethrows'][#[T]#]{{; name=.+}}
103109
// PRIVATE_NOMINAL_MEMBERS_3-DAG: Decl[InstanceVar]/Super: last[#C.Iterator.Element?#]{{; name=.+}}
104-
// PRIVATE_NOMINAL_MEMBERS_3-DAG-NOT: Decl{{.*}}: index({#({{.*}}): Self.Iterator.Element
105110
// PRIVATE_NOMINAL_MEMBERS_3-DAG: index({#where: (C.Iterator.Element) throws -> Bool##(C.Iterator.Element) throws -> Bool#})[' rethrows'][#C.Index?#]{{; name=.+}}
106111
// PRIVATE_NOMINAL_MEMBERS_3: End completions
112+
// NEGATIVE_PRIVATE_NOMINAL_MEMBERS_3-NOT: Decl{{.*}}: index({#({{.*}}): Self.Iterator.Element
107113

108114
func protocolExtArray<T : Equatable>(a: [T]) {
109115
a.#^PRIVATE_NOMINAL_MEMBERS_4^#
@@ -244,9 +250,9 @@ func testInfixOperator1(x: Int) {
244250
// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: << {#Int#}[#Int#]
245251
// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: < {#Int#}[#Bool#]
246252
// INFIX_INT-DAG: Decl[InfixOperatorFunction]/OtherModule[Swift]: == {#Int#}[#Bool#]
247-
// INFIX_INT-DAG-NOT: &&
248-
// INFIX_INT-DAG-NOT: +=
249253
// INFIX_INT: End completions
254+
// NEGATIVE_INFIX_INT-NOT: &&
255+
// NEGATIVE_INFIX_INT-NOT: +=
250256
func testInfixOperator2(var x: Int) {
251257
x#^INFIX_INT_2^#
252258
}

test/IDE/complete_from_swift_module.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
// RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=MODULE_QUALIFIED_5 | FileCheck %s -check-prefix=ERROR_COMMON
2424

25-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=POSTFIX_OPERATOR_1 | FileCheck %s -check-prefix=POSTFIX_OPERATOR_1
25+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=POSTFIX_OPERATOR_1 > %t.compl.txt
26+
// RUN: FileCheck %s -check-prefix=POSTFIX_OPERATOR_1 < %t.compl.txt
27+
// RUN: FileCheck %s -check-prefix=NEGATIVE_POSTFIX_OPERATOR_1 < %t.compl.txt
2628

2729
// RUN: %target-swift-ide-test -code-completion -source-filename %s -I %t -code-completion-token=TOP_LEVEL_1 > %t.compl.txt
2830
// RUN: FileCheck %s -check-prefix=TOP_LEVEL_1 < %t.compl.txt
@@ -88,8 +90,8 @@ func testPostfixOperator1(x: Int) {
8890
// POSTFIX_OPERATOR_1: Begin completions
8991
// POSTFIX_OPERATOR_1-DAG: Decl[PostfixOperatorFunction]/OtherModule[foo_swift_module]: =>[#Int#]
9092
// POSTFIX_OPERATOR_1-DAG: Decl[InfixOperatorFunction]/OtherModule[foo_swift_module]: %%% {#Int#}[#Int#]
91-
// POSTFIX_OPERATOR_1-DAG-NOT: =->
9293
// POSTFIX_OPERATOR_1: End completions
94+
// NEGATIVE_POSTFIX_OPERATOR_1-NOT: =->
9395

9496
#^TOP_LEVEL_1^#
9597
// TOP_LEVEL_1: Begin completions

test/IDE/complete_init.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
// RUN: sed -n -e '1,/NO_ERRORS_UP_TO_HERE$/ p' %s > %t_no_errors.swift
22
// RUN: %target-swift-frontend -parse -verify %t_no_errors.swift
33

4-
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=TOP_LEVEL_0 | FileCheck %s -check-prefix=TOP_LEVEL_0
4+
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=TOP_LEVEL_0 > %t
5+
// RUN: FileCheck %s -check-prefix=TOP_LEVEL_0 < %t
6+
// RUN: FileCheck %s -check-prefix=NEGATIVE_TOP_LEVEL_0 < %t
7+
58
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=TOP_LEVEL_1 > %t.generic
69
// RUN: FileCheck %s -check-prefix=TOP_LEVEL_0 < %t.generic
710
// RUN: FileCheck %s -check-prefix=GENERIC_PARAM_0 < %t.generic
811
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=K_QUALIFIED_0 | FileCheck %s -check-prefix=K_QUALIFIED_0
912
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=L_QUALIFIED_0 | FileCheck %s -check-prefix=L_QUALIFIED_0
13+
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=L_QUALIFIED_0 | FileCheck %s -check-prefix=NEGATIVE_L_QUALIFIED_0
1014
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=INSIDE_L_0 | FileCheck %s -check-prefix=INSIDE_L_0
1115
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-complete-inits-in-postfix-expr -code-completion-token=INSIDE_M_0 | FileCheck %s -check-prefix=INSIDE_M_0
1216
// RUN: %target-swift-ide-test -code-completion -source-filename=%s -code-completion-token=ALIAS_CONSTRUCTOR_0 | FileCheck %s -check-prefix=ALIAS_CONSTRUCTOR_0
@@ -75,7 +79,6 @@ func testTopLevel() {
7579
// TOP_LEVEL_0-DAG: Decl[Constructor]/CurrModule: C({#y: A#})[#C#]{{; name=.+}}
7680
// TOP_LEVEL_0-DAG: Decl[Constructor]/CurrModule: D()[#D#]{{; name=.+}}
7781
// TOP_LEVEL_0-DAG: Decl[Constructor]/CurrModule: E({#x: A#})[#E#]{{; name=.+}}
78-
// TOP_LEVEL_0-DAG-NOT: Decl[Constructor]/CurrModule: E()
7982
// TOP_LEVEL_0-DAG: Decl[Constructor]/CurrModule: F({#x: A#})[#F#]{{; name=.+}}
8083
// TOP_LEVEL_0-DAG: Decl[Constructor]/CurrModule: F()[#F#]{{; name=.+}}
8184
// TOP_LEVEL_0-DAG: Decl[Constructor]/CurrModule: G({#x: A#})[#Self#]{{; name=.+}}
@@ -84,6 +87,7 @@ func testTopLevel() {
8487
// TOP_LEVEL_0-DAG: Decl[Constructor]/CurrModule: I({#y: A#})[#Self#]{{; name=.+}}
8588
// TOP_LEVEL_0-DAG: Decl[Constructor]/CurrModule: J()[#A#]{{; name=.+}}
8689
// TOP_LEVEL_0: End completions
90+
// NEGATIVE_TOP_LEVEL_0-NOT: Decl[Constructor]/CurrModule: E()
8791

8892
func testQualified0() {
8993
K.#^K_QUALIFIED_0^#
@@ -98,8 +102,8 @@ func testQualified1() {
98102
}
99103
// L_QUALIFIED_0: Begin completions
100104
// L_QUALIFIED_0-DAG: Decl[Constructor]/CurrNominal: Y({#x: A#})[#L<τ_0_0>.Type#]{{; name=.+}}
101-
// L_QUALIFIED_0-DAG-NOT: X({#x: A#})
102105
// L_QUALIFIED_0: End completions
106+
// NEGATIVE_L_QUALIFIED_0-NOT: X({#x: A#})
103107

104108
func testGenericParam<T: I, U: G>() {
105109
#^TOP_LEVEL_1^#
@@ -108,7 +112,7 @@ func testGenericParam<T: I, U: G>() {
108112
// GENERIC_PARAM_0-DAG: Decl[Constructor]/Local: T({#x: A#})[#Self#]{{; name=.+}}
109113
// GENERIC_PARAM_0-DAG: Decl[Constructor]/Local: T({#y: A#})[#Self#]{{; name=.+}}
110114
// GENERIC_PARAM_0-DAG: Decl[Constructor]/Local: U({#x: A#})[#Self#]{{; name=.+}}
111-
// GENERIC_PARAM_0-DAG-NOT: Decl[Constructor]/Local: U({#y
115+
// GENERIC_PARAM_0-NOT: Decl[Constructor]/Local: U({#y
112116
// GENERIC_PARAM_0: End completions
113117

114118
extension L {

0 commit comments

Comments
 (0)