-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support alternative template file encodings (#179)
- Loading branch information
1 parent
18b22cb
commit fee0741
Showing
9 changed files
with
104 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//! tests that ensure the special encoding fixtures are left untouched | ||
#[test] | ||
fn utf8() { | ||
let bytes = &include_bytes!("fixtures/encodings/utf8.tera")[..3]; | ||
assert_eq!( | ||
bytes, b"---", | ||
"fixtures/encodings/utf8.tera needs to be re-encoded to UTF-8" | ||
); | ||
} | ||
|
||
#[test] | ||
fn utf8bom() { | ||
let bytes = &include_bytes!("fixtures/encodings/utf8bom.tera")[..6]; | ||
assert_eq!( | ||
bytes, b"\xEF\xBB\xBF---", | ||
"fixtures/encodings/utf8bom.tera needs to be re-encoded to UTF-8 with BOM" | ||
); | ||
} | ||
|
||
#[test] | ||
fn utf16be() { | ||
let bytes = &include_bytes!("fixtures/encodings/utf16be.tera")[..2]; | ||
assert_eq!( | ||
bytes, b"\xFE\xFF", | ||
"fixtures/encodings/utf16be.tera needs to be re-encoded to UTF-16 BE" | ||
); | ||
} | ||
|
||
#[test] | ||
fn utf16le() { | ||
let bytes = &include_bytes!("fixtures/encodings/utf16le.tera")[..2]; | ||
assert_eq!( | ||
bytes, b"\xFF\xFE", | ||
"fixtures/encodings/utf16le.tera needs to be re-encoded to UTF-16 LE" | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
The fixtures in this directory are encoded in various formats to test the encoding detection and decoding capabilities of Whiskers. | ||
|
||
Some text editors like to normalize the encoding of files when saving them. Please be careful not to change them unintentionally. | ||
|
||
There are tests in `tests/encodings.rs` that ensure these fixtures are not unintentionally changed. |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
whiskers: | ||
version: "2.0" | ||
--- | ||
it worked! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
whiskers: | ||
version: "2.0" | ||
--- | ||
it worked! |