-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ID generator v0.2 on builder
To avoid leaking internal logic, the v0.2 ID generator is now a method on the parser builder.
- Loading branch information
1 parent
108f2ee
commit 4c43ae1
Showing
3 changed files
with
34 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use std::fs; | ||
use std::path::PathBuf; | ||
|
||
use feed_rs::parser; | ||
|
||
// Verify we can generate IDs that are compatible with v0.2 | ||
#[test] | ||
fn test_feed_ids_v0_2() { | ||
let mut test_file = PathBuf::from(env!("CARGO_MANIFEST_DIR")); | ||
test_file.push("fixture/rss2/rss_2.0_kdist.xml"); | ||
let test_data = fs::read(test_file).unwrap(); | ||
|
||
// Use the v0.2 ID generator | ||
let feed = parser::Builder::new().id_generator_v0_2().build().parse(test_data.as_slice()).unwrap(); | ||
assert_eq!("7edcf1fbe86570753646f6eb75db4d55", feed.id); | ||
} |