Skip to content

Commit

Permalink
test for string formatting. Fixes #19
Browse files Browse the repository at this point in the history
  • Loading branch information
starkat99 committed Oct 12, 2021
1 parent 45f4daf commit a3ccd68
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
associated iterators.
- Added `display` method to to both `UStr` and `UCStr` to display strings in formatting without heap
allocations, similar to `Path::display`. Fixes [#20].
- Added more trait implementations, including more index operations.
- Added more trait implementations, including more index operations and string formatting via
`Write` trait. Fixes [#19].
- Added new functions:
- `UStr::from_ptr_mut`
- `UStr::from_slice_mut`
Expand Down Expand Up @@ -190,6 +191,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[#2]: https://github.com/starkat99/widestring-rs/issues/2
[#14]: https://github.com/starkat99/widestring-rs/issues/14
[#18]: https://github.com/starkat99/widestring-rs/issues/18
[#19]: https://github.com/starkat99/widestring-rs/issues/19
[#20]: https://github.com/starkat99/widestring-rs/issues/20

[@nicbn]: https://github.com/nicbn
Expand Down
12 changes: 12 additions & 0 deletions src/ustring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1456,3 +1456,15 @@ pub type U32String = UString<u32>;
/// Alias for [`U16String`] or [`U32String`] depending on platform. Intended to match typical C
/// `wchar_t` size on platform.
pub type WideString = UString<WideChar>;

#[cfg(test)]
mod test {
use super::*;

#[test]
fn number_to_string() {
let mut s = U16String::new();
write!(s, "{}", 1234).unwrap();
assert_eq!(s, U16String::from_str("1234"));
}
}

0 comments on commit a3ccd68

Please sign in to comment.