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

Assignment operator not working in tests (a = a +1) #308

Closed
ptasz3k opened this issue Apr 13, 2020 · 2 comments · Fixed by #311
Closed

Assignment operator not working in tests (a = a +1) #308

ptasz3k opened this issue Apr 13, 2020 · 2 comments · Fixed by #311
Assignees
Labels
bug Something isn't working parser Issues surrounding the parser
Milestone

Comments

@ptasz3k
Copy link
Contributor

ptasz3k commented Apr 13, 2020

While implementing do..while loop i've noticed strange boa behavior. This test

#[test]
fn test_while_loop() {
    let src = r#"
        let a = 0;
        while (a < 10) a = a + 1;
        a
    "#;
    assert_eq!(exec(src), String::from("10"));
}

will run forever. Changing loop body to a += 1 makes test pass. Seems like using a = a + 1 does not assign rvalue to lvalue. This test fails too:

#[test]
fn test_addition() {
    let src = r#"
        let a = 0;
        a = a + 1;
        a
    "#;
    assert_eq!(exec(src), String::from("1"));
}

I haven't looked at it yet, as i have limited debug possibilities now (vs code in wsl remote mode does not support lldb and i can't build boa on native windows cause of some problem with jemalloc compilation). Waiting for wsl2.

And second thought: maybe it would be interesting to implement some timeout in tests, i found something looking good here: https://users.rust-lang.org/t/limit-execution-time-of-test/6687/3

@HalidOdat
Copy link
Member

Hmmm. Interesting, I will take look to see what causing this.

@HalidOdat
Copy link
Member

Good news! Found the bug. I will create a pr as soon as possible.

@Razican Razican added bug Something isn't working parser Issues surrounding the parser labels Apr 13, 2020
@Razican Razican added this to the v0.8.0 milestone Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser Issues surrounding the parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants