Added tests for RuntimeMetaData.getMajorMinorVersion.

This commit is contained in:
Ewan Mellor 2017-11-01 15:58:33 -07:00
parent fd8fd175a6
commit 08ba9379d8
No known key found for this signature in database
GPG Key ID: 7CE1C6BC9EC8645D
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
/// Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
/// Use of this file is governed by the BSD 3-clause license that
/// can be found in the LICENSE.txt file in the project root.
import Foundation
import XCTest
import Antlr4
class RuntimeMetaDataTests: XCTestCase {
func testGetMajorMinorVersion() {
doGetMajorMinorVersionTest("", "")
doGetMajorMinorVersionTest("4", "4")
doGetMajorMinorVersionTest("4.", "4.")
doGetMajorMinorVersionTest("4.7", "4.7")
doGetMajorMinorVersionTest("4.7.1", "4.7")
doGetMajorMinorVersionTest("4-SNAPSHOT", "4")
doGetMajorMinorVersionTest("4.-SNAPSHOT", "4.")
doGetMajorMinorVersionTest("4.7-SNAPSHOT", "4.7")
doGetMajorMinorVersionTest("4.7.1-SNAPSHOT", "4.7")
}
}
private func doGetMajorMinorVersionTest(_ input: String, _ expected: String) {
XCTAssertEqual(RuntimeMetaData.getMajorMinorVersion(input), expected)
}