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

strange string behaviour #52

Closed
bgalek opened this issue Jun 27, 2024 · 0 comments
Closed

strange string behaviour #52

bgalek opened this issue Jun 27, 2024 · 0 comments

Comments

@bgalek
Copy link
Member

bgalek commented Jun 27, 2024

When trying to invoke o "stratsWith" method from String.class using opel expression, we found out that 'test'.startsWith('\t') or 'newtest.startsWith('\n') evaluates to true - which seems wrong.

    @Unroll
    def 'should return true!'() {
        given:
        def engine = new OpelEngineBuilder().build()

        expect:
        engine.eval(input).get() == expResult

        where:
        input                      || expResult
        /'atest'.startsWith('\a')/ || false
        /'test'.startsWith('\t')/  || false
        /'test'.startsWith('\c')/  || false
    }

Current opel implementation simply removes \ character leaving 't' or 'n' behind.

Let's handle \n,\t,\r explicitly.

bgalek added a commit that referenced this issue Jun 27, 2024
bgalek added a commit that referenced this issue Jun 27, 2024
bgalek added a commit that referenced this issue Jun 27, 2024
bgalek added a commit that referenced this issue Jun 27, 2024
bgalek added a commit that referenced this issue Jun 27, 2024
bgalek added a commit that referenced this issue Jun 27, 2024
@bgalek bgalek closed this as completed in b2d81fb Jun 28, 2024
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