We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a15f780 + cd08794 commit 8784d09Copy full SHA for 8784d09
src/web/badge/badge.rs
@@ -53,6 +53,9 @@ impl Badge {
53
};
54
let v_metrics = font.v_metrics(scale);
55
let offset = point(0.0, v_metrics.ascent);
56
+ if options.status.is_empty() || options.subject.is_empty() {
57
+ return Err(String::from("status and subject must not be empty"));
58
+ }
59
Ok(Badge {
60
options: options,
61
font: font,
@@ -145,6 +148,14 @@ mod tests {
145
148
#[test]
146
149
fn test_new() {
147
150
assert!(Badge::new(options()).is_ok());
151
+
152
+ let mut bad_options_status = options();
153
+ bad_options_status.status = "".to_owned();
154
+ assert!(Badge::new(bad_options_status).is_err());
155
156
+ let mut bad_options_subject = options();
157
+ bad_options_subject.subject = "".to_owned();
158
+ assert!(Badge::new(bad_options_subject).is_err());
159
}
160
161
0 commit comments