Crates.io | indentasy |
lib.rs | indentasy |
version | 0.3.0 |
source | src |
created_at | 2021-11-09 04:16:21.641492 |
updated_at | 2021-12-09 01:18:32.306098 |
description | Indent like a party |
homepage | |
repository | https://github.com/haoadoresorange/indentasy.git |
max_upload_size | |
id | 478740 |
size | 4,983 |
Indent like a party
Rust implementation of https://cwestblog.com/2014/01/02/javascript-indenting-text/
fn hello_newline_world() {
assert_eq!(" hello\n world", indentasy::indent("hello\nworld", 1, 4));
}
fn newline_hello_newline_world() {
assert_eq!(
"\n hello\n world",
indentasy::indent("\nhello\nworld", 1, 4)
);
}
fn hello_newline_world_indent_with_tab() {
assert_eq!("\thello\n\tworld", indentasy::indent("hello\nworld", 1, 0));
}
fn hello_newline_world_with_String() {
assert_eq!(
" hello\n world",
indentasy::indent("hello\nworld".to_string(), 1, 4)
);
}