forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tokens_nul.swift
28 lines (24 loc) · 891 Bytes
/
tokens_nul.swift
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
// RUN: cat %s | tr '\132' '\0' > %t.tmp
// RUN: cp -f %t.tmp %t
// RUN: %swift-syntax-test -input-source-filename %t -dump-full-tokens 2>&1 | %FileCheck %t
let a = Z3Z // nul(Z)
func b() {}
// CHECK: 4:9: warning: nul character embedded in middle of file
// CHECK: 4:11: warning: nul character embedded in middle of file
// CHECK: 4:20: warning: nul character embedded in middle of file
// CHECK-LABEL: 4:7
// CHECK-NEXT:(Token equal
// CHECK-NEXT: (text="=")
// CHECK-NEXT: (trivia space 1)
// CHECK-NEXT: (trivia garbageText \000))
// CHECK-LABEL: 4:10
// CHECK-NEXT:(Token integer_literal
// CHECK-NEXT: (text="3")
// CHECK-NEXT: (trivia garbageText \000)
// CHECK-NEXT: (trivia space 1))
// CHECK-LABEL: 5:1
// CHECK-NEXT:(Token kw_func
// CHECK-NEXT: (trivia lineComment // nul(\000))
// CHECK-NEXT: (trivia newline 1)
// CHECK-NEXT: (text="func")
// CHECK-NEXT: (trivia space 1))