From f7825f8591796914fb70b371f4f42f9eb356920e Mon Sep 17 00:00:00 2001 From: Youngmin Yoo Date: Mon, 19 Aug 2013 18:14:52 +0900 Subject: [PATCH] Update mod test --- color.rs | 64 -------------------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/color.rs b/color.rs index 901d099..772a8be 100644 --- a/color.rs +++ b/color.rs @@ -227,69 +227,6 @@ pub fn parse_by_name(name : &str) -> Option { } } -#[cfg(test)] -mod test { - use super::{rgb, rgba}; - use super::css_colors::*; - use super::parsing::parse_color; - - #[test] - fn test_parse_by_name() { - assert!(red().eq(&parse_color("red").unwrap())); - assert!(lime().eq(&parse_color("Lime").unwrap())); - assert!(blue().eq(&parse_color("BLUE").unwrap())); - assert!(green().eq(&parse_color("GreEN").unwrap())); - assert!(white().eq(&parse_color("white").unwrap())); - assert!(black().eq(&parse_color("Black").unwrap())); - assert!(gray().eq(&parse_color("Gray").unwrap())); - println("silver"); - assert!(silver().eq(&parse_color("SiLvEr").unwrap())); - assert!(maroon().eq(&parse_color("maroon").unwrap())); - assert!(purple().eq(&parse_color("PURPLE").unwrap())); - assert!(fuchsia().eq(&parse_color("FUCHSIA").unwrap())); - assert!(olive().eq(&parse_color("oLiVe").unwrap())); - assert!(yellow().eq(&parse_color("yellow").unwrap())); - assert!(navy().eq(&parse_color("NAVY").unwrap())); - assert!(teal().eq(&parse_color("Teal").unwrap())); - assert!(aqua().eq(&parse_color("Aqua").unwrap())); - assert!(None == parse_color("foobarbaz")); - } - - #[test] - fn test_parsing_rgb() { - assert!(red().eq(&parse_color("rgb(255,0,0)").unwrap())); - assert!(red().eq(&parse_color("rgba(255,0,0,1.0)").unwrap())); - assert!(red().eq(&parse_color("rgba(255,0,0,1)").unwrap())); - assert!(lime().eq(&parse_color("rgba(0,255,0,1.00)").unwrap())); - assert!(rgb(1u8,2u8,3u8).eq(&parse_color("rgb(1,2,03)").unwrap())); - assert!(rgba(15u8,250u8,3u8,0.5).eq(&parse_color("rgba(15,250,3,.5)").unwrap())); - assert!(rgba(15u8,250u8,3u8,0.5).eq(&parse_color("rgba(15,250,3,0.5)").unwrap())); - assert!(None == parse_color("rbga(1,2,3)")); - } - - #[test] - fn test_parsing_hsl() { - assert!(red().eq(&parse_color("hsl(0,1,.5)").unwrap())); - assert!(lime().eq(&parse_color("hsl(120.0,1.0,.5)").unwrap())); - assert!(blue().eq(&parse_color("hsl(240.0,1.0,.5)").unwrap())); - assert!(green().eq(&parse_color("hsl(120.0,1.0,.25)").unwrap())); - assert!(white().eq(&parse_color("hsl(1.0,1.,1.0)").unwrap())); - assert!(white().eq(&parse_color("hsl(129.0,0.3,1.0)").unwrap())); - assert!(black().eq(&parse_color("hsl(231.2,0.75,0.0)").unwrap())); - assert!(black().eq(&parse_color("hsl(11.2,0.0,0.0)").unwrap())); - assert!(gray().eq(&parse_color("hsl(0.0,0.0,0.5)").unwrap())); - assert!(maroon().eq(&parse_color("hsl(0.0,1.0,0.25)").unwrap())); - assert!(purple().eq(&parse_color("hsl(300.0,1.0,0.25)").unwrap())); - assert!(fuchsia().eq(&parse_color("hsl(300,1.0,0.5)").unwrap())); - assert!(olive().eq(&parse_color("hsl(60.,1.0,0.25)").unwrap())); - assert!(yellow().eq(&parse_color("hsl(60.,1.0,0.5)").unwrap())); - assert!(navy().eq(&parse_color("hsl(240.0,1.0,.25)").unwrap())); - assert!(teal().eq(&parse_color("hsl(180.0,1.0,.25)").unwrap())); - assert!(aqua().eq(&parse_color("hsl(180.0,1.0,.5)").unwrap())); - assert!(None == parse_color("hsl(1,2,3,.4)")); - } -} - // Define the colors specified by css define_color!(ALICEBLUE, 240, 248, 255) define_color!(ANTIQUEWHITE, 250, 235, 215) @@ -478,4 +415,3 @@ mod test { assert!(None == parse_color("hsl(1,2,3,.4)")); } } ->>>>>>> 23872aa... Update