                 "name"
         ]
 
-        let path = JsonPath(components: components)
-
-        for index in 0..<components.count + 1 {
-            let subpath = path.subpath(to: index)
-
-            XCTAssertEqual(subpath.components, Array(path.components.prefix(index)),
-                    "Subpath components must be equal to prefixed path components by the given index."
-            )
-        }
+        XCTAssertEqual(JsonPath(components: components).subpath(to: 2).components, Array(components.prefix(2)))
     }
 
     /// Tests `==(lhs:rhs:)`.
-    public func testEquals() {
+    func testEquals() {
         let components = [
                 "response",
                 "items",

                "name"
        ]

        let path = JsonPath(components: components)

        XCTAssertEqual(path.components, components,
                "Path components must be equal to the source components."
        )

        XCTAssertEqual(path.description, components.joined(separator: JsonPath.separator),
                "Path description must be equal to the source components joined by `JsonPath.separator`."
        )
    }

    /// Tests `appending(_:)`.
    public func testAppending() {
        let lhs = JsonPath(string: "response.items.0")
        let rhs = JsonPath(string: "name")

        let path = lhs.appending(rhs)

        XCTAssertEqual(path.components, lhs.components + rhs.components,
                "Path components must be equal to concatenated components of the source paths."
        )

        XCTAssertEqual(path.description, [lhs.description, rhs.description].joined(separator: JsonPath.separator),
                "Path description must be equal to the source descriptions joined by `JsonPath.separator`."
        )
    }

    /// Tests `subpath(to:)`.
    public func testSubpath() {
        let components = [
                "response",
                "items",

final class JsonPathTestCase: XCTestCase {

    /// Tests `init()`.
    func testInit() {
        XCTAssert(JsonPath().components.isEmpty)
    }

    /// Tests `init(string:)`.
    func testInitString() {
        let string = "response.items.42.name"

        XCTAssertEqual(JsonPath(string: string).components, string.components(separatedBy: JsonPath.separator))
    }

    /// Tests `init(index:)`.
    func testInitIndex() {
        let index = 42
        let jsonPath = JsonPath(index: index)

        XCTAssertEqual(jsonPath.components.count, 1)

        if let first = jsonPath.components.first {
            XCTAssertEqual(first, String(index))
        }
    }

    /// Tests `init(components:)`.
    func testInitComponents() {
        let components = [
                "response",
                "items",
