Add version-string verification

This commit is contained in:
Matthias Beyer 2016-01-18 22:26:23 +01:00
parent dd11e32d82
commit b486960720

View file

@ -138,12 +138,16 @@ fn has_main_section(t: &Table) -> bool {
}
fn has_imag_version_in_main_section(t: &Table) -> bool {
use regex::Regex;
match t.get("imag").unwrap() {
&Value::Table(ref sec) => {
sec.get("version")
.and_then(|v| {
match v {
&Value::String(_) => Some(true),
&Value::String(ref s) => {
Some(Regex::new(r"^\d{1}\.\d{1}\.\d{1}(.*)").unwrap().is_match(&s[..]))
},
_ => Some(false),
}
})