1
@function
test(
$statement
,
$assertion
,
$expectation
) {
2
@if
$assertion
!=
$expectation
{
3
$result
:
"FAIL"
;
4
@return
"____ #{
$result
} ____ "
+
$statement
+
" ____ Expected #{
$assertion
} to equal EXPECTATION: #{
$expectation
}"
;
5
}
6
@if
$assertion
==
$expectation
{
7
$result
:
"PASS"
;
8
@return
"____ #{
$result
} ____ "
+
$statement
;
9
}
10
}
12
// example usage
13
14
@debug
test(
"draw_pixel creates box-shadow based off of
$width
"
, draw_pixel(1,
$hair
),
"6px 0px #090909"
);
15
16
@debug
test(
"draw_pixel creates a number of box-shadow css output equal to the length"
, draw_pixel(3,
$hair
),
"18px 0px #090909"
);
17
18
@debug
test(
"function DRAW_LINE: creates box-shadow based off of span.var$width"
, draw_line(0, 1,
$hair
),
"6px 0px #090909"
);
19
20
@debug
test(
"draw_line creates a number of box-shadow css output equal to the length",draw_line(3, 3,
$hair
),
"24px 0px #090909,30px 0px #090909,36px 0px #090909"
);
21
22
@debug
test(
"draw_row draws a pixel for each block"
, draw_row(4,
$lengths
: (2,1,2),
$colors
: (
$hair
,
$crown-gold
,
$hair
)),
"30px 0px #090909,36px 0px #090909,42px 0px #f5d858,48px 0px #090909,54px 0px #090909"
);
33 // Or broken up to be increase readability
34 // template
35
36
$state:
""
;
37
$assert:
""
;
38
$expect:
""
;
40 @debug test( $state , $assert , $expect );
4142 // usage
43
44
$state:
"draw_row draws a pixel for each block"
;
45
$assert: draw_row(4,
$lengths
: (2,1,2),
$colors
: (
$hair
,
$crown-gold
,
$hair
));
46
$expect:
"30px 0px #090909,36px 0px #090909,42px 0px #f5d858,48px 0px #090909,54px 0px #090909"
;
48 @debug test( $state , $assert , $expect );