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

Fix AA iteration order dependency in test/runnable/foreach.d #11391

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions test/runnable/foreach.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ a[2] = 23
a[] = 21
a[] = 22
a[] = 23
a[foo] = 3
a[bar] = 4
a = 63, b = 47, c = 83
a = 63, b = 48, c = 83
Success
Expand Down Expand Up @@ -230,16 +228,26 @@ void test7()

a["foo"] = 3;
a["bar"] = 4;
bool sawBar, sawFoo;
foreach (string s, uint v; a)
{
printf("a[%.*s] = %d\n", cast(int)s.length, s.ptr, v);
if (s == "bar")
{
assert(v == 4);
assert(!sawBar);
sawBar = true;
}
else if (s == "foo")
{
assert(v == 3);
assert(!sawFoo);
sawFoo = true;
}
else
assert(0);
}
assert(sawBar);
assert(sawFoo);
}


Expand Down