Skip to content

Commit

Permalink
Fix clippy install. Add more illustrative remap tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nabijaczleweli committed Feb 24, 2018
1 parent 7554849 commit dc600c6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ script:
- if [ "$LANGUAGE" == "Rust" ]; then cargo build --verbose; fi
- if [ "$LANGUAGE" == "Rust" ]; then cargo test --verbose; fi
- if [ "$LANGUAGE" == "Rust" ] && [ "$CLIPPY" ]; then
cargo install clippy cargo-update;
cargo install-update -a;
cargo install -f clippy;
cargo clippy;
fi

Expand Down
23 changes: 23 additions & 0 deletions tests/dialect/remap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,26 @@ fn hard() {

assert_eq!(mapping.decode(0x41), 'Ź');
}

#[test]
fn double() {
assert_eq!(CP437_WINGDINGS.encode('Ź'), None);
assert_eq!(CP437_WINGDINGS.encode('A'), Some(0x41));
assert_eq!(CP437_WINGDINGS.encode('√'), Some(0xFB));
assert_eq!(CP437_WINGDINGS.encode('✓'), Some(0xFB));

assert_eq!(CP437_WINGDINGS.decode(0x41), 'A');
assert_eq!(CP437_WINGDINGS.decode(0xFB), '√');

let mut mapping = CP437_WINGDINGS.clone();
mapping.remap(0x41, 'Ź');
mapping.remap(0xFB, '✓');

assert_eq!(mapping.encode('Ź'), Some(0x41));
assert_eq!(mapping.encode('A'), Some(0x41)); // NB: still holds
assert_eq!(mapping.encode('√'), Some(0xFB));
assert_eq!(mapping.encode('✓'), Some(0xFB));

assert_eq!(mapping.decode(0x41), 'Ź');
assert_eq!(mapping.decode(0xFB), '✓');
}

0 comments on commit dc600c6

Please sign in to comment.