Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Commit f7825f8

Browse files
committed
Update mod test
1 parent 9549be4 commit f7825f8

File tree

1 file changed

+0
-64
lines changed

1 file changed

+0
-64
lines changed

color.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -227,69 +227,6 @@ pub fn parse_by_name(name : &str) -> Option<Color> {
227227
}
228228
}
229229
230-
#[cfg(test)]
231-
mod test {
232-
use super::{rgb, rgba};
233-
use super::css_colors::*;
234-
use super::parsing::parse_color;
235-
236-
#[test]
237-
fn test_parse_by_name() {
238-
assert!(red().eq(&parse_color("red").unwrap()));
239-
assert!(lime().eq(&parse_color("Lime").unwrap()));
240-
assert!(blue().eq(&parse_color("BLUE").unwrap()));
241-
assert!(green().eq(&parse_color("GreEN").unwrap()));
242-
assert!(white().eq(&parse_color("white").unwrap()));
243-
assert!(black().eq(&parse_color("Black").unwrap()));
244-
assert!(gray().eq(&parse_color("Gray").unwrap()));
245-
println("silver");
246-
assert!(silver().eq(&parse_color("SiLvEr").unwrap()));
247-
assert!(maroon().eq(&parse_color("maroon").unwrap()));
248-
assert!(purple().eq(&parse_color("PURPLE").unwrap()));
249-
assert!(fuchsia().eq(&parse_color("FUCHSIA").unwrap()));
250-
assert!(olive().eq(&parse_color("oLiVe").unwrap()));
251-
assert!(yellow().eq(&parse_color("yellow").unwrap()));
252-
assert!(navy().eq(&parse_color("NAVY").unwrap()));
253-
assert!(teal().eq(&parse_color("Teal").unwrap()));
254-
assert!(aqua().eq(&parse_color("Aqua").unwrap()));
255-
assert!(None == parse_color("foobarbaz"));
256-
}
257-
258-
#[test]
259-
fn test_parsing_rgb() {
260-
assert!(red().eq(&parse_color("rgb(255,0,0)").unwrap()));
261-
assert!(red().eq(&parse_color("rgba(255,0,0,1.0)").unwrap()));
262-
assert!(red().eq(&parse_color("rgba(255,0,0,1)").unwrap()));
263-
assert!(lime().eq(&parse_color("rgba(0,255,0,1.00)").unwrap()));
264-
assert!(rgb(1u8,2u8,3u8).eq(&parse_color("rgb(1,2,03)").unwrap()));
265-
assert!(rgba(15u8,250u8,3u8,0.5).eq(&parse_color("rgba(15,250,3,.5)").unwrap()));
266-
assert!(rgba(15u8,250u8,3u8,0.5).eq(&parse_color("rgba(15,250,3,0.5)").unwrap()));
267-
assert!(None == parse_color("rbga(1,2,3)"));
268-
}
269-
270-
#[test]
271-
fn test_parsing_hsl() {
272-
assert!(red().eq(&parse_color("hsl(0,1,.5)").unwrap()));
273-
assert!(lime().eq(&parse_color("hsl(120.0,1.0,.5)").unwrap()));
274-
assert!(blue().eq(&parse_color("hsl(240.0,1.0,.5)").unwrap()));
275-
assert!(green().eq(&parse_color("hsl(120.0,1.0,.25)").unwrap()));
276-
assert!(white().eq(&parse_color("hsl(1.0,1.,1.0)").unwrap()));
277-
assert!(white().eq(&parse_color("hsl(129.0,0.3,1.0)").unwrap()));
278-
assert!(black().eq(&parse_color("hsl(231.2,0.75,0.0)").unwrap()));
279-
assert!(black().eq(&parse_color("hsl(11.2,0.0,0.0)").unwrap()));
280-
assert!(gray().eq(&parse_color("hsl(0.0,0.0,0.5)").unwrap()));
281-
assert!(maroon().eq(&parse_color("hsl(0.0,1.0,0.25)").unwrap()));
282-
assert!(purple().eq(&parse_color("hsl(300.0,1.0,0.25)").unwrap()));
283-
assert!(fuchsia().eq(&parse_color("hsl(300,1.0,0.5)").unwrap()));
284-
assert!(olive().eq(&parse_color("hsl(60.,1.0,0.25)").unwrap()));
285-
assert!(yellow().eq(&parse_color("hsl(60.,1.0,0.5)").unwrap()));
286-
assert!(navy().eq(&parse_color("hsl(240.0,1.0,.25)").unwrap()));
287-
assert!(teal().eq(&parse_color("hsl(180.0,1.0,.25)").unwrap()));
288-
assert!(aqua().eq(&parse_color("hsl(180.0,1.0,.5)").unwrap()));
289-
assert!(None == parse_color("hsl(1,2,3,.4)"));
290-
}
291-
}
292-
293230
// Define the colors specified by css
294231
define_color!(ALICEBLUE, 240, 248, 255)
295232
define_color!(ANTIQUEWHITE, 250, 235, 215)
@@ -478,4 +415,3 @@ mod test {
478415
assert!(None == parse_color("hsl(1,2,3,.4)"));
479416
}
480417
}
481-
>>>>>>> 23872aa... Update

0 commit comments

Comments
 (0)