File: serialized-diagnostics-batch-mode.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (40 lines) | stat: -rw-r--r-- 2,303 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// RUN: rm -f %t.*

// The `-serialize-diagnostics-path` flag is not allowed for batch mode invoked by swiftc
// RUN: not %target-swiftc_driver -serialize-diagnostics-path %t.notexpected.dia %s %S/Inputs/serialized-diagnostics-batch-mode-helper.swift -c -o %t.o 2>&1 | %FileCheck %s
// CHECK: error: option '-serialize-diagnostics-path' is not supported by 'swiftc'; did you mean to use 'swift'?
// RUN: not ls %t.notexpected.dia > /dev/null
// RUN: not ls %t.o > /dev/null


// RUN: not %target-swift-frontend -typecheck -primary-file %s  -serialize-diagnostics-path %t.main.dia -primary-file %S/Inputs/serialized-diagnostics-batch-mode-helper.swift  -serialize-diagnostics-path %t.helper.dia %S/Inputs/serialized-diagnostics-batch-mode-other.swift 2> %t.stderr.txt
// RUN: %FileCheck -check-prefix=CHECK-STDERR %s < %t.stderr.txt
// RUN: %FileCheck -check-prefix=NEGATIVE-STDERR %s < %t.stderr.txt

// RUN: c-index-test -read-diagnostics %t.main.dia 2> %t.main.txt
// RUN: %FileCheck -check-prefix=CHECK-MAIN %s < %t.main.txt
// RUN: %FileCheck -check-prefix=NEGATIVE-MAIN %s < %t.main.txt

// RUN: c-index-test -read-diagnostics %t.helper.dia 2> %t.helper.txt
// RUN: %FileCheck -check-prefix=CHECK-HELPER %s < %t.helper.txt
// RUN: %FileCheck -check-prefix=NEGATIVE-HELPER %s < %t.helper.txt

// NEGATIVE-MAIN-NOT: shouldNotShowUpInOutput
// NEGATIVE-HELPER-NOT: shouldNotShowUpInOutput
// NEGATIVE-STDERR-NOT: shouldNotShowUpInOutput

// NEGATIVE-MAIN-NOT: serialized-diagnostics-batch-mode-helper.swift
// NEGATIVE-HELPER-NOT: serialized-diagnostics-batch-mode.swift

// NEGATIVE-MAIN-NOT: invalid redeclaration of 'foo()'
// NEGATIVE-HELPER-NOT: invalid redeclaration of 'foo()'
// NEGATIVE-STDERR-NOT: invalid redeclaration of 'foo()'

func test() {
  nonexistent() // CHECK-MAIN-DAG: serialized-diagnostics-batch-mode.swift:[[@LINE]]:3: error: cannot find 'nonexistent' in scope
  // CHECK-STDERR-DAG: serialized-diagnostics-batch-mode.swift:[[@LINE-1]]:3: error: cannot find 'nonexistent' in scope

  // The other file has a similar call.
  // CHECK-HELPER-DAG: serialized-diagnostics-batch-mode-helper.swift:{{[0-9]+}}:3: error: cannot find 'nonexistent' in scope
  // CHECK-STDERR-DAG: serialized-diagnostics-batch-mode-helper.swift:{{[0-9]+}}:3: error: cannot find 'nonexistent' in scope
}