Skip to content

tests: Add an integration test for static arrays. #457

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

Merged
merged 2 commits into from
Jan 29, 2017

Conversation

emilio
Copy link
Contributor

@emilio emilio commented Jan 29, 2017

Turns out they were broken before
#456.

Let's test it so it doesn't regress.

r? @fitzgen

@highfive
Copy link

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Thanks!

let also_expected = unsafe { bindings::Test_COUNTDOWN_PTR };
assert!(!test.is_null());
assert_eq!(also_expected, expected, "Pointer value was bogus");
assert_eq!(test, also_expected, "Array value was bogus");
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: Assertion diagnostic messages should describe expectations, not explain what happens when things go wrong. Expectations read fine whether the assertion is passing (ie when I happen to be reading this code) or when it is printed out because of assertion failure. What is written here only reads OK if the assertion is failing.

Here is my suggested wording:

bindings::Test_COUNTDOWN.as_ptr() should be the same as bindings::Test_countdown()

but in this particular case, I think the default assert_eq message should be fine.

Turns out they were broken before
rust-lang#456.

Let's test it so it doesn't regress.
These aren't extremely great, since this usually requires extra bookkeeping. But
C allows it, so let's keep the same semantics.
@emilio
Copy link
Contributor Author

emilio commented Jan 29, 2017

@bors-servo r=fitzgen

Thanks for the review Nick :)

@bors-servo
Copy link

📌 Commit fedca48 has been approved by fitzgen

@bors-servo
Copy link

⌛ Testing commit fedca48 with merge 3ef1a27...

bors-servo pushed a commit that referenced this pull request Jan 29, 2017
tests: Add an integration test for static arrays.

Turns out they were broken before
#456.

Let's test it so it doesn't regress.

r? @fitzgen
@bors-servo
Copy link

☀️ Test successful - status-travis

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

Successfully merging this pull request may close these issues.

4 participants