我正在为 macOS 开发命令行应用程序,但遇到以下问题:我在 Xcode 中有以下测试用例
import XCTest
@testable import Assembler
class ParserTests: XCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func test_commandType_returnRightTypeForAcommands() {
let parser = Parser()
// Invocation
let commandType = "A_COMMAND"
// Assertion
XCTAssertEqual(commandType, "A_COMMAND")
}
}
Run Code Online (Sandbox Code Playgroud)
这是Parser班级:
import Foundation
class Parser {
func commandType(for command: String) -> String {
return …Run Code Online (Sandbox Code Playgroud)