mirror of
https://github.com/rustsec/advisory-db.git
synced 2025-12-27 01:54:07 -05:00
Add test to ensure Advisories.toml is well-formed
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
target
|
||||
Cargo.lock
|
||||
11
.travis.yml
Normal file
11
.travis.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
language: rust
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
rust:
|
||||
- stable
|
||||
|
||||
notifications:
|
||||
irc: 'irc.mozilla.org#rustsec'
|
||||
11
Cargo.toml
Normal file
11
Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "rustsec-advisory-db"
|
||||
version = "0.0.0"
|
||||
authors = ["Tony Arcieri <bascule@gmail.com>"]
|
||||
repository = "https://github.com/rustsec/advisory-db"
|
||||
documentation = "https://github.com/rustsec/advisory-db"
|
||||
categories = ["api-bindings", "development-tools"]
|
||||
keywords = ["rustsec", "security", "advisory", "vulnerability"]
|
||||
|
||||
[dependencies]
|
||||
rustsec = "^0.2"
|
||||
25
src/lib.rs
Normal file
25
src/lib.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
extern crate rustsec;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
// Name of the advisory database in the current repo
|
||||
const ADVISORY_DB_FILE: &'static str = "Advisories.toml";
|
||||
|
||||
use rustsec::AdvisoryDatabase;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
fn advisories_toml_is_well_formed() {
|
||||
let path = Path::new(ADVISORY_DB_FILE);
|
||||
|
||||
let mut file = File::open(&path).unwrap();
|
||||
|
||||
let mut toml = String::new();
|
||||
file.read_to_string(&mut toml).unwrap();
|
||||
|
||||
// Ensure Advisories.toml parses
|
||||
AdvisoryDatabase::from_toml(&toml).unwrap();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user