mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
41 lines
818 B
Swift
41 lines
818 B
Swift
// RUN: %target-run-simple-swift
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: OS=macosx
|
|
// REQUIRES: objc_interop
|
|
|
|
import Foundation
|
|
import StdlibUnittest
|
|
import SwiftSyntax
|
|
import SwiftLang
|
|
|
|
var ParseFile = TestSuite("ParseFile")
|
|
|
|
struct Foo {
|
|
public let x: Int
|
|
private(set) var y: [Bool]
|
|
}
|
|
|
|
#if os(macOS)
|
|
class Test: NSObject {
|
|
@objc var bar: Int = 0
|
|
func test() {
|
|
print(#selector(function))
|
|
print(#keyPath(bar))
|
|
}
|
|
@objc func function() {
|
|
}
|
|
}
|
|
#endif
|
|
|
|
ParseFile.test("ParseSingleFile") {
|
|
let currentFile = URL(fileURLWithPath: #file)
|
|
expectDoesNotThrow({
|
|
let currentFileContents = try String(contentsOf: currentFile)
|
|
let parsed = try SourceFileSyntax.decodeSourceFileSyntax(try
|
|
SwiftLang.parse(currentFile))
|
|
expectEqual("\(parsed)", currentFileContents)
|
|
})
|
|
}
|
|
|
|
runAllTests()
|