Skip to content

docs: fix [n/.] separator example output (12.345.0 → 12.345,0) - #15

Closed
pacocartones wants to merge 1 commit into
kurtlawrence:mainfrom
pacocartones:fix/readme-period-separator-decimal-marker
Closed

pacocartones wants to merge 1 commit into
kurtlawrence:mainfrom
pacocartones:fix/readme-period-separator-decimal-marker

Conversation

@pacocartones

Copy link
Copy Markdown

The README 'Separator' example asserts the wrong output for the [n/.] case:

f = "[n/.]".parse().unwrap(); // use a period
assert_eq!(f.fmt(12345.0), "12.345.0");

Choosing a period as the thousands separator switches the decimal marker to a comma, so the current release produces "12.345,0", not "12.345.0". This is confirmed by the crate's own module doc-comment, which is compiled as a doctest and asserts the correct value for the identical call:

//! f = "[n/.]".parse().unwrap(); // use period and commas
//! assert_eq!(f.fmt(12345.0), "12.345,0");

The //! doctest was updated when the behaviour changed but the README example was not (the README is not run as a doctest). This one-line fix aligns the README with the tested behaviour and clarifies the comment. No code change.

@pacocartones

Copy link
Copy Markdown
Author

Withdrawing this — on reflection the repo's low recent activity makes a doc nitpick like this not worth your review time. Apologies for the noise.

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.

1 participant