Skip to content

Commit 06b30a4

Browse files
committed
WIP
Signed-off-by: Russell Currey <[email protected]>
1 parent ed6ea09 commit 06b30a4

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

examples/test.ron

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
private_key: "/home/ruscur/.ssh/id_rsa",
77
),
88
patchwork: (
9-
url: "https//patchwork.ozlabs.org"
9+
url: "https://patchwork.ozlabs.org"
1010
//username: "ruscur",
1111
//token: "bigchungus42069",
1212
)

src/config.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// snowpatch - continuous integration for patch-based workflows
33
//
4-
// Copyright (C) 2016 IBM Corporation
4+
// Copyright (C) 2021 IBM Corporation
55
// Authors:
66
// Russell Currey <[email protected]>
77
// Andrew Donnellan <[email protected]>
@@ -81,3 +81,32 @@ pub fn parse_config(filename: &str) -> Result<Config> {
8181

8282
Ok(config)
8383
}
84+
85+
#[cfg(test)]
86+
mod tests {
87+
use super::*;
88+
89+
#[test]
90+
fn validate_good_config() {
91+
let good_config: Config = Config {
92+
name: "linuxppc-dev".to_owned(),
93+
git: Git {
94+
user: "git".to_owned(),
95+
public_key: "/home/ruscur/.ssh/id_rsa.pub".to_owned(),
96+
private_key: "/home/ruscur/.ssh/id_rsa".to_owned(),
97+
},
98+
patchwork: Patchwork {
99+
url: "https://patchwork.ozlabs.org".to_owned(),
100+
port: None,
101+
token: None,
102+
},
103+
};
104+
105+
assert!(validate_config(&good_config).is_ok());
106+
}
107+
108+
#[test]
109+
fn parse_good_config() {
110+
assert!(parse_config("examples/tests/valid.ron").is_ok());
111+
}
112+
}

0 commit comments

Comments
 (0)