File: basic.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 (88 lines) | stat: -rw-r--r-- 2,509 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
var foo: Int = 0

var bar: Int {
    return 0
}

var qux: Int = 0 {
    willSet { print("hi") }
    didSet { print("bye") }
}

func generic<T>(_: T) -> Int {
    return 0
}

class Foo {
    var foo: Int

    var bar: Int {
        return 0
    }

    var baz: Int {
        get { return 0 }
        set { foo = newValue }
    }

    var qux: Int {
        willSet { print("hi") }
        didSet { print("bye") }
    }

    init() {
        foo = 0
        qux = 1
    }

    func nonGeneric() -> Int {
        return 0
    }

    func generic<T>(_: T) -> Int {
        return 0
    }

    deinit {
        print("bye")
    }
}

extension Foo {
    func nonGeneric2() -> Int {
        return 0
    }

    func generic2<T>(_: T) -> Int {
        return 0
    }
}

// RUN: %empty-directory(%t.result)

// FIXME: we should be able to run on the whole file.
// RUN: not %refactor -replace-bodies-with-fatalError -source-filename %s -pos=1:1 -end-pos=59:2

// RUN: %refactor -replace-bodies-with-fatalError -source-filename %s -pos=3:1 -end-pos=5:2 > %t.result/L3-5.swift
// RUN: diff -u %S/Outputs/basic/L3-5.swift.expected %t.result/L3-5.swift

// RUN: %refactor -replace-bodies-with-fatalError -source-filename %s -pos=7:1 -end-pos=10:2 > %t.result/L7-10.swift
// RUN: diff -u %S/Outputs/basic/L7-10.swift.expected %t.result/L7-10.swift

// RUN: %refactor -replace-bodies-with-fatalError -source-filename %s -pos=8:1 -end-pos=8:28 > %t.result/L8.swift
// RUN: diff -u %S/Outputs/basic/L8.swift.expected %t.result/L8.swift

// RUN: %refactor -replace-bodies-with-fatalError -source-filename %s -pos=12:1 -end-pos=14:2 > %t.result/L12-14.swift
// RUN: diff -u %S/Outputs/basic/L12-14.swift.expected %t.result/L12-14.swift

// RUN: %refactor -replace-bodies-with-fatalError -source-filename %s -pos=16:1 -end-pos=49:2 > %t.result/L16-49.swift
// RUN: diff -u %S/Outputs/basic/L16-49.swift.expected %t.result/L16-49.swift

// RUN: %refactor -replace-bodies-with-fatalError -source-filename %s -pos=19:1 -end-pos=22:1 > %t.result/L19-22.swift
// RUN: diff -u %S/Outputs/basic/L19-22.swift.expected %t.result/L19-22.swift

// RUN: %refactor -replace-bodies-with-fatalError -source-filename %s -pos=30:1 -end-pos=44:6 > %t.result/L30-44.swift
// RUN: diff -u %S/Outputs/basic/L30-44.swift.expected %t.result/L30-44.swift

// RUN: %refactor -replace-bodies-with-fatalError -source-filename %s -pos=51:1 -end-pos=59:2 > %t.result/L51-59.swift
// RUN: diff -u %S/Outputs/basic/L51-59.swift.expected %t.result/L51-59.swift