99 */
1010
1111import XCTest
12+ import SPMTestSupport
1213@testable import PackageRegistry
1314
1415private let defaultRegistryBaseURL = URL ( string: " https://packages.example.com/ " ) !
@@ -47,20 +48,20 @@ final class RegistryConfigurationTests: XCTestCase {
4748 }
4849
4950 func testDecodeEmptyConfiguration( ) throws {
50- let data = #"""
51+ let json = #"""
5152 {
5253 "registries": {},
5354 "version": 1
5455 }
55- """# . data ( using : . utf8 ) !
56+ """#
5657
57- let configuration = try decoder. decode ( RegistryConfiguration . self, from: data )
58+ let configuration = try decoder. decode ( RegistryConfiguration . self, from: json )
5859 XCTAssertNil ( configuration. defaultRegistry)
5960 XCTAssertEqual ( configuration. scopedRegistries, [ : ] )
6061 }
6162
6263 func testDecodeExampleConfiguration( ) throws {
63- let data = #"""
64+ let json = #"""
6465 {
6566 "registries": {
6667 "[default]": {
@@ -75,58 +76,58 @@ final class RegistryConfigurationTests: XCTestCase {
7576 },
7677 "version": 1
7778 }
78- """# . data ( using : . utf8 ) !
79+ """#
7980
80- let configuration = try decoder. decode ( RegistryConfiguration . self, from: data )
81+ let configuration = try decoder. decode ( RegistryConfiguration . self, from: json )
8182 XCTAssertEqual ( configuration. defaultRegistry? . url, defaultRegistryBaseURL)
8283 XCTAssertEqual ( configuration. scopedRegistries [ " foo " ] ? . url, customRegistryBaseURL)
8384 XCTAssertEqual ( configuration. scopedRegistries [ " bar " ] ? . url, customRegistryBaseURL)
8485 }
8586
8687 func testDecodeConfigurationWithInvalidRegistryKey( ) throws {
87- let data = #"""
88+ let json = #"""
8889 {
8990 "registries": {
9091 0: " \#( customRegistryBaseURL) "
9192 },
9293 "version": 1
9394 }
94- """# . data ( using : . utf8 ) !
95+ """#
9596
96- XCTAssertThrowsError ( try decoder. decode ( RegistryConfiguration . self, from: data ) )
97+ XCTAssertThrowsError ( try decoder. decode ( RegistryConfiguration . self, from: json ) )
9798 }
9899
99100 func testDecodeConfigurationWithInvalidRegistryValue( ) throws {
100- let data = #"""
101+ let json = #"""
101102 {
102103 "registries": {
103104 "[default]": " \#( customRegistryBaseURL) "
104105 },
105106 "version": 1
106107 }
107- """# . data ( using : . utf8 ) !
108+ """#
108109
109- XCTAssertThrowsError ( try decoder. decode ( RegistryConfiguration . self, from: data ) )
110+ XCTAssertThrowsError ( try decoder. decode ( RegistryConfiguration . self, from: json ) )
110111 }
111112
112113 func testDecodeConfigurationWithMissingVersion( ) throws {
113- let data = #"""
114+ let json = #"""
114115 {
115116 "registries": {}
116117 }
117- """# . data ( using : . utf8 ) !
118+ """#
118119
119- XCTAssertThrowsError ( try decoder. decode ( RegistryConfiguration . self, from: data ) )
120+ XCTAssertThrowsError ( try decoder. decode ( RegistryConfiguration . self, from: json ) )
120121 }
121122
122123 func testDecodeConfigurationWithInvalidVersion( ) throws {
123- let data = #"""
124+ let json = #"""
124125 {
125126 "registries": {},
126127 "version": 999
127128 }
128- """# . data ( using : . utf8 ) !
129+ """#
129130
130- XCTAssertThrowsError ( try decoder. decode ( RegistryConfiguration . self, from: data ) )
131+ XCTAssertThrowsError ( try decoder. decode ( RegistryConfiguration . self, from: json ) )
131132 }
132133}
0 commit comments