-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,6 +252,8 @@ impl ManifestFile { | |
|
||
#[cfg(test)] | ||
mod tests { | ||
use core::str; | ||
|
||
use super::*; | ||
|
||
#[test] | ||
|
@@ -291,4 +293,30 @@ mod tests { | |
} | ||
) | ||
} | ||
|
||
#[test] | ||
// A bunch of example manifests, where we just check that they serialize | ||
// without errors. No need to check the contents. | ||
fn successful_manifest() { | ||
let files = [ | ||
r#"{name = "foo", version = "1.0.0-alpha1+build", minimal_nickel_version = "1.9.0", authors = []}"#.as_bytes(), | ||
r#"{name = "foo", version = "1.0.0", minimal_nickel_version = "1.9.0", authors = ["Me <[email protected]>"]}"#.as_bytes(), | ||
r#"{name = "foo", version = "1.0.0", minimal_nickel_version = "1.9.0", authors = [], keywords = ["key"]}"#.as_bytes(), | ||
r#"{name = "foo", version = "1.0.0", minimal_nickel_version = "1.9.0", authors = [], license = "MIT"}"#.as_bytes(), | ||
r#"{name = "foo", version = "1.0.0", minimal_nickel_version = "1.9.0", authors = [], dependencies = { dep = 'Path "dep" }}"#.as_bytes(), | ||
r#"{name = "foo", version = "1.0.0", minimal_nickel_version = "1.9.0", authors = [], dependencies = { dep = 'Git { url = "https://example.com" }}}"#.as_bytes(), | ||
r#"{name = "foo", version = "1.0.0", minimal_nickel_version = "1.9.0", authors = [], dependencies = { dep = 'Git { url = "https://example.com", ref = 'Head }}}"#.as_bytes(), | ||
r#"{name = "foo", version = "1.0.0", minimal_nickel_version = "1.9.0", authors = [], dependencies = { dep = 'Git { url = "https://example.com", ref = 'Branch "b" }}}"#.as_bytes(), | ||
r#"{name = "foo", version = "1.0.0", minimal_nickel_version = "1.9.0", authors = [], dependencies = { dep = 'Git { url = "https://example.com", ref = 'Tag "t" }}}"#.as_bytes(), | ||
r#"{name = "foo", version = "1.0.0", minimal_nickel_version = "1.9.0", authors = [], dependencies = { dep = 'Git { url = "https://example.com", ref = 'Commit "0c0a82aa4a05cd84ba089bdba2e6a1048058f41b" }}}"#.as_bytes(), | ||
r#"{name = "foo", version = "1.0.0", minimal_nickel_version = "1.9.0", authors = [], dependencies = { dep = 'Git { url = "https://example.com", path = "subdir" }}}"#.as_bytes(), | ||
// TODO: add index dependencies, once they're supported | ||
]; | ||
|
||
for file in files { | ||
if let Err(e) = ManifestFile::from_contents(file) { | ||
panic!("contents {}, error {e}", str::from_utf8(file).unwrap()); | ||
} | ||
} | ||
} | ||
} |