Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tejassharma96 committed Mar 29, 2024
1 parent 633547d commit 67dce29
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Tests/YamsTests/EncoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,27 @@ class EncoderTests: XCTestCase { // swiftlint:disable:this type_body_length
_testRoundTrip(of: OptionalTopLevelWrapper(url), expectedYAML: expectedYAML)
}

func testNewlinesInString() throws {
let expectedYamlLiteral = """
name: |-
This name
Has new lines
email: test@test.test
"""
let expectedYamlFolded = """
name: >-
This name
Has new lines
email: test@test.test
"""
let person = Person(name: "This name\nHas new lines", email: "test@test.test")
_testRoundTrip(of: person, with: .init(newLineScalarStyle: .literal), expectedYAML: expectedYamlLiteral)
_testRoundTrip(of: person, with: .init(newLineScalarStyle: .folded), expectedYAML: expectedYamlFolded)
}

func testNumberInString() throws {
_testDecode(of: String.self, from: "'10'", expectedValue: "10")
_testDecode(of: String.self, from: "'10.5'", expectedValue: "10.5")
Expand Down

0 comments on commit 67dce29

Please sign in to comment.