nsomar/Guaka

Successful tests on Linux - steps need to be done

Closed this issue · 1 comments

Hi, it seems that Guaka can be build on Linux, but tests are not working. This needs to happen to get swift test running:

  1. In Tests/LinuxMain.swift you need to change:
@testable import ProcessTests

to

@testable import GuakaTests
  1. All classes *Tests in files of directory Tests/GuakaTests need to have static variable called allTests like this one:
    static var allTests : [(String, (CommandArgumentsTests) -> () throws -> Void)] {
        return [
            ("testEmptySignature", testEmptySignature),
            ("testRequiredArguments", testRequiredArguments),
            ("testOptionalArguments", testOptionalArguments),
            ("testExtraneousArguments", testExtraneousArguments),
            ("testNonTerminalWithRequiredArguments", testNonTerminalWithRequiredArguments),
            ("testNonTerminalWithOptionalArguments", testNonTerminalWithOptionalArguments),
            ("testParameterPlacement", testParameterPlacement),
            ("testCombinedRequiredAndOptionalArguments", testCombinedRequiredAndOptionalArguments),
            ("testEmptyOptionalCollectedParameter", testEmptyOptionalCollectedParameter),
            ("testQuotedArguments", testQuotedArguments)
        ]
    }
  1. When 2. is done, then Tests/LinuxMain.swift needs to have similar definition of XTCMain like this one:
XCTMain([
     testCase(CommandArgumentsTests.allTests),
     testCase(CommandMessageGeneratorTests.allTests),
     testCase(OptionsTests.allTests),
     testCase(RouterTests.allTests),
     testCase(SwiftCLITests.allTests)
])

This all will make sure, that swift test on Linux will run all tests.

I would submit PR for this, but I'm not sure if there is order to those tests if any, so I wouldn't like to mess it up.

PS: Examples taken from similar framework called SwiftCLI: https://github.com/jakeheis/SwiftCLI

Hey @rbukovansky feel free to submit the PR! After all we are on git and if we mess something up we can go back and try again a different approach ;)