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

Commit 6aa1a47

Browse files
committed
Update to 0.6
1 parent 200034f commit 6aa1a47

File tree

2 files changed

+88
-88
lines changed

2 files changed

+88
-88
lines changed

color.rs

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -192,57 +192,57 @@ mod test {
192192
193193
#[test]
194194
fn test_parse_by_name() {
195-
fail_unless!(red().eq(&unwrap(parse_color(~"red"))));
196-
fail_unless!(lime().eq(&unwrap(parse_color(~"Lime"))));
197-
fail_unless!(blue().eq(&unwrap(parse_color(~"BLUE"))));
198-
fail_unless!(green().eq(&unwrap(parse_color(~"GreEN"))));
199-
fail_unless!(white().eq(&unwrap(parse_color(~"white"))));
200-
fail_unless!(black().eq(&unwrap(parse_color(~"Black"))));
201-
fail_unless!(gray().eq(&unwrap(parse_color(~"Gray"))));
202-
fail_unless!(silver().eq(&unwrap(parse_color(~"SiLvEr"))));
203-
fail_unless!(maroon().eq(&unwrap(parse_color(~"maroon"))));
204-
fail_unless!(purple().eq(&unwrap(parse_color(~"PURPLE"))));
205-
fail_unless!(fuchsia().eq(&unwrap(parse_color(~"FUCHSIA"))));
206-
fail_unless!(olive().eq(&unwrap(parse_color(~"oLiVe"))));
207-
fail_unless!(yellow().eq(&unwrap(parse_color(~"yellow"))));
208-
fail_unless!(navy().eq(&unwrap(parse_color(~"NAVY"))));
209-
fail_unless!(teal().eq(&unwrap(parse_color(~"Teal"))));
210-
fail_unless!(aqua().eq(&unwrap(parse_color(~"Aqua"))));
211-
fail_unless!(None == parse_color(~"foobarbaz"));
195+
assert!(red().eq(&unwrap(parse_color(~"red"))));
196+
assert!(lime().eq(&unwrap(parse_color(~"Lime"))));
197+
assert!(blue().eq(&unwrap(parse_color(~"BLUE"))));
198+
assert!(green().eq(&unwrap(parse_color(~"GreEN"))));
199+
assert!(white().eq(&unwrap(parse_color(~"white"))));
200+
assert!(black().eq(&unwrap(parse_color(~"Black"))));
201+
assert!(gray().eq(&unwrap(parse_color(~"Gray"))));
202+
assert!(silver().eq(&unwrap(parse_color(~"SiLvEr"))));
203+
assert!(maroon().eq(&unwrap(parse_color(~"maroon"))));
204+
assert!(purple().eq(&unwrap(parse_color(~"PURPLE"))));
205+
assert!(fuchsia().eq(&unwrap(parse_color(~"FUCHSIA"))));
206+
assert!(olive().eq(&unwrap(parse_color(~"oLiVe"))));
207+
assert!(yellow().eq(&unwrap(parse_color(~"yellow"))));
208+
assert!(navy().eq(&unwrap(parse_color(~"NAVY"))));
209+
assert!(teal().eq(&unwrap(parse_color(~"Teal"))));
210+
assert!(aqua().eq(&unwrap(parse_color(~"Aqua"))));
211+
assert!(None == parse_color(~"foobarbaz"));
212212
}
213213
214214
#[test]
215215
fn test_parsing_rgb() {
216-
fail_unless!(red().eq(&unwrap(parse_color(~"rgb(255,0,0)"))));
217-
fail_unless!(red().eq(&unwrap(parse_color(~"rgba(255,0,0,1.0)"))));
218-
fail_unless!(red().eq(&unwrap(parse_color(~"rgba(255,0,0,1)"))));
219-
fail_unless!(lime().eq(&unwrap(parse_color(~"rgba(0,255,0,1.00)"))));
220-
fail_unless!(rgb(1u8,2u8,3u8).eq(&unwrap(parse_color(~"rgb(1,2,03)"))));
221-
fail_unless!(rgba(15u8,250u8,3u8,0.5).eq(&unwrap(parse_color(~"rgba(15,250,3,.5)"))));
222-
fail_unless!(rgba(15u8,250u8,3u8,0.5).eq(&unwrap(parse_color(~"rgba(15,250,3,0.5)"))));
223-
fail_unless!(None == parse_color(~"rbga(1,2,3)"));
216+
assert!(red().eq(&unwrap(parse_color(~"rgb(255,0,0)"))));
217+
assert!(red().eq(&unwrap(parse_color(~"rgba(255,0,0,1.0)"))));
218+
assert!(red().eq(&unwrap(parse_color(~"rgba(255,0,0,1)"))));
219+
assert!(lime().eq(&unwrap(parse_color(~"rgba(0,255,0,1.00)"))));
220+
assert!(rgb(1u8,2u8,3u8).eq(&unwrap(parse_color(~"rgb(1,2,03)"))));
221+
assert!(rgba(15u8,250u8,3u8,0.5).eq(&unwrap(parse_color(~"rgba(15,250,3,.5)"))));
222+
assert!(rgba(15u8,250u8,3u8,0.5).eq(&unwrap(parse_color(~"rgba(15,250,3,0.5)"))));
223+
assert!(None == parse_color(~"rbga(1,2,3)"));
224224
}
225225
226226
#[test]
227227
fn test_parsing_hsl() {
228-
fail_unless!(red().eq(&unwrap(parse_color(~"hsl(0,1,.5)"))));
229-
fail_unless!(lime().eq(&unwrap(parse_color(~"hsl(120.0,1.0,.5)"))));
230-
fail_unless!(blue().eq(&unwrap(parse_color(~"hsl(240.0,1.0,.5)"))));
231-
fail_unless!(green().eq(&unwrap(parse_color(~"hsl(120.0,1.0,.25)"))));
232-
fail_unless!(white().eq(&unwrap(parse_color(~"hsl(1.0,1.,1.0)"))));
233-
fail_unless!(white().eq(&unwrap(parse_color(~"hsl(129.0,0.3,1.0)"))));
234-
fail_unless!(black().eq(&unwrap(parse_color(~"hsl(231.2,0.75,0.0)"))));
235-
fail_unless!(black().eq(&unwrap(parse_color(~"hsl(11.2,0.0,0.0)"))));
236-
fail_unless!(gray().eq(&unwrap(parse_color(~"hsl(0.0,0.0,0.5)"))));
237-
fail_unless!(maroon().eq(&unwrap(parse_color(~"hsl(0.0,1.0,0.25)"))));
238-
fail_unless!(purple().eq(&unwrap(parse_color(~"hsl(300.0,1.0,0.25)"))));
239-
fail_unless!(fuchsia().eq(&unwrap(parse_color(~"hsl(300,1.0,0.5)"))));
240-
fail_unless!(olive().eq(&unwrap(parse_color(~"hsl(60.,1.0,0.25)"))));
241-
fail_unless!(yellow().eq(&unwrap(parse_color(~"hsl(60.,1.0,0.5)"))));
242-
fail_unless!(navy().eq(&unwrap(parse_color(~"hsl(240.0,1.0,.25)"))));
243-
fail_unless!(teal().eq(&unwrap(parse_color(~"hsl(180.0,1.0,.25)"))));
244-
fail_unless!(aqua().eq(&unwrap(parse_color(~"hsl(180.0,1.0,.5)"))));
245-
fail_unless!(None == parse_color(~"hsl(1,2,3,.4)"));
228+
assert!(red().eq(&unwrap(parse_color(~"hsl(0,1,.5)"))));
229+
assert!(lime().eq(&unwrap(parse_color(~"hsl(120.0,1.0,.5)"))));
230+
assert!(blue().eq(&unwrap(parse_color(~"hsl(240.0,1.0,.5)"))));
231+
assert!(green().eq(&unwrap(parse_color(~"hsl(120.0,1.0,.25)"))));
232+
assert!(white().eq(&unwrap(parse_color(~"hsl(1.0,1.,1.0)"))));
233+
assert!(white().eq(&unwrap(parse_color(~"hsl(129.0,0.3,1.0)"))));
234+
assert!(black().eq(&unwrap(parse_color(~"hsl(231.2,0.75,0.0)"))));
235+
assert!(black().eq(&unwrap(parse_color(~"hsl(11.2,0.0,0.0)"))));
236+
assert!(gray().eq(&unwrap(parse_color(~"hsl(0.0,0.0,0.5)"))));
237+
assert!(maroon().eq(&unwrap(parse_color(~"hsl(0.0,1.0,0.25)"))));
238+
assert!(purple().eq(&unwrap(parse_color(~"hsl(300.0,1.0,0.25)"))));
239+
assert!(fuchsia().eq(&unwrap(parse_color(~"hsl(300,1.0,0.5)"))));
240+
assert!(olive().eq(&unwrap(parse_color(~"hsl(60.,1.0,0.25)"))));
241+
assert!(yellow().eq(&unwrap(parse_color(~"hsl(60.,1.0,0.5)"))));
242+
assert!(navy().eq(&unwrap(parse_color(~"hsl(240.0,1.0,.25)"))));
243+
assert!(teal().eq(&unwrap(parse_color(~"hsl(180.0,1.0,.25)"))));
244+
assert!(aqua().eq(&unwrap(parse_color(~"hsl(180.0,1.0,.5)"))));
245+
assert!(None == parse_color(~"hsl(1,2,3,.4)"));
246246
}
247247
}
248248

