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

std.csv assert messages #7038

Merged
merged 1 commit into from
May 30, 2019
Merged

Conversation

burner
Copy link
Member

@burner burner commented May 24, 2019

No description provided.

@burner burner requested a review from andralex as a code owner May 24, 2019 14:00
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @burner!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + phobos#7038"

@thewilsonator thewilsonator added the 72h no objection -> merge The PR will be merged if there are no objections raised. label May 24, 2019
@burner
Copy link
Member Author

burner commented May 24, 2019

@thewilsonator thank you

std/csv.d Outdated
@@ -989,7 +989,7 @@ public:
*/
@property auto front()
{
assert(!empty);
assert(!empty, "An empty range has no front element");
Copy link
Contributor

Choose a reason for hiding this comment

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

More consistent with the messages in range code (std/range/package.d) would be:

"Attempting to fetch the front of an empty CsvReader"

std/csv.d Outdated
@@ -1224,7 +1224,7 @@ public:
*/
@property Contents front() @safe pure
{
assert(!empty);
assert(!empty, "An empty range has no front element");
Copy link
Contributor

Choose a reason for hiding this comment

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

More consistent with the messages in range code (std/range/package.d) would be:

"Attempting to fetch the front of an empty CsvRecord"

std/csv.d Outdated
@@ -1425,7 +1425,7 @@ if (isSomeChar!Separator && isInputRange!Range

while (!input.empty)
{
assert(!(quoted && escQuote));
assert(!(quoted && escQuote), "Invalid quotation state");
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding the function to the message in some fashion. This is often helpful when debugging. eg.

"Invalid quotation state in csvNextToken"

Copy link
Contributor

Choose a reason for hiding this comment

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

Just realized this is part of a much larger effort to add messages to all asserts. (Fantastic!) So, ignore my comment about this specific case and instead be consistent across all cases.

FWIW, I've benefitted when the assert messages include a reference to the code construct that is asserting. This has even been helpful to tracking down bugs in Phobos. But most important is that there is an assert message.

@burner
Copy link
Member Author

burner commented May 28, 2019

@jondegenhardt thank you for the review

@jondegenhardt
Copy link
Contributor

LGTM. Thanks for making the changes.

@burner
Copy link
Member Author

burner commented May 28, 2019

@jondegenhardt that's what review is for

@thewilsonator thewilsonator added auto-merge and removed 72h no objection -> merge The PR will be merged if there are no objections raised. labels May 30, 2019
@thewilsonator
Copy link
Contributor

@burner please do remind me about these when I forget, (unless you've forgotten too...).

@burner
Copy link
Member Author

burner commented May 30, 2019

@thewilsonator sure thing, thanks

@dlang-bot dlang-bot merged commit 097fdc5 into dlang:master May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants