Files
SwiftLint/Tests/BuiltInRulesTests/MultilineParametersConfigurationTests.swift
Danny Mösch ac2eda6732 Adopt Swift Testing
# Conflicts:
#	Tests/BuiltInRulesTests/FileHeaderRuleTests.swift
#	Tests/BuiltInRulesTests/FileNameNoSpaceRuleTests.swift
#	Tests/BuiltInRulesTests/IndentationWidthRuleTests.swift
#	Tests/CoreTests/RegexConfigurationTests.swift
#	Tests/CoreTests/SwiftLintFileTests.swift
#	Tests/FileSystemAccessTests/BaselineTests.swift
#	Tests/FileSystemAccessTests/ConfigurationTests+Mock.swift
#	Tests/FileSystemAccessTests/ConfigurationTests.swift
#	Tests/FileSystemAccessTests/GlobTests.swift
#	Tests/FileSystemAccessTests/MultipleConfigurationsTests.swift
#	Tests/FileSystemAccessTests/ReporterTests.swift
#	Tests/FileSystemAccessTests/SourceKitCrashTests.swift
#	Tests/FrameworkTests/CustomRulesTests.swift
#	Tests/FrameworkTests/LinterCacheTests.swift
#	Tests/FrameworkTests/RuleConfigurationTests.swift
#	Tests/FrameworkTests/SwiftVersionTests.swift
#	Tests/GeneratedTests/GeneratedTests_02.swift
#	Tests/GeneratedTests/GeneratedTests_03.swift
#	Tests/GeneratedTests/GeneratedTests_04.swift
#	Tests/GeneratedTests/GeneratedTests_05.swift
#	Tests/GeneratedTests/GeneratedTests_06.swift
#	Tests/GeneratedTests/GeneratedTests_07.swift
#	Tests/GeneratedTests/GeneratedTests_08.swift
#	Tests/GeneratedTests/GeneratedTests_09.swift
#	Tests/GeneratedTests/GeneratedTests_10.swift
#	Tests/IntegrationTests/ConfigPathResolutionTests.swift
#	Tests/IntegrationTests/IntegrationTests.swift
#	Tests/TestHelpers/TestHelpers.swift
2026-06-06 11:07:04 +02:00

43 lines
1.5 KiB
Swift

import TestHelpers
import Testing
@testable import SwiftLintBuiltInRules
@testable import SwiftLintCore
@Suite(.rulesRegistered)
struct MultilineParametersConfigurationTests {
@Test
func invalidMaxNumberOfSingleLineParameters() async throws {
for maxNumberOfSingleLineParameters in [0, -1] {
let console = try await Issue.captureConsole {
var config = MultilineParametersConfiguration()
try config.apply(
configuration: ["max_number_of_single_line_parameters": maxNumberOfSingleLineParameters]
)
}
#expect(
console == """
warning: Inconsistent configuration for 'multiline_parameters' rule: Option \
'max_number_of_single_line_parameters' should be >= 1.
"""
)
}
}
@Test
func invalidMaxNumberOfSingleLineParametersWithSingleLineEnabled() async throws {
let console = try await Issue.captureConsole {
var config = MultilineParametersConfiguration()
try config.apply(
configuration: ["max_number_of_single_line_parameters": 2, "allows_single_line": false]
)
}
#expect(
console == """
warning: Inconsistent configuration for 'multiline_parameters' rule: Option \
'max_number_of_single_line_parameters' has no effect when 'allows_single_line' is false.
"""
)
}
}