test.rs

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct NodeData {
3939

4040
impl VoidPtrLike for TestNode {
4141
fn from_void_ptr(node: *libc::c_void) -> TestNode {
42-
fail_unless!(node.is_not_null());
42+
assert!(node.is_not_null());
4343
TestNode(unsafe {
4444
let box = cast::reinterpret_cast(&node);
4545
cast::bump_box_refcount(box);
@@ -111,7 +111,7 @@ fn test_background_color_simple() {
111111
let style = "div { background-color: #123456; }";
112112
do single_div_test(style) |computed| {
113113
let color = computed.background_color();
114-
fail_unless!(color == Specified(rgb(0x12, 0x34, 0x56)));
114+
assert!(color == Specified(rgb(0x12, 0x34, 0x56)));
115115
}
116116
}
117117
@@ -120,7 +120,7 @@ fn test_border_top_width_px() {
120120
let style = "div { border-top-width: 10px; }";
121121
do single_div_test(style) |computed| {
122122
let width = computed.border_top_width();
123-
fail_unless!(width == Specified(CSSBorderWidthLength(Px(10.0))));
123+
assert!(width == Specified(CSSBorderWidthLength(Px(10.0))));
124124
}
125125
}
126126
@@ -129,7 +129,7 @@ fn test_border_right_width_px() {
129129
let style = "div { border-right-width: 10px; }";
130130
do single_div_test(style) |computed| {
131131
let width = computed.border_right_width();
132-
fail_unless!(width == Specified(CSSBorderWidthLength(Px(10.0))));
132+
assert!(width == Specified(CSSBorderWidthLength(Px(10.0))));
133133
}
134134
}
135135
@@ -138,7 +138,7 @@ fn test_border_bottom_width_px() {
138138
let style = "div { border-bottom-width: 10px; }";
139139
do single_div_test(style) |computed| {
140140
let width = computed.border_bottom_width();
141-
fail_unless!(width == Specified(CSSBorderWidthLength(Px(10.0))));
141+
assert!(width == Specified(CSSBorderWidthLength(Px(10.0))));
142142
}
143143
}
144144
@@ -147,7 +147,7 @@ fn test_border_left_width_px() {
147147
let style = "div { border-left-width: 10px; }";
148148
do single_div_test(style) |computed| {
149149
let width = computed.border_left_width();
150-
fail_unless!(width == Specified(CSSBorderWidthLength(Px(10.0))));
150+
assert!(width == Specified(CSSBorderWidthLength(Px(10.0))));
151151
}
152152
}
153153
@@ -156,13 +156,13 @@ fn test_border_width_px() {
156156
let style = "div { border-width: 10px; }";
157157
do single_div_test(style) |computed| {
158158
let width = computed.border_top_width();
159-
fail_unless!(width == Specified(CSSBorderWidthLength(Px(10.0))));
159+
assert!(width == Specified(CSSBorderWidthLength(Px(10.0))));
160160
let width = computed.border_right_width();
161-
fail_unless!(width == Specified(CSSBorderWidthLength(Px(10.0))));
161+
assert!(width == Specified(CSSBorderWidthLength(Px(10.0))));
162162
let width = computed.border_bottom_width();
163-
fail_unless!(width == Specified(CSSBorderWidthLength(Px(10.0))));
163+
assert!(width == Specified(CSSBorderWidthLength(Px(10.0))));
164164
let width = computed.border_left_width();
165-
fail_unless!(width == Specified(CSSBorderWidthLength(Px(10.0))));
165+
assert!(width == Specified(CSSBorderWidthLength(Px(10.0))));
166166
}
167167
}
168168
@@ -179,10 +179,10 @@ fn test_border_color() {
179179
let right_color = computed.border_right_color();
180180
let bottom_color = computed.border_bottom_color();
181181
let left_color = computed.border_left_color();
182-
fail_unless!(top_color == Specified(rgb(255, 0, 0)));
183-
fail_unless!(right_color == Specified(rgb(0, 128, 0)));
184-
fail_unless!(bottom_color == Specified(rgb(0, 0, 255)));
185-
fail_unless!(left_color == Specified(rgb(255, 255, 0)));
182+
assert!(top_color == Specified(rgb(255, 0, 0)));
183+
assert!(right_color == Specified(rgb(0, 128, 0)));
184+
assert!(bottom_color == Specified(rgb(0, 0, 255)));
185+
assert!(left_color == Specified(rgb(255, 255, 0)));
186186
}
187187
}
188188
@@ -196,10 +196,10 @@ fn test_border_color_shorthand() {
196196
let right_color = computed.border_right_color();
197197
let bottom_color = computed.border_bottom_color();
198198
let left_color = computed.border_left_color();
199-
fail_unless!(top_color == Specified(rgb(255, 0, 0)));
200-
fail_unless!(right_color == Specified(rgb(255, 0, 0)));
201-
fail_unless!(bottom_color == Specified(rgb(255, 0, 0)));
202-
fail_unless!(left_color == Specified(rgb(255, 0, 0)));
199+
assert!(top_color == Specified(rgb(255, 0, 0)));
200+
assert!(right_color == Specified(rgb(255, 0, 0)));
201+
assert!(bottom_color == Specified(rgb(255, 0, 0)));
202+
assert!(left_color == Specified(rgb(255, 0, 0)));
203203
}
204204
}
205205
@@ -212,62 +212,62 @@ fn test_margin() {
212212
margin-left: auto;\
213213
}";
214214
do single_div_test(style) |computed| {
215-
fail_unless!(computed.margin_top() == Specified(CSSMarginLength(Px(10.0))));
216-
fail_unless!(computed.margin_right() == Specified(CSSMarginLength(Px(20.0))));
217-
fail_unless!(computed.margin_bottom() == Specified(CSSMarginLength(Px(30.0))));
218-
fail_unless!(computed.margin_left() == Specified(CSSMarginAuto));
215+
assert!(computed.margin_top() == Specified(CSSMarginLength(Px(10.0))));
216+
assert!(computed.margin_right() == Specified(CSSMarginLength(Px(20.0))));
217+
assert!(computed.margin_bottom() == Specified(CSSMarginLength(Px(30.0))));
218+
assert!(computed.margin_left() == Specified(CSSMarginAuto));
219219
}
220220
}
221221
222222
#[test]
223223
fn test_display() {
224224
let style = "div { display: none; }";
225225
do single_div_test(style) |computed| {
226-
fail_unless!(computed.display(false) == Specified(CSSDisplayNone));
226+
assert!(computed.display(false) == Specified(CSSDisplayNone));
227227
}
228228
}
229229
230230
#[test]
231231
fn test_float() {
232232
let style = "div { float: right; }";
233233
do single_div_test(style) |computed| {
234-
fail_unless!(computed.float() == Specified(CSSFloatRight));
234+
assert!(computed.float() == Specified(CSSFloatRight));
235235
}
236236
}
237237
238238
#[test]
239239
fn test_position() {
240240
let style = "div { position: static; }";
241241
do single_div_test(style) |computed| {
242-
fail_unless!(computed.position() == Specified(CSSPositionStatic));
242+
assert!(computed.position() == Specified(CSSPositionStatic));
243243
}
244244
let style = "div { position: relative; }";
245245
do single_div_test(style) |computed| {
246-
fail_unless!(computed.position() == Specified(CSSPositionRelative));
246+
assert!(computed.position() == Specified(CSSPositionRelative));
247247
}
248248
let style = "div { position: absolute; }";
249249
do single_div_test(style) |computed| {
250-
fail_unless!(computed.position() == Specified(CSSPositionAbsolute));
250+
assert!(computed.position() == Specified(CSSPositionAbsolute));
251251
}
252252
let style = "div { position: fixed; }";
253253
do single_div_test(style) |computed| {
254-
fail_unless!(computed.position() == Specified(CSSPositionFixed));
254+
assert!(computed.position() == Specified(CSSPositionFixed));
255255
}
256256
}
257257
258258
#[test]
259259
fn test_width() {
260260
let style = "div { width: 10px; }";
261261
do single_div_test(style) |computed| {
262-
fail_unless!(computed.width() == Specified(CSSWidthLength(Px(10.0))));
262+
assert!(computed.width() == Specified(CSSWidthLength(Px(10.0))));
263263
}
264264
}
265265
266266
#[test]
267267
fn test_height() {
268268
let style = "div { height: 10px; }";
269269
do single_div_test(style) |computed| {
270-
fail_unless!(computed.height() == Specified(CSSHeightLength(Px(10.0))));
270+
assert!(computed.height() == Specified(CSSHeightLength(Px(10.0))));
271271
}
272272
}
273273
@@ -279,15 +279,15 @@ fn test_font_family_generic() {
279279
do single_div_test(style) |computed| {
280280
let fam = computed.font_family();
281281
let spec = Specified(~[CSSFontFamilyGenericFamily(Fantasy)]);
282-
fail_unless!(fam.eq(&spec));
282+
assert!(fam.eq(&spec));
283283
}
284284
}
285285
286286
#[test]
287287
fn test_font_family_specific() {
288288
let style = "div { font-family: Wombat, Jones; }";
289289
do single_div_test(style) |computed| {
290-
fail_unless!(computed.font_family() == Specified(~[
290+
assert!(computed.font_family() == Specified(~[
291291
CSSFontFamilyFamilyName(~"Wombat"),
292292
CSSFontFamilyFamilyName(~"Jones")
293293
]));
@@ -299,59 +299,59 @@ fn test_font_family_specific() {
299299
fn test_font_size() {
300300
let style = "div { font-size: 10pt; }";
301301
do single_div_test(style) |computed| {
302-
fail_unless!(computed.font_size() == Specified(CSSFontSizeLength(Pt(10.0))));
302+
assert!(computed.font_size() == Specified(CSSFontSizeLength(Pt(10.0))));
303303
}
304304
let style = "div { font-size: 10%; }";
305305
do single_div_test(style) |computed| {
306-
fail_unless!(computed.font_size() == Specified(CSSFontSizePercentage(10.0)));
306+
assert!(computed.font_size() == Specified(CSSFontSizePercentage(10.0)));
307307
}
308308
let style = "div { font-size: small; }";
309309
do single_div_test(style) |computed| {
310-
fail_unless!(computed.font_size() == Specified(CSSFontSizeAbsoluteSize(Small)));
310+
assert!(computed.font_size() == Specified(CSSFontSizeAbsoluteSize(Small)));
311311
}
312312
let style = "div { font-size: smaller; }";
313313
do single_div_test(style) |computed| {
314-
fail_unless!(computed.font_size() == Specified(CSSFontSizeRelativeSize(Smaller)));
314+
assert!(computed.font_size() == Specified(CSSFontSizeRelativeSize(Smaller)));
315315
}
316316
}
317317
318318
#[test]
319319
fn test_font_style() {
320320
let style = "div { font-style: oblique; }";
321321
do single_div_test(style) |computed| {
322-
fail_unless!(computed.font_style() == Specified(CSSFontStyleOblique));
322+
assert!(computed.font_style() == Specified(CSSFontStyleOblique));
323323
}
324324
}
325325
326326
#[test]
327327
fn test_font_weight() {
328328
let style = "div { font-weight: bold; }";
329329
do single_div_test(style) |computed| {
330-
fail_unless!(computed.font_weight() == Specified(CSSFontWeightBold));
330+
assert!(computed.font_weight() == Specified(CSSFontWeightBold));
331331
}
332332
}
333333
334334
#[test]
335335
fn test_text_align() {
336336
let style = "div { text-align: center; }";
337337
do single_div_test(style) |computed| {
338-
fail_unless!(computed.text_align() == Specified(CSSTextAlignCenter));
338+
assert!(computed.text_align() == Specified(CSSTextAlignCenter));
339339
}
340340
}
341341
342342
#[test]
343343
fn test_id_selector() {
344344
let style = "#id1 { text-align: center; }";
345345
do single_div_test(style) |computed| {
346-
fail_unless!(computed.text_align() == Specified(CSSTextAlignCenter));
346+
assert!(computed.text_align() == Specified(CSSTextAlignCenter));
347347
}
348348
}
349349
350350
#[test]
351351
fn test_line_height() {
352352
let style = "div { line-height: 2; }";
353353
do single_div_test(style) |computed| {
354-
fail_unless!(computed.line_height() == Specified(CSSLineHeightNumber(2.0)));
354+
assert!(computed.line_height() == Specified(CSSLineHeightNumber(2.0)));
355355
}
356356
}
357357
@@ -385,7 +385,7 @@ fn test_child() {
385385
let style = "div > span { border-left-width: 10px; }";
386386
do child_test(style) |computed| {
387387
let width = computed.border_left_width();
388-
fail_unless!(width == Specified(CSSBorderWidthLength(Px(10.0))));
388+
assert!(width == Specified(CSSBorderWidthLength(Px(10.0))));
389389
}
390390
}
391391
@@ -394,7 +394,7 @@ fn test_not_child() {
394394
let style = "div > not_span { border-left-width: 10px; }";
395395
do child_test(style) |computed| {
396396
let width = computed.border_left_width();
397-
fail_unless!(width != Specified(CSSBorderWidthLength(Px(10.0))));
397+
assert!(width != Specified(CSSBorderWidthLength(Px(10.0))));
398398
}
399399
}
400400
@@ -404,7 +404,7 @@ fn test_descendant() {
404404
let style = "div span { border-left-width: 10px; }";
405405
do child_test(style) |computed| {
406406
let width = computed.border_left_width();
407-
fail_unless!(width == Specified(CSSBorderWidthLength(Px(10.0))));
407+
assert!(width == Specified(CSSBorderWidthLength(Px(10.0))));
408408
}
409409
}
410410
@@ -442,5 +442,5 @@ fn test_compose() {
442442

443443
let computed = complete_child_results.computed_style();
444444

445-
fail_unless!(computed.background_color() == color::css_colors::blue());
445+
assert!(computed.background_color() == color::css_colors::blue());
446446
}

0 commit comments

Comments
 (0)