Skip to content

Commit

Permalink
Testを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryu0118 committed May 22, 2023
1 parent a371e28 commit dc83fc1
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ let package = Package(
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftParser", package: "swift-syntax")
]
),
.testTarget(
name: "SorterTests",
dependencies: [
"SorterCore",
.product(name: "SwiftParser", package: "swift-syntax")
]
)
]
)
50 changes: 50 additions & 0 deletions Tests/SorterTests/SorterTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// SorterTests.swift
//
//
// Created by ryunosuke.shibuya on 2023/05/20.
//

import Foundation
import XCTest
@testable import SorterCore
import SwiftParser

final class SorterTests: XCTestCase {
func testEmptyRewriter() {

let `enum` =
"""
enum E1 {
case b
case a
case j
case h
case i
case e
case d
case g
case f
case c
}
"""
let expected =
"""
enum E1 {
case a
case b
case c
case d
case e
case f
case g
case h
case i
case j
}
"""
let syntax = Parser.parse(source: `enum`)
let formatted = EnumSortRewriter().visit(syntax)
XCTAssertEqual(formatted.description, expected)
}
}

0 comments on commit dc83fc1

Please sign in to comment.