Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatten Yaml Scalar Test #452

Closed

Conversation

russellbanks
Copy link
Contributor

#27 (comment)

listOf has been replaced with withData

@russellbanks
Copy link
Contributor Author

russellbanks commented Jul 25, 2023

Float.NaN == Float.NaN is false in Kotlin/JS so equality for NaN should be done by isNaN(). In Kotest, this corresponds to shouldBeNaN() so I've put tests relating to NaN separately so they work in JavaScript.

@russellbanks
Copy link
Contributor Author

russellbanks commented Jul 25, 2023

@charleskorn One issue is that the tests 0x2 and 0o2 are successfully converted to a float in JavaScript (On the JVM it throws an exception).

val scalar = YamlScalar("0x2", index1Line2Column4Path)

val floatException = shouldThrow<YamlScalarFormatException>(scalar::toFloat) // Gets converted to 2 in JS

On the JVM, the test passes. On JavaScript, there is AssertionError: Expected exception YamlScalarFormatException but no exception was thrown.

The below functions might need extra logic to cover this edge case in JavaScript:

public fun toFloat(): Float {
public fun toDouble(): Double {

@charleskorn
Copy link
Owner

One issue is that the tests 0x2 and 0o2 are successfully converted to a float in JavaScript (On the JVM it throws an exception).

...

The below functions might need extra logic to cover this edge case in JavaScript:

This makes sense to me - could you please add this extra logic with expect / actual declarations for each target?

Alternatively, should we raise this as a Kotlin bug? I'd expect those methods to behave identically across platforms.

@russellbanks
Copy link
Contributor Author

Alternatively, should we raise this as a Kotlin bug? I'd expect those methods to behave identically across platforms.

I'm not sure with this honestly. Looking at the code in Kotlin, they just delegate the behaviour to their related platforms.

@stale
Copy link

stale bot commented Oct 22, 2023

This issue has been automatically marked as stale because it has not had any activity in the last 60 days. It will automatically be closed if no further activity occurs in the next seven days to enable maintainers to focus on the most important issues.
If this issue is still affecting you, please comment below within the next seven days.
Thank you for your contributions.

@stale stale bot added the stale label Oct 22, 2023
@stale
Copy link

stale bot commented Oct 29, 2023

This issue has been automatically closed because it has not had any recent activity.

@stale stale bot closed this Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants