Commit Graph

166 Commits

Author SHA1 Message Date
Maxwell Elliott 6780f317eb
Add bazel support to Yams (#302)
Also add a GitHub action to ensure builds are working.

Validated on all Apple platforms and Linux.
2021-03-22 10:27:51 -07:00
Brentley Jones 8695c0bd11
Expose the underlying Node's Mark on Decoder (#296)
This allows accessing source location during decoding.
2021-01-11 13:58:33 -06:00
Brentley Jones 11ab354492
Fix mark for sequences and mappings (#297)
Instead of the start mark for the sequence or map we were capturing the start mark of the _next_ element.
2021-01-11 12:33:06 -06:00
JP Simard 13f942e95c
Rename master branch to main 2020-12-11 14:21:03 -05:00
JP Simard 3824257669
Fix SwiftLint violations (#290) 2020-11-11 08:27:27 -08:00
JP Simard 928212af4f
[CI] Re-enable all passing Windows tests (#286) 2020-11-04 10:01:04 -08:00
Mathew Polzin 5cf653d248
Fix and test string -> integer misstep upon decoding. (#264)
Fixes https://github.com/jpsim/Yams/issues/263 by only constructing integer and floating point values from scalars if those scalars are in the `plain` "flow" style. It additionally allows through scalars with no styling information (`any`).
2020-09-10 10:15:03 -07:00
JP Simard 6e6483a6dd
Make YAMLDecoder conform to TopLevelDecoder (#262)
* Add TopLevelDecoder conformance

* fixup! Add TopLevelDecoder conformance

* Support decoding `Data`

- Set `TopLevelDecoder.Input` to `Data`
- Provide `YAMLDecoder.deecode(...)` function taking `Data` as input
- Add tests for `TopLevelDecoder` and `Data` decoding
- Add `Parser.Encoding.swiftStringEncoding` member to convert between the Swift String encoding and the Yams encoding
- Fix warnings with Swift 5.3

* Add TopLevelDecoderTests to CMakeLists.txt

* Only add TopLevelDecoderTests.swift to LinuxMain.swift if Combine is available

* Completely remove TopLevelDecoderTests from LinuxMain

* Use @available attribute

* Store cancellable

* 5.3

* Force unwrap

* merge compiler conditionals

* Fixes

* Try to run TopLevelDecoderTests with Swift 5.2+

* Only report code coverage for latest Xcode version

* Update README

* Remove stored cancellable

* Add changelog entries

* Install latest SwiftLint available to Homebrew
2020-07-06 20:54:51 -04:00
Saleem Abdulrasool 84621a6025
build: add the ability to run the test suite from CMake (#256)
Expand the CMake based build to support running the test suite.  This
allows testing on Windows as well.  Although the test suite does not
fully pass on Windows yet, this brings us closer.

With this on Windows, the following is the result:

```
  Test Suite 'All tests' failed at 2020-05-14 12:11:08.871
           Executed 120 tests, with 9 failures (0 unexpected) in 0.505 (0.505) seconds
```

The failures in the test suite correspond to the conversion of floating
point values in the infinity and NaN cases (either converting to
`-infe+0`, `infe+0`, or `nane+0` instead of `-inf`, `inf`, `nan`, or
converting to `NaN` instead of `nan`).
2020-05-15 16:39:33 -07:00
JP Simard 775dec7923
Require Swift 5.1 to build (#249) 2020-04-17 22:00:58 -07:00
JP Simard a9be523c38
Add missing test to manifest 2020-04-17 14:56:03 -07:00
JP Simard 937f397527
Fix `Yams.dump` when object contains a keyed null value (#248) 2020-04-17 14:47:21 -07:00
JP Simard 9e1f96b6f9
Reduce accessibility of members that should be private (#247) 2020-04-16 16:56:22 -07:00
Brentley Jones 5fa313eae1 Fix `YAMLDecoder` to support merging anchors (#238)
Currently `YAMLDecoder` uses `Resolver.basic` instead of `Resolver.default`, since it doesn't need to resolve types. This has the side effect of not including `.merge` as an option, making `decode` fail to see anchored properties.
2020-01-09 10:48:54 -08:00
Andrés Cecilia Luque bbaa9ec919 Added indentation tests for the emitter 2019-11-27 19:26:21 +01:00
JP Simard c61caea937
Fix renamed SwiftLint analyzer rule (#213) 2019-10-20 10:57:12 -07:00
JP Simard 4a37b2b129
Fix SwiftLint violations (#212)
* colon placement
* line length
* mark format
* trailing collection literal comma
2019-10-20 10:32:41 -07:00
Ondrej Rafaj 725819d914 Add UUID support (#205)
* Adding UUID

* Fix docstring

* Fix lint issues & run testUUID on Linux

* Add changelog entry
2019-10-19 22:53:59 -07:00
Norio Nomura 8eb295d092
Update `expectedYaml` in `SpecTests.testSpecExample2_23_VariousExplicitTags()`
It is more desirable behavior.
2019-07-06 13:54:48 +09:00
Norio Nomura 1bc7a6b9e6
Add `testSmartQuotedString` to `EmitterTests` 2019-07-06 13:30:04 +09:00
Norio Nomura 7572c1ba8f
Use `map() ??` pattern instead of `guard let` on `timestamp()` in TestHelper.swif 2019-06-30 09:42:48 +09:00
Norio Nomura 82ad0d496d
Update a message in `fatalError()`
Co-Authored-By: JP Simard <jp@jpsim.com>
2019-06-30 09:19:37 +09:00
Norio Nomura a380d6dc8e
Use static instance of gregorian calender if possible 2019-06-26 19:31:21 +09:00
Norio Nomura 82ae44bdba
Remove conditional compilation from tests using `Date` with `nanosecond`
It is now possible to handle Date with nanosecond in Swift 4.x.
2019-06-26 19:17:53 +09:00
Norio Nomura 4efe9040c6
Avoid using `String.enumerateLines()` in TestHelper.swift
It causes unimplemented error in Swift 4.x
2019-06-26 18:59:28 +09:00
Norio Nomura 1916064227
Stop using `DateComponents.nanosecond` in TestHelper.swift 2019-06-26 18:57:50 +09:00
Norio Nomura b5977579b2
Stop using `DateComponents.nanosecond` in `testEncodingDateWithNanosecondGreaterThan999499977()` 2019-06-26 18:49:46 +09:00
Norio Nomura 99b4023cad
Add `testEncodingDateWithNanosecondGreaterThan999499977`
Reproducing #192
2019-06-25 23:56:07 +09:00
Norio Nomura 5c526ceac9
[Xcode 11] Use `XCTMetrics` in `PerformanceTests` 2019-06-21 08:34:12 +09:00
Norio Nomura b4585d96d6
Drop conditional compilation blocks for Swift 4.0.x 2019-06-21 08:32:06 +09:00
Norio Nomura 273adffc0f
Fix compilation error on 32bit target
> Tests/YamsTests/ConstructorTests.swift:127:29: error: integer literal '9223372036854775807' overflows when stored into 'Int'
>            "canonicalMax": 9223372036854775807
>                            ^
> Tests/YamsTests/ConstructorTests.swift:126:29: error: integer literal '-9223372036854775808' overflows when stored into 'Int'
>            "canonicalMin": -9223372036854775808,
>                            ^
2019-02-23 14:09:25 +09:00
Norio Nomura df4fc6fd1a
Use `MemoryLayout<Int>.size` instead of `arch()` compiler condition 2019-02-22 19:13:33 +09:00
Norio Nomura edf07b91a4
Revert "Skip tests affected by https://bugs.swift.org/browse/SR-9454"
This reverts commit 584a2bc2ff.

# Conflicts:
#	Tests/YamsTests/TestHelper.swift

# Conflicts:
#	Tests/YamsTests/StringTests.swift
2019-02-03 14:25:03 +09:00
Norio Nomura 4556cfb81b
Add `test_null_yml()` to `EncoderTests` from #157 2019-01-29 12:03:53 +09:00
Norio Nomura 98b0174684
Fix warning: 'init(bytes:)' is deprecated: use `init(_:)` instead on Swift 5 2019-01-22 21:45:38 +09:00
Norio Nomura d4feb15140
Add more tests representing floating point 2019-01-09 09:50:04 +09:00
JP Simard 5d0bb5ec15
Update LibYAML (#150)
* Update .swift-version to latest stable Swift version

* Update LibYAML to latest upstream head

* Fix tests

* Add changelog entry

* Fix includes in yaml_private.h

* Fix uninitialized warning
2019-01-06 13:19:48 -08:00
JP Simard a856ca6c4b
Lint for unused private declarations (#149)
* Lint for unused private declarations

Remove two unused declarations and silence an intentional violation.

* Rename Unused_Imports CI job to Analyze

* Use SwiftLint HEAD to avoid false positives in unused_private_declaration
2019-01-06 10:18:32 -08:00
JP Simard 73632ef7fe Fix identifier_name violations and re-enable rule 2019-01-05 20:54:43 -08:00
JP Simard 61c7dbb8fd Remove unused imports 2019-01-05 18:17:30 -08:00
Norio Nomura 80b53b3bed
Change remaining `os(Linux)` to `_runtime(_ObjC)` 2019-01-05 20:31:02 +09:00
Norio Nomura 083cc50523
https://bugs.swift.org/browse/SR-3158 seems to be fixed on Swift 5.0 2019-01-05 20:06:15 +09:00
Norio Nomura 376c62c3b1
https://bugs.swift.org/browse/SR-6223 seems to be fixed on Swift 5.0 2019-01-05 20:02:06 +09:00
Norio Nomura ded1eccd5b
Add assertions detecting fixes for SR-6223 2019-01-05 20:01:28 +09:00
Norio Nomura c25a74ab52
Change `os(Linux)` compilation condition to `_runtime(_ObjC)` 2019-01-05 18:09:22 +09:00
Norio Nomura a62f990902
Make inline the module name parameters in the functions 2019-01-05 12:38:37 +09:00
Norio Nomura ee9bc0e878
Mark test functions as `throws` in `PerformanceTests` 2019-01-05 12:34:22 +09:00
Norio Nomura a506a64539
Avoid using `String.init(contentsOfFile:encoding:)` in `PerformanceTests.swift`
`String` created by `String.init(contentsOfFile:encoding:)` can’t use `String.UTF8View.withContiguousStorageIfAvailable(_:)` on Apple Platform.
2018-12-30 22:57:12 +09:00
Norio Nomura c2105ae495
Run performance test with both .utf8 and .utf16 encoding 2018-12-30 10:04:49 +09:00
Norio Nomura fd9b5ea279
Change `byteOffset` to `offset in `YamlError.reader`
This is necessary to remove `USE_UTF8` compilation condition from `YamlError`.
2018-12-30 08:07:44 +09:00