|
1 | 1 | import EventKit |
| 2 | +import Testing |
2 | 3 |
|
3 | 4 | @testable import plan |
4 | | -import XCTest |
5 | 5 |
|
6 | | -final class CalendarFilterTests: XCTestCase { |
7 | | - func testAlwaysAccept() { |
| 6 | +@Suite final class CalendarFilterTests { |
| 7 | + @Test func testAlwaysAccept() { |
8 | 8 | let calendar = PlanCalendar.generate() |
9 | 9 | let expected = true |
10 | 10 | let actual = CalendarFilter.Accept().accept(calendar) |
11 | 11 |
|
12 | | - XCTAssertEqual(actual, expected, "The calendar was not accepted") |
| 12 | + #expect(actual == expected, "The calendar was not accepted") |
13 | 13 | } |
14 | 14 |
|
15 | | - func testSelectCalendarsMatching() { |
| 15 | + @Test func testSelectCalendarsMatching() { |
16 | 16 | let calendar = PlanCalendar.generate() |
17 | 17 | let expected = true |
18 | 18 | let actual = CalendarFilter.Select(uuids: [calendar.id]).accept(calendar) |
19 | 19 |
|
20 | | - XCTAssertEqual(actual, expected, "The calendar was not accepted") |
| 20 | + #expect(actual == expected, "The calendar was not accepted") |
21 | 21 | } |
22 | 22 |
|
23 | | - func testSelectCalendarsEmptyArray() { |
| 23 | + @Test func testSelectCalendarsEmptyArray() { |
24 | 24 | let calendar = PlanCalendar.generate() |
25 | 25 | let expected = true |
26 | 26 | let actual = CalendarFilter.Select(uuids: []).accept(calendar) |
27 | 27 |
|
28 | | - XCTAssertEqual(actual, expected, "The calendar was not accepted") |
| 28 | + #expect(actual == expected, "The calendar was not accepted") |
29 | 29 | } |
30 | 30 |
|
31 | | - func testIgnoreCalendarsMatching() { |
| 31 | + @Test func testIgnoreCalendarsMatching() { |
32 | 32 | let calendar = PlanCalendar.generate() |
33 | 33 | let expected = false |
34 | 34 | let actual = CalendarFilter.Ignore(uuids: [calendar.id]).accept(calendar) |
35 | 35 |
|
36 | | - XCTAssertEqual(actual, expected, "The calendar was accepted") |
| 36 | + #expect(actual == expected, "The calendar was accepted") |
37 | 37 | } |
38 | 38 |
|
39 | | - func testIgnoreCalendarsEmptyArray() { |
| 39 | + @Test func testIgnoreCalendarsEmptyArray() { |
40 | 40 | let calendar = PlanCalendar.generate() |
41 | 41 | let expected = true |
42 | 42 | let actual = CalendarFilter.Ignore(uuids: []).accept(calendar) |
43 | 43 |
|
44 | | - XCTAssertEqual(actual, expected, "The calendar was not accepted") |
| 44 | + #expect(actual == expected, "The calendar was not accepted") |
45 | 45 | } |
46 | 46 |
|
47 | | - func testIgnoreCalendarSourcesMatching() { |
| 47 | + @Test func testIgnoreCalendarSourcesMatching() { |
48 | 48 | let source = "Personal" |
49 | 49 | let calendar = PlanCalendar.generate(source: source) |
50 | 50 | let expected = false |
51 | 51 | let actual = CalendarFilter.IgnoreSources(sources: [source]).accept(calendar) |
52 | 52 |
|
53 | | - XCTAssertEqual(actual, expected, "The calendar was accepted") |
| 53 | + #expect(actual == expected, "The calendar was accepted") |
54 | 54 | } |
55 | 55 |
|
56 | | - func testIgnoreCalendarSourcesEmptyArray() { |
| 56 | + @Test func testIgnoreCalendarSourcesEmptyArray() { |
57 | 57 | let calendar = PlanCalendar.generate() |
58 | 58 | let expected = true |
59 | 59 | let actual = CalendarFilter.IgnoreSources(sources: []).accept(calendar) |
60 | 60 |
|
61 | | - XCTAssertEqual(actual, expected, "The calendar was rejected") |
| 61 | + #expect(actual == expected, "The calendar was rejected") |
62 | 62 | } |
63 | 63 |
|
64 | | - func testSelectCalendarSourcesMatching() { |
| 64 | + @Test func testSelectCalendarSourcesMatching() { |
65 | 65 | let source = "Personal" |
66 | 66 | let calendar = PlanCalendar.generate(source: source) |
67 | 67 | let expected = true |
68 | 68 | let actual = CalendarFilter.SelectSources(sources: [source]).accept(calendar) |
69 | 69 |
|
70 | | - XCTAssertEqual(actual, expected, "The calendar was rejected") |
| 70 | + #expect(actual == expected, "The calendar was rejected") |
71 | 71 | } |
72 | 72 |
|
73 | | - func testSelectCalendarSourcesNotMatching() { |
| 73 | + @Test func testSelectCalendarSourcesNotMatching() { |
74 | 74 | let source = "Personal" |
75 | 75 | let calendar = PlanCalendar.generate(source: source) |
76 | 76 | let expected = false |
77 | 77 | let actual = CalendarFilter.SelectSources(sources: ["not-existing"]).accept(calendar) |
78 | 78 |
|
79 | | - XCTAssertEqual(actual, expected, "The calendar was accepted") |
| 79 | + #expect(actual == expected, "The calendar was accepted") |
80 | 80 | } |
81 | 81 |
|
82 | | - func testSelectCalendarSourcesEmptyArray() { |
| 82 | + @Test func testSelectCalendarSourcesEmptyArray() { |
83 | 83 | let calendar = PlanCalendar.generate() |
84 | 84 | let expected = true |
85 | 85 | let actual = CalendarFilter.SelectSources(sources: []).accept(calendar) |
86 | 86 |
|
87 | | - XCTAssertEqual(actual, expected, "The calendar was rejected") |
| 87 | + #expect(actual == expected, "The calendar was rejected") |
88 | 88 | } |
89 | 89 |
|
90 | | - func testIgnoreCalendarTypesMatching() { |
| 90 | + @Test func testIgnoreCalendarTypesMatching() { |
91 | 91 | let type = EKCalendarType.birthday |
92 | 92 | let calendar = PlanCalendar.generate(type: type) |
93 | 93 | let expected = false |
94 | 94 | let actual = CalendarFilter.IgnoreTypes(types: [type]).accept(calendar) |
95 | 95 |
|
96 | | - XCTAssertEqual(actual, expected, "The calendar was accepted") |
| 96 | + #expect(actual == expected, "The calendar was accepted") |
97 | 97 | } |
98 | 98 |
|
99 | | - func testIgnoreCalendarTypesEmptyArray() { |
| 99 | + @Test func testIgnoreCalendarTypesEmptyArray() { |
100 | 100 | let calendar = PlanCalendar.generate() |
101 | 101 | let expected = true |
102 | 102 | let actual = CalendarFilter.IgnoreTypes(types: []).accept(calendar) |
103 | 103 |
|
104 | | - XCTAssertEqual(actual, expected, "The calendar was rejected") |
| 104 | + #expect(actual == expected, "The calendar was rejected") |
105 | 105 | } |
106 | 106 |
|
107 | | - func testSelectCalendarTypesMatching() { |
| 107 | + @Test func testSelectCalendarTypesMatching() { |
108 | 108 | let type = EKCalendarType.birthday |
109 | 109 | let calendar = PlanCalendar.generate(type: type) |
110 | 110 | let expected = true |
111 | 111 | let actual = CalendarFilter.SelectTypes(types: [type]).accept(calendar) |
112 | 112 |
|
113 | | - XCTAssertEqual(actual, expected, "The calendar was rejected") |
| 113 | + #expect(actual == expected, "The calendar was rejected") |
114 | 114 | } |
115 | 115 |
|
116 | | - func testSelectCalendarTypesNotMatching() { |
| 116 | + @Test func testSelectCalendarTypesNotMatching() { |
117 | 117 | let type = EKCalendarType.calDAV |
118 | 118 | let calendar = PlanCalendar.generate(type: type) |
119 | 119 | let expected = false |
120 | 120 | let actual = CalendarFilter.SelectTypes(types: [EKCalendarType.birthday]).accept(calendar) |
121 | 121 |
|
122 | | - XCTAssertEqual(actual, expected, "The calendar was accepted") |
| 122 | + #expect(actual == expected, "The calendar was accepted") |
123 | 123 | } |
124 | 124 |
|
125 | | - func testSelectCalendarTypesEmptyArray() { |
| 125 | + @Test func testSelectCalendarTypesEmptyArray() { |
126 | 126 | let calendar = PlanCalendar.generate() |
127 | 127 | let expected = true |
128 | 128 | let actual = CalendarFilter.SelectTypes(types: []).accept(calendar) |
129 | 129 |
|
130 | | - XCTAssertEqual(actual, expected, "The calendar was rejected") |
| 130 | + #expect(actual == expected, "The calendar was rejected") |
131 | 131 | } |
132 | 132 | } |
0 commit comments