|
14 | 14 |
|
15 | 15 | @testable import App
|
16 | 16 |
|
17 |
| -import XCTest |
18 | 17 | import ShellOut
|
| 18 | +import Testing |
19 | 19 |
|
20 | 20 |
|
21 |
| -class ShellOutCommandExtensionTests: XCTestCase { |
| 21 | +@Suite struct ShellOutCommandExtensionTests { |
22 | 22 |
|
23 |
| - func test_gitClean() throws { |
24 |
| - XCTAssertEqual(ShellOutCommand.gitClean.description, "git clean -fdx") |
| 23 | + @Test func gitClean() throws { |
| 24 | + #expect(ShellOutCommand.gitClean.description == "git clean -fdx") |
25 | 25 | }
|
26 | 26 |
|
27 |
| - func test_gitCommitCount() throws { |
28 |
| - XCTAssertEqual(ShellOutCommand.gitCommitCount.description, "git rev-list --count HEAD") |
| 27 | + @Test func gitCommitCount() throws { |
| 28 | + #expect(ShellOutCommand.gitCommitCount.description == "git rev-list --count HEAD") |
29 | 29 | }
|
30 | 30 |
|
31 |
| - func test_gitFetch() throws { |
32 |
| - XCTAssertEqual(ShellOutCommand.gitFetchAndPruneTags.description, "git fetch --tags --prune-tags --prune") |
| 31 | + @Test func gitFetch() throws { |
| 32 | + #expect(ShellOutCommand.gitFetchAndPruneTags.description == "git fetch --tags --prune-tags --prune") |
33 | 33 | }
|
34 | 34 |
|
35 |
| - func test_gitFirstCommitDate() throws { |
36 |
| - XCTAssertEqual(ShellOutCommand.gitFirstCommitDate.description, |
37 |
| - #"git log --max-parents=0 -n1 --format=format:"%ct""#) |
| 35 | + @Test func gitFirstCommitDate() throws { |
| 36 | + #expect(ShellOutCommand.gitFirstCommitDate.description == #"git log --max-parents=0 -n1 --format=format:"%ct""#) |
38 | 37 | }
|
39 | 38 |
|
40 |
| - func test_gitLastCommitDate() throws { |
41 |
| - XCTAssertEqual(ShellOutCommand.gitLastCommitDate.description, |
42 |
| - #"git log -n1 --format=format:"%ct""#) |
| 39 | + @Test func gitLastCommitDate() throws { |
| 40 | + #expect(ShellOutCommand.gitLastCommitDate.description == #"git log -n1 --format=format:"%ct""#) |
43 | 41 | }
|
44 | 42 |
|
45 |
| - func test_gitReset() throws { |
46 |
| - XCTAssertEqual(ShellOutCommand.gitReset(hard: true).description, |
47 |
| - "git reset --hard") |
48 |
| - XCTAssertEqual(ShellOutCommand.gitReset(hard: false).description, |
49 |
| - "git reset") |
| 43 | + @Test func gitReset() throws { |
| 44 | + #expect(ShellOutCommand.gitReset(hard: true).description == "git reset --hard") |
| 45 | + #expect(ShellOutCommand.gitReset(hard: false).description == "git reset") |
50 | 46 | }
|
51 | 47 |
|
52 |
| - func test_gitReset_branch() throws { |
53 |
| - XCTAssertEqual(ShellOutCommand.gitReset(to: "foo", hard: true).description, |
54 |
| - "git reset origin/foo --hard") |
55 |
| - XCTAssertEqual(ShellOutCommand.gitReset(to: "foo", hard: false).description, |
56 |
| - "git reset origin/foo") |
| 48 | + @Test func gitReset_branch() throws { |
| 49 | + #expect(ShellOutCommand.gitReset(to: "foo", hard: true).description == "git reset origin/foo --hard") |
| 50 | + #expect(ShellOutCommand.gitReset(to: "foo", hard: false).description == "git reset origin/foo") |
57 | 51 | }
|
58 | 52 |
|
59 |
| - func test_gitRevisionInfo() throws { |
| 53 | + @Test func gitRevisionInfo() throws { |
60 | 54 | let dash = "-"
|
61 |
| - XCTAssertEqual( |
| 55 | + #expect( |
62 | 56 | ShellOutCommand
|
63 |
| - .gitRevisionInfo(reference: .tag(1, 2, 3), separator: dash).description, |
64 |
| - #"git log -n1 --format=tformat:"%H\#(dash)%ct" 1.2.3"# |
| 57 | + .gitRevisionInfo(reference: .tag(1, 2, 3), separator: dash).description == #"git log -n1 --format=tformat:"%H\#(dash)%ct" 1.2.3"# |
65 | 58 | )
|
66 |
| - XCTAssertEqual( |
| 59 | + #expect( |
67 | 60 | ShellOutCommand
|
68 |
| - .gitRevisionInfo(reference: .branch("foo"), separator: dash).description, |
69 |
| - #"git log -n1 --format=tformat:"%H\#(dash)%ct" foo"# |
| 61 | + .gitRevisionInfo(reference: .branch("foo"), separator: dash).description == #"git log -n1 --format=tformat:"%H\#(dash)%ct" foo"# |
70 | 62 | )
|
71 |
| - XCTAssertEqual( |
| 63 | + #expect( |
72 | 64 | ShellOutCommand
|
73 |
| - .gitRevisionInfo(reference: .branch("ba\nd"), separator: dash).description, |
74 |
| - "git log -n1 --format=tformat:\"%H\(dash)%ct\" 'ba\nd'" |
| 65 | + .gitRevisionInfo(reference: .branch("ba\nd"), separator: dash).description == "git log -n1 --format=tformat:\"%H\(dash)%ct\" 'ba\nd'" |
75 | 66 | )
|
76 | 67 | }
|
77 | 68 |
|
78 |
| - func test_gitShowDate() throws { |
79 |
| - XCTAssertEqual(ShellOutCommand.gitShowDate("abc").description, |
80 |
| - #"git show -s --format=%ct abc"#) |
| 69 | + @Test func gitShowDate() throws { |
| 70 | + #expect(ShellOutCommand.gitShowDate("abc").description == #"git show -s --format=%ct abc"#) |
81 | 71 | }
|
82 | 72 |
|
83 |
| - func test_gitListTags() throws { |
84 |
| - XCTAssertEqual(ShellOutCommand.gitListTags.description, "git tag") |
| 73 | + @Test func gitListTags() throws { |
| 74 | + #expect(ShellOutCommand.gitListTags.description == "git tag") |
85 | 75 | }
|
86 | 76 |
|
87 |
| - func test_quoting() throws { |
88 |
| - XCTAssertEqual( |
89 |
| - ShellOutCommand.gitReset(to: "foo ; rm *", hard: false).description, |
90 |
| - "git reset origin/'foo ; rm *'" |
| 77 | + @Test func quoting() throws { |
| 78 | + #expect( |
| 79 | + ShellOutCommand.gitReset(to: "foo ; rm *", hard: false).description == "git reset origin/'foo ; rm *'" |
91 | 80 | )
|
92 |
| - XCTAssertEqual( |
93 |
| - ShellOutCommand.gitRevisionInfo(reference: .branch("foo ; rm *")).description, |
94 |
| - #"git log -n1 --format=tformat:"%H-%ct" 'foo ; rm *'"# |
| 81 | + #expect( |
| 82 | + ShellOutCommand.gitRevisionInfo(reference: .branch("foo ; rm *")).description == #"git log -n1 --format=tformat:"%H-%ct" 'foo ; rm *'"# |
95 | 83 | )
|
96 |
| - XCTAssertEqual( |
97 |
| - ShellOutCommand.gitShowDate("foo ; rm *").description, |
98 |
| - #"git show -s --format=%ct 'foo ; rm *'"# |
| 84 | + #expect( |
| 85 | + ShellOutCommand.gitShowDate("foo ; rm *").description == #"git show -s --format=%ct 'foo ; rm *'"# |
99 | 86 | )
|
100 | 87 | }
|
101 | 88 |
|
|
0 commit comments