Skip to content

Commit 63481c7

Browse files
committed
Extract testPackageReference into new PackageIdentityTests file
1 parent f2c7c21 commit 63481c7

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

Tests/PackageGraphTests/RepositoryPackageContainerProviderTests.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,6 @@ private let v2: Version = "2.0.0"
140140
private let v1Range: VersionSetSpecifier = .range("1.0.0" ..< "2.0.0")
141141

142142
class RepositoryPackageContainerProviderTests: XCTestCase {
143-
func testPackageReference() {
144-
func assertIdentity(_ url: String, _ identity: PackageIdentity, file: StaticString = #file, line: UInt = #line) {
145-
let computedIdentity = PackageIdentity(url)
146-
XCTAssertEqual(computedIdentity, identity, file: file, line: line)
147-
}
148-
assertIdentity("foo", PackageIdentity("foo"))
149-
assertIdentity("/foo", PackageIdentity("foo"))
150-
assertIdentity("/foo/bar", PackageIdentity("bar"))
151-
assertIdentity("foo/bar", PackageIdentity("bar"))
152-
assertIdentity("https://foo/bar/baz", PackageIdentity("baz"))
153-
assertIdentity("[email protected]/foo/bar/baz", PackageIdentity("baz"))
154-
assertIdentity("/path/to/foo/bar/baz/", PackageIdentity("baz"))
155-
assertIdentity("https://foo/bar/baz.git", PackageIdentity("baz"))
156-
assertIdentity("[email protected]/foo/bar/baz.git", PackageIdentity("baz"))
157-
assertIdentity("/path/to/foo/bar/baz.git", PackageIdentity("baz"))
158-
}
159-
160143
func testVprefixVersions() throws {
161144
let fs = InMemoryFileSystem()
162145

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See http://swift.org/LICENSE.txt for license information
8+
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
*/
10+
11+
import XCTest
12+
13+
import TSCBasic
14+
15+
@testable import PackageModel
16+
17+
final class LegacyPackageIdentityTests: XCTestCase {
18+
func testPackageIdentityDescriptions() {
19+
XCTAssertEqual(PackageIdentity("foo").description, "foo")
20+
XCTAssertEqual(PackageIdentity("/foo").description, "foo")
21+
XCTAssertEqual(PackageIdentity("/foo/bar").description, "bar")
22+
XCTAssertEqual(PackageIdentity("foo/bar").description, "bar")
23+
XCTAssertEqual(PackageIdentity("https://foo/bar/baz").description, "baz")
24+
XCTAssertEqual(PackageIdentity("[email protected]/foo/bar/baz").description, "baz")
25+
XCTAssertEqual(PackageIdentity("/path/to/foo/bar/baz/").description, "baz")
26+
XCTAssertEqual(PackageIdentity("https://foo/bar/baz.git").description, "baz")
27+
XCTAssertEqual(PackageIdentity("[email protected]/foo/bar/baz.git").description, "baz")
28+
XCTAssertEqual(PackageIdentity("/path/to/foo/bar/baz.git").description, "baz")
29+
}
30+
}

0 commit comments

Comments
 (0)