Files
SwiftLint/Tests/SwiftLintFrameworkTests/YamlParserTests.swift
T
JP Simard 25a92c4e03 automatically generate LinuxMain.swift using Sourcery
This adds 6 tests that were accidentally not being run on Linux:

* LineLengthConfigurationTests.testLineLengthConfigurationInitialiserSetsIgnoresComments
* LineLengthConfigurationTests.testLineLengthConfigurationInitialiserSetsIgnoresFunctionDeclarations
* LineLengthConfigurationTests.testLineLengthConfigurationThrowsOnBadConfigValues
* LineLengthRuleTests.testLineLengthWithIgnoreCommentsEnabled
* LineLengthRuleTests.testLineLengthWithIgnoreFunctionDeclarationsEnabled
* RegionTests.testSeveralRegionsFromSeveralCommands
2017-06-02 14:28:37 -07:00

30 lines
793 B
Swift

//
// YamlParserTests.swift
// SwiftLint
//
// Created by Scott Hoyt on 1/1/16.
// Copyright © 2016 Realm. All rights reserved.
//
@testable import SwiftLintFramework
import XCTest
class YamlParserTests: XCTestCase {
func testParseEmptyString() {
XCTAssertEqual((try YamlParser.parse("")).count, 0,
"Parsing empty YAML string should succeed")
}
func testParseValidString() {
XCTAssertEqual(try YamlParser.parse("a: 1\nb: 2").count, 2,
"Parsing valid YAML string should succeed")
}
func testParseInvalidStringThrows() {
checkError(YamlParserError.yamlParsing("2:1: error: parser: did not find expected <document start>:\na\n^")) {
_ = try YamlParser.parse("|\na")
}
}
}