mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
25a92c4e03
This adds 6 tests that were accidentally not being run on Linux: * LineLengthConfigurationTests.testLineLengthConfigurationInitialiserSetsIgnoresComments * LineLengthConfigurationTests.testLineLengthConfigurationInitialiserSetsIgnoresFunctionDeclarations * LineLengthConfigurationTests.testLineLengthConfigurationThrowsOnBadConfigValues * LineLengthRuleTests.testLineLengthWithIgnoreCommentsEnabled * LineLengthRuleTests.testLineLengthWithIgnoreFunctionDeclarationsEnabled * RegionTests.testSeveralRegionsFromSeveralCommands
30 lines
793 B
Swift
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")
|
|
}
|
|
}
|
|
}
|