Commit 42134064 authored by Scott Abbey's avatar Scott Abbey

Add tests

parent 386228b1
......@@ -45,13 +45,40 @@ mod tests {
use super::*;
#[test]
fn parse_version_core_01() {
fn parse_version_core() {
let version = "1.2.3";
let parsed = parse_version(version);
let parsed = parse_version(version).unwrap();
assert_eq!(1, parsed.major);
assert_eq!(2, parsed.minor);
assert_eq!(3, parsed.patch);
}
#[test]
fn parse_version_no_major_leading_zeroes() {
let version = "01.0.0";
let parsed = parse_version(version);
assert!(parsed.is_err(), "01 incorrectly considered a valid major version");
}
#[test]
fn parse_version_no_minor_leading_zeroes() {
let version = "0.01.0";
let parsed = parse_version(version);
assert!(parsed.is_err(), "01 incorrectly considered a valid minor version");
}
#[test]
fn parse_version_no_patch_leading_zeroes() {
let version = "0.0.01";
let parsed = parse_version(version);
assert!(parsed.is_err(), "01 incorrectly considered a valid patch version");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment