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

Numeric literal symbols (! # &) are removed from transpiled params #320

Open
luis-j-soares opened this issue Feb 28, 2025 · 0 comments
Open

Comments

@luis-j-soares
Copy link
Contributor

This test fails:

@it("matches a numeric value")
@params(10.23!, "Float")
@params(10.23#, "Double")
@params(10&, "LongInteger")
sub _(number as Dynamic, expectedType as String)
    m.assertEqual(rooibos.common.getSafeType(number), expectedType)
end sub
    ✔ matches a numeric value 0 [10.23,"Float"]
    ✖ matches a numeric value 1 [10.23,"Double"]
    ✖ matches a numeric value 2 [10,"LongInteger"]

           matches a numeric value 1:

    AssertionError: expected ""Float"" to equal ""Double""
      + expected - actual

      -"Float"
      +"Double"

            matches a numeric value 2:

    AssertionError: expected ""Integer"" to equal ""LongInteger""
      + expected - actual

      -"Integer"
      +"LongInteger"

This is because the symbols get stripped from the literals when generating rawParams:

[
    {
        isSolo: false
        noCatch: false
        funcName: "FullColdStartWithProfilesMatcher_matches_a_numeric_value"
        isIgnored: false
        isAsync: false
        asyncTimeout: 2000
        slow: 75
        isParamTest: true
        name: "matches a numeric value"
        lineNumber: 14
        paramLineNumber: 11
        assertIndex: 0
        rawParams: [
            10.23 ' <-- missing !
            "Float"
        ]
        paramTestIndex: 0
        expectedNumberOfParams: 2
        isParamsValid: true
    }
    {
        isSolo: false
        noCatch: false
        funcName: "FullColdStartWithProfilesMatcher_matches_a_numeric_value"
        isIgnored: false
        isAsync: false
        asyncTimeout: 2000
        slow: 75
        isParamTest: true
        name: "matches a numeric value"
        lineNumber: 14
        paramLineNumber: 12
        assertIndex: 0
        rawParams: [
            10.23 ' <-- missing #
            "Double"
        ]
        paramTestIndex: 1
        expectedNumberOfParams: 2
        isParamsValid: true
    }
    {
        isSolo: false
        noCatch: false
        funcName: "FullColdStartWithProfilesMatcher_matches_a_numeric_value"
        isIgnored: false
        isAsync: false
        asyncTimeout: 2000
        slow: 75
        isParamTest: true
        name: "matches a numeric value"
        lineNumber: 14
        paramLineNumber: 13
        assertIndex: 0
        rawParams: [
            10 ' <-- missing &
            "LongInteger"
        ]
        paramTestIndex: 2
        expectedNumberOfParams: 2
        isParamsValid: true
    }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant