Skip to content

Commit 27a7334

Browse files
authored
Merge pull request #85351 from hnrklssn/update-verify-tests
[utils] add update-verify-tests.py
2 parents d5b8dc6 + 0979d34 commit 27a7334

15 files changed

+823
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: not %target-swift-frontend-verify -typecheck %t/test.swift 2>&1 | %update-verify-tests
5+
// RUN: %target-swift-frontend-verify -typecheck %t/test.swift
6+
// RUN: %diff %t/test.swift %t/test.swift.expected
7+
8+
//--- test.swift
9+
func foo() {
10+
11+
//--- test.swift.expected
12+
// expected-note@+1{{to match this opening '{'}}
13+
func foo() {
14+
15+
// expected-error@+1{{expected '}' at end of brace statement}}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: not %target-swift-frontend-verify -typecheck %t/test.swift 2>&1 | %update-verify-tests
5+
// RUN: %target-swift-frontend-verify -typecheck %t/test.swift
6+
// RUN: %diff %t/test.swift %t/test.swift.expected
7+
8+
//--- test.swift
9+
func foo() {
10+
// expected-error@+1{{cannot find 'a' in scope}}
11+
a = 2; a = 2;
12+
b = 2; b = 2;
13+
14+
// expected-error@+1 3{{cannot find 'c' in scope}}
15+
c = 2; c = 2;
16+
// expected-error 3{{asdf}}
17+
}
18+
//--- test.swift.expected
19+
func foo() {
20+
// expected-error@+1 2{{cannot find 'a' in scope}}
21+
a = 2; a = 2;
22+
// expected-error@+1 2{{cannot find 'b' in scope}}
23+
b = 2; b = 2;
24+
25+
// expected-error@+1 2{{cannot find 'c' in scope}}
26+
c = 2; c = 2;
27+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: not %target-swift-frontend-verify -typecheck %t/test.swift 2>&1 | %update-verify-tests
5+
// RUN: %target-swift-frontend-verify -typecheck %t/test.swift
6+
// RUN: %diff %t/test.swift %t/test.swift.expected
7+
8+
//--- test.swift
9+
func foo() {
10+
// expected-error@+1 2{{cannot find 'a' in scope}}
11+
a = 2; a = 2; b = 2; b = 2; c = 2;
12+
// expected-error@+1 2{{asdf}}
13+
d = 2;
14+
e = 2; f = 2; // expected-error 2{{cannot find 'e' in scope}}
15+
}
16+
17+
//--- test.swift.expected
18+
func foo() {
19+
// expected-error@+3 {{cannot find 'c' in scope}}
20+
// expected-error@+2 2{{cannot find 'b' in scope}}
21+
// expected-error@+1 2{{cannot find 'a' in scope}}
22+
a = 2; a = 2; b = 2; b = 2; c = 2;
23+
// expected-error@+1 {{cannot find 'd' in scope}}
24+
d = 2;
25+
// expected-error@+1 {{cannot find 'f' in scope}}
26+
e = 2; f = 2; // expected-error {{cannot find 'e' in scope}}
27+
}
28+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: not %target-swift-frontend-verify -typecheck %t/test.swift 2>&1 | %update-verify-tests
5+
// RUN: %target-swift-frontend-verify -typecheck %t/test.swift
6+
// RUN: %diff %t/test.swift %t/test.swift.expected
7+
8+
//--- test.swift
9+
func foo() {
10+
a = 2;
11+
// expected-error@-1{{cannot find 'a' in scope}}
12+
b = 2;// expected-error{{cannot find 'b' in scope}}
13+
c = 2;
14+
// expected-error@5{{cannot find 'c' in scope}}
15+
d = 2; // expected-error{{'d' in scope}}
16+
17+
e = 2; // error to trigger mismatch
18+
}
19+
20+
//--- test.swift.expected
21+
func foo() {
22+
a = 2;
23+
// expected-error@-1{{cannot find 'a' in scope}}
24+
b = 2;// expected-error{{cannot find 'b' in scope}}
25+
c = 2;
26+
// expected-error@5{{cannot find 'c' in scope}}
27+
d = 2; // expected-error{{'d' in scope}}
28+
29+
// expected-error@+1{{cannot find 'e' in scope}}
30+
e = 2; // error to trigger mismatch
31+
}
32+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: not %target-swift-frontend-verify -typecheck %t/test.swift 2>&1 | %update-verify-tests
5+
// RUN: %target-swift-frontend-verify -typecheck %t/test.swift
6+
// RUN: %diff %t/test.swift %t/test.swift.expected
7+
8+
//--- test.swift
9+
func foo() {
10+
a = 2
11+
b = 2
12+
13+
c = 2
14+
}
15+
//--- test.swift.expected
16+
func foo() {
17+
// expected-error@+1{{cannot find 'a' in scope}}
18+
a = 2
19+
// expected-error@+1{{cannot find 'b' in scope}}
20+
b = 2
21+
22+
// expected-error@+1{{cannot find 'c' in scope}}
23+
c = 2
24+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: not %target-swift-frontend-verify -typecheck %t/test.swift 2>&1 | %update-verify-tests
5+
// RUN: %target-swift-frontend-verify -typecheck %t/test.swift
6+
// RUN: %diff %t/test.swift %t/test.swift.expected
7+
8+
//--- test.swift
9+
func foo() {
10+
a = 2; b = 2; c = 2;
11+
}
12+
13+
func bar() {
14+
x = 2; y = 2; z = 2;
15+
// expected-error@-1{{cannot find 'x' in scope}}
16+
}
17+
//--- test.swift.expected
18+
func foo() {
19+
// expected-error@+3{{cannot find 'c' in scope}}
20+
// expected-error@+2{{cannot find 'b' in scope}}
21+
// expected-error@+1{{cannot find 'a' in scope}}
22+
a = 2; b = 2; c = 2;
23+
}
24+
25+
func bar() {
26+
x = 2; y = 2; z = 2;
27+
// expected-error@-1{{cannot find 'x' in scope}}
28+
// expected-error@-2{{cannot find 'y' in scope}}
29+
// expected-error@-3{{cannot find 'z' in scope}}
30+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: not %target-swift-frontend-verify -typecheck %t/test.swift 2>&1 | %update-verify-tests
5+
// RUN: %target-swift-frontend-verify -typecheck %t/test.swift
6+
// RUN: %diff %t/test.swift %t/test.swift.expected
7+
8+
//--- test.swift
9+
func foo() {
10+
bar = 2
11+
}
12+
//--- test.swift.expected
13+
func foo() {
14+
// expected-error@+1{{cannot find 'bar' in scope}}
15+
bar = 2
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: not %target-swift-frontend-verify -typecheck %t/test.swift 2>&1 | %update-verify-tests
5+
// RUN: %target-swift-frontend-verify -typecheck %t/test.swift
6+
// RUN: %diff %t/test.swift %t/test.swift.expected
7+
8+
//--- test.swift
9+
func foo() {
10+
// expected-error@+1{{asdf}}
11+
let _ = 2
12+
}
13+
//--- test.swift.expected
14+
func foo() {
15+
let _ = 2
16+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: not %target-swift-frontend-verify -verify-additional-prefix check- -typecheck %t/test.swift 2>&1 | %update-verify-tests --prefix check-
5+
// RUN: %target-swift-frontend-verify -typecheck %t/test.swift -verify-additional-prefix check-
6+
// RUN: %diff %t/test.swift %t/test.swift.expected
7+
8+
//--- test.swift
9+
func foo() {
10+
a = 2
11+
// expected-check-error{{foo}}
12+
// expected-error{{bar}}
13+
14+
// expected-error@+1{{baz}}
15+
b = 3
16+
}
17+
//--- test.swift.expected
18+
func foo() {
19+
// expected-check-error@+1{{cannot find 'a' in scope}}
20+
a = 2
21+
22+
// expected-error@+1{{cannot find 'b' in scope}}
23+
b = 3
24+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: not %target-swift-frontend-verify -typecheck %t/test.swift 2>&1 | %update-verify-tests
5+
// RUN: %target-swift-frontend-verify -typecheck %t/test.swift
6+
// RUN: %diff %t/test.swift %t/test.swift.expected
7+
8+
//--- test.swift
9+
func foo() {
10+
bar = 2 // expected-error {{asdf}}
11+
}
12+
13+
//--- test.swift.expected
14+
func foo() {
15+
bar = 2 // expected-error {{cannot find 'bar' in scope}}
16+
}
17+

0 commit comments

Comments
 (0)