Use toml-query to get entry links header value

in imag-links tests
This commit is contained in:
Robert Ignat 2017-06-06 22:42:41 +02:00 committed by Matthias Beyer
parent cb62cf3edb
commit a34eda8c41
2 changed files with 6 additions and 5 deletions

View file

@ -19,6 +19,7 @@ clap = ">=2.17"
log = "0.3"
version = "2.0.1"
toml = "^0.4"
toml-query = "0.1"
url = "1.2"
[dependencies.libimagstore]

View file

@ -36,6 +36,7 @@
extern crate clap;
extern crate semver;
extern crate toml;
extern crate toml_query;
extern crate url;
#[macro_use] extern crate version;
@ -343,6 +344,8 @@ mod tests {
use clap::{App, ArgMatches};
use toml::value::Value;
use toml_query::read::TomlValueReadExt;
use toml_query::error::Result as TomlQueryResult;
use libimagrt::spec::CliSpec;
use libimagrt::runtime::Runtime;
@ -432,11 +435,8 @@ version = \"0.3.0\"\
Ok(id)
}
fn get_entry_links<'a>(entry: &'a FileLockEntry<'a>) -> Option<&'a Value> {
entry
.get_header()
.get("imag")
.and_then(|ih| ih.get("links"))
fn get_entry_links<'a>(entry: &'a FileLockEntry<'a>) -> TomlQueryResult<&'a Value> {
entry.get_header().read(&"imag.links".to_owned())
}
fn links_toml_value<'a, I: IntoIterator<Item = &'static str>>(links: I) -> Value {