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

Implement for loop #374

Merged
merged 4 commits into from
May 7, 2020
Merged

Implement for loop #374

merged 4 commits into from
May 7, 2020

Conversation

akryvomaz
Copy link
Contributor

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks real good! Thanks for your contribution. I am missing tests for the initialization and the step though, could you add them?

@akryvomaz
Copy link
Contributor Author

@Razican do you mean something like this for initialization test?

let a = ''
for (let b = 'hello, ', c = 'world'; a.length < 1;) {
    a = b + c
}
assert_eq!(a, 'hello, world')

Do you have an idea for a good step test?

@Razican
Copy link
Member

Razican commented May 7, 2020

@Razican do you mean something like this for initialization test?

let a = ''
for (let b = 'hello, ', c = 'world'; a.length < 1;) {
    a = b + c
}
assert_eq!(a, 'hello, world')

Do you have an idea for a good step test?

Something we could do for both would be something like this:

let a = "hello";
let b = '';
for (var i = 0; i < a.length; i = i + 1) {
    b = b + a[i];
}
b;

Which should equal to "hello". Note that i++ is not implemented yet.

Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good to go for me!

boa/src/exec/tests.rs Outdated Show resolved Hide resolved
@Razican Razican added this to the v0.8.0 milestone May 7, 2020
@Razican Razican added the enhancement New feature or request label May 7, 2020
@Razican Razican merged commit 75cf44a into boa-dev:master May 7, 2020
@Razican Razican linked an issue May 7, 2020 that may be closed by this pull request
@akryvomaz akryvomaz deleted the for_loop branch May 7, 2020 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement for loop execution
3 participants