jwhitmire-haml 2.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +332 -0
- data/bin/css2sass +7 -0
- data/bin/haml +9 -0
- data/bin/html2haml +7 -0
- data/bin/sass +8 -0
- data/lib/haml/buffer.rb +255 -0
- data/lib/haml/engine.rb +268 -0
- data/lib/haml/error.rb +22 -0
- data/lib/haml/exec.rb +395 -0
- data/lib/haml/filters.rb +276 -0
- data/lib/haml/helpers/action_view_extensions.rb +45 -0
- data/lib/haml/helpers/action_view_mods.rb +181 -0
- data/lib/haml/helpers.rb +468 -0
- data/lib/haml/html.rb +218 -0
- data/lib/haml/precompiler.rb +889 -0
- data/lib/haml/shared.rb +45 -0
- data/lib/haml/template/patch.rb +58 -0
- data/lib/haml/template/plugin.rb +72 -0
- data/lib/haml/template.rb +51 -0
- data/lib/haml/util.rb +77 -0
- data/lib/haml/version.rb +47 -0
- data/lib/haml.rb +1042 -0
- data/lib/sass/css.rb +388 -0
- data/lib/sass/engine.rb +499 -0
- data/lib/sass/environment.rb +33 -0
- data/lib/sass/error.rb +35 -0
- data/lib/sass/plugin/merb.rb +56 -0
- data/lib/sass/plugin/rails.rb +24 -0
- data/lib/sass/plugin.rb +203 -0
- data/lib/sass/repl.rb +51 -0
- data/lib/sass/script/bool.rb +13 -0
- data/lib/sass/script/color.rb +97 -0
- data/lib/sass/script/funcall.rb +28 -0
- data/lib/sass/script/functions.rb +122 -0
- data/lib/sass/script/lexer.rb +152 -0
- data/lib/sass/script/literal.rb +60 -0
- data/lib/sass/script/number.rb +231 -0
- data/lib/sass/script/operation.rb +30 -0
- data/lib/sass/script/parser.rb +142 -0
- data/lib/sass/script/string.rb +42 -0
- data/lib/sass/script/unary_operation.rb +21 -0
- data/lib/sass/script/variable.rb +20 -0
- data/lib/sass/script.rb +38 -0
- data/lib/sass/tree/attr_node.rb +64 -0
- data/lib/sass/tree/comment_node.rb +34 -0
- data/lib/sass/tree/debug_node.rb +22 -0
- data/lib/sass/tree/directive_node.rb +50 -0
- data/lib/sass/tree/file_node.rb +27 -0
- data/lib/sass/tree/for_node.rb +29 -0
- data/lib/sass/tree/if_node.rb +27 -0
- data/lib/sass/tree/mixin_def_node.rb +18 -0
- data/lib/sass/tree/mixin_node.rb +34 -0
- data/lib/sass/tree/node.rb +99 -0
- data/lib/sass/tree/rule_node.rb +120 -0
- data/lib/sass/tree/variable_node.rb +24 -0
- data/lib/sass/tree/while_node.rb +20 -0
- data/lib/sass.rb +1062 -0
- data/test/benchmark.rb +99 -0
- data/test/haml/engine_test.rb +734 -0
- data/test/haml/helper_test.rb +224 -0
- data/test/haml/html2haml_test.rb +92 -0
- data/test/haml/markaby/standard.mab +52 -0
- data/test/haml/mocks/article.rb +6 -0
- data/test/haml/results/content_for_layout.xhtml +15 -0
- data/test/haml/results/eval_suppressed.xhtml +9 -0
- data/test/haml/results/filters.xhtml +62 -0
- data/test/haml/results/helpers.xhtml +93 -0
- data/test/haml/results/helpful.xhtml +10 -0
- data/test/haml/results/just_stuff.xhtml +68 -0
- data/test/haml/results/list.xhtml +12 -0
- data/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
- data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
- data/test/haml/results/original_engine.xhtml +20 -0
- data/test/haml/results/partial_layout.xhtml +5 -0
- data/test/haml/results/partials.xhtml +21 -0
- data/test/haml/results/render_layout.xhtml +3 -0
- data/test/haml/results/silent_script.xhtml +74 -0
- data/test/haml/results/standard.xhtml +42 -0
- data/test/haml/results/tag_parsing.xhtml +23 -0
- data/test/haml/results/very_basic.xhtml +5 -0
- data/test/haml/results/whitespace_handling.xhtml +89 -0
- data/test/haml/rhtml/_av_partial_1.rhtml +12 -0
- data/test/haml/rhtml/_av_partial_2.rhtml +8 -0
- data/test/haml/rhtml/action_view.rhtml +62 -0
- data/test/haml/rhtml/standard.rhtml +54 -0
- data/test/haml/template_test.rb +204 -0
- data/test/haml/templates/_av_partial_1.haml +9 -0
- data/test/haml/templates/_av_partial_1_ugly.haml +9 -0
- data/test/haml/templates/_av_partial_2.haml +5 -0
- data/test/haml/templates/_av_partial_2_ugly.haml +5 -0
- data/test/haml/templates/_layout.erb +3 -0
- data/test/haml/templates/_layout_for_partial.haml +3 -0
- data/test/haml/templates/_partial.haml +8 -0
- data/test/haml/templates/_text_area.haml +3 -0
- data/test/haml/templates/action_view.haml +47 -0
- data/test/haml/templates/action_view_ugly.haml +47 -0
- data/test/haml/templates/breakage.haml +8 -0
- data/test/haml/templates/content_for_layout.haml +10 -0
- data/test/haml/templates/eval_suppressed.haml +11 -0
- data/test/haml/templates/filters.haml +66 -0
- data/test/haml/templates/helpers.haml +95 -0
- data/test/haml/templates/helpful.haml +11 -0
- data/test/haml/templates/just_stuff.haml +83 -0
- data/test/haml/templates/list.haml +12 -0
- data/test/haml/templates/nuke_inner_whitespace.haml +32 -0
- data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
- data/test/haml/templates/original_engine.haml +17 -0
- data/test/haml/templates/partial_layout.haml +3 -0
- data/test/haml/templates/partialize.haml +1 -0
- data/test/haml/templates/partials.haml +12 -0
- data/test/haml/templates/render_layout.haml +2 -0
- data/test/haml/templates/silent_script.haml +40 -0
- data/test/haml/templates/standard.haml +42 -0
- data/test/haml/templates/standard_ugly.haml +1 -0
- data/test/haml/templates/tag_parsing.haml +21 -0
- data/test/haml/templates/very_basic.haml +4 -0
- data/test/haml/templates/whitespace_handling.haml +87 -0
- data/test/linked_rails.rb +12 -0
- data/test/sass/css2sass_test.rb +193 -0
- data/test/sass/engine_test.rb +786 -0
- data/test/sass/functions_test.rb +96 -0
- data/test/sass/more_results/more1.css +9 -0
- data/test/sass/more_results/more1_with_line_comments.css +26 -0
- data/test/sass/more_results/more_import.css +29 -0
- data/test/sass/more_templates/_more_partial.sass +2 -0
- data/test/sass/more_templates/more1.sass +23 -0
- data/test/sass/more_templates/more_import.sass +11 -0
- data/test/sass/plugin_test.rb +208 -0
- data/test/sass/results/alt.css +4 -0
- data/test/sass/results/basic.css +9 -0
- data/test/sass/results/compact.css +5 -0
- data/test/sass/results/complex.css +87 -0
- data/test/sass/results/compressed.css +1 -0
- data/test/sass/results/expanded.css +19 -0
- data/test/sass/results/import.css +29 -0
- data/test/sass/results/line_numbers.css +49 -0
- data/test/sass/results/mixins.css +95 -0
- data/test/sass/results/multiline.css +24 -0
- data/test/sass/results/nested.css +22 -0
- data/test/sass/results/parent_ref.css +13 -0
- data/test/sass/results/script.css +16 -0
- data/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
- data/test/sass/results/subdir/subdir.css +3 -0
- data/test/sass/results/units.css +11 -0
- data/test/sass/script_test.rb +153 -0
- data/test/sass/templates/_partial.sass +2 -0
- data/test/sass/templates/alt.sass +16 -0
- data/test/sass/templates/basic.sass +23 -0
- data/test/sass/templates/bork.sass +2 -0
- data/test/sass/templates/bork2.sass +2 -0
- data/test/sass/templates/compact.sass +17 -0
- data/test/sass/templates/complex.sass +309 -0
- data/test/sass/templates/compressed.sass +15 -0
- data/test/sass/templates/expanded.sass +17 -0
- data/test/sass/templates/import.sass +11 -0
- data/test/sass/templates/importee.sass +19 -0
- data/test/sass/templates/line_numbers.sass +13 -0
- data/test/sass/templates/mixins.sass +76 -0
- data/test/sass/templates/multiline.sass +20 -0
- data/test/sass/templates/nested.sass +25 -0
- data/test/sass/templates/parent_ref.sass +25 -0
- data/test/sass/templates/script.sass +101 -0
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
- data/test/sass/templates/subdir/subdir.sass +6 -0
- data/test/sass/templates/units.sass +11 -0
- data/test/test_helper.rb +21 -0
- metadata +245 -0
@@ -0,0 +1,95 @@
|
|
1
|
+
#main {
|
2
|
+
width: 15em;
|
3
|
+
color: #0000ff;
|
4
|
+
}
|
5
|
+
#main p {
|
6
|
+
border-top-width: 2px;
|
7
|
+
border-top-color: #ffcc00;
|
8
|
+
border-left-width: 1px;
|
9
|
+
border-left-color: #000;
|
10
|
+
-moz-border-radius: 10px;
|
11
|
+
border-style: dotted;
|
12
|
+
border-width: 2px;
|
13
|
+
}
|
14
|
+
#main .cool {
|
15
|
+
width: 100px;
|
16
|
+
}
|
17
|
+
|
18
|
+
#left {
|
19
|
+
border-top-width: 2px;
|
20
|
+
border-top-color: #ffcc00;
|
21
|
+
border-left-width: 1px;
|
22
|
+
border-left-color: #000;
|
23
|
+
-moz-border-radius: 10px;
|
24
|
+
font-size: 2em;
|
25
|
+
font-weight: bold;
|
26
|
+
float: left;
|
27
|
+
}
|
28
|
+
|
29
|
+
#right {
|
30
|
+
border-top-width: 2px;
|
31
|
+
border-top-color: #ffcc00;
|
32
|
+
border-left-width: 1px;
|
33
|
+
border-left-color: #000;
|
34
|
+
-moz-border-radius: 10px;
|
35
|
+
color: #f00;
|
36
|
+
font-size: 20px;
|
37
|
+
float: right;
|
38
|
+
}
|
39
|
+
|
40
|
+
.bordered {
|
41
|
+
border-top-width: 2px;
|
42
|
+
border-top-color: #ffcc00;
|
43
|
+
border-left-width: 1px;
|
44
|
+
border-left-color: #000;
|
45
|
+
-moz-border-radius: 10px;
|
46
|
+
}
|
47
|
+
|
48
|
+
.complex {
|
49
|
+
color: #f00;
|
50
|
+
font-size: 20px;
|
51
|
+
text-decoration: none;
|
52
|
+
}
|
53
|
+
.complex:after {
|
54
|
+
content: ".";
|
55
|
+
display: block;
|
56
|
+
height: 0;
|
57
|
+
clear: both;
|
58
|
+
visibility: hidden;
|
59
|
+
}
|
60
|
+
* html .complex {
|
61
|
+
height: 1px;
|
62
|
+
color: #f00;
|
63
|
+
font-size: 20px;
|
64
|
+
}
|
65
|
+
|
66
|
+
.more-complex {
|
67
|
+
color: #f00;
|
68
|
+
font-size: 20px;
|
69
|
+
text-decoration: none;
|
70
|
+
display: inline;
|
71
|
+
-webkit-nonsense-top-right: 1px;
|
72
|
+
-webkit-nonsense-bottom-left: 1px;
|
73
|
+
}
|
74
|
+
.more-complex:after {
|
75
|
+
content: ".";
|
76
|
+
display: block;
|
77
|
+
height: 0;
|
78
|
+
clear: both;
|
79
|
+
visibility: hidden;
|
80
|
+
}
|
81
|
+
* html .more-complex {
|
82
|
+
height: 1px;
|
83
|
+
color: #f00;
|
84
|
+
font-size: 20px;
|
85
|
+
}
|
86
|
+
.more-complex a:hover {
|
87
|
+
text-decoration: underline;
|
88
|
+
color: #f00;
|
89
|
+
font-size: 20px;
|
90
|
+
border-top-width: 2px;
|
91
|
+
border-top-color: #ffcc00;
|
92
|
+
border-left-width: 1px;
|
93
|
+
border-left-color: #000;
|
94
|
+
-moz-border-radius: 10px;
|
95
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#main,
|
2
|
+
#header {
|
3
|
+
height: 50px; }
|
4
|
+
#main div,
|
5
|
+
#header div {
|
6
|
+
width: 100px; }
|
7
|
+
#main div a span,
|
8
|
+
#main div em span,
|
9
|
+
#header div a span,
|
10
|
+
#header div em span {
|
11
|
+
color: pink; }
|
12
|
+
|
13
|
+
#one div.nested,
|
14
|
+
#one span.nested,
|
15
|
+
#one p.nested,
|
16
|
+
#two div.nested,
|
17
|
+
#two span.nested,
|
18
|
+
#two p.nested,
|
19
|
+
#three div.nested,
|
20
|
+
#three span.nested,
|
21
|
+
#three p.nested {
|
22
|
+
font-weight: bold;
|
23
|
+
border-color: red;
|
24
|
+
display: block; }
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#main {
|
2
|
+
width: 15em;
|
3
|
+
color: #0000ff; }
|
4
|
+
#main p {
|
5
|
+
border-style: dotted;
|
6
|
+
/* Nested comment
|
7
|
+
* More nested stuff */
|
8
|
+
border-width: 2px; }
|
9
|
+
#main .cool {
|
10
|
+
width: 100px; }
|
11
|
+
|
12
|
+
#left {
|
13
|
+
font-size: 2em;
|
14
|
+
font-weight: bold;
|
15
|
+
float: left; }
|
16
|
+
|
17
|
+
#right .header {
|
18
|
+
border-style: solid; }
|
19
|
+
#right .body {
|
20
|
+
border-style: dotted; }
|
21
|
+
#right .footer {
|
22
|
+
border-style: dashed; }
|
@@ -0,0 +1,13 @@
|
|
1
|
+
a { color: #000; }
|
2
|
+
a:hover { color: #f00; }
|
3
|
+
|
4
|
+
p, div { width: 100em; }
|
5
|
+
p foo, div foo { width: 10em; }
|
6
|
+
p:hover, p bar, div:hover, div bar { height: 20em; }
|
7
|
+
|
8
|
+
#cool { border-style: solid; border-width: 2em; }
|
9
|
+
.ie7 #cool, .ie6 #cool { content: string(Totally not cool.); }
|
10
|
+
.firefox #cool { content: string(Quite cool.); }
|
11
|
+
|
12
|
+
.wow, .snazzy { font-family: fantasy; }
|
13
|
+
.wow:hover, .wow:visited, .snazzy:hover, .snazzy:visited { font-weight: bold; }
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#main { content: Hello!; qstr: Quo"ted"!; hstr: Hyph-en!; width: 30em; background-color: #000; color: #ffffaa; short-color: #112233; named-color: olive; con: foo bar(9 hi there boom); con2: noquo quo; }
|
2
|
+
#main #sidebar { background-color: #00ff98; num-normal: 10; num-dec: 10.2; num-dec0: 99; num-neg: -10; esc: 10 +12; many: 6; order: 7; complex: #4c9db1hi16; }
|
3
|
+
|
4
|
+
#plus { num-num: 7; num-num-un: 25em; num-num-un2: 23em; num-num-neg: 9.87; num-str: 100px; num-col: #b7b7b7; num-perc: 31%; str-str: hi there; str-str2: hi there; str-col: 14em solid #112233; str-num: times: 13; col-num: #ff7b9d; col-col: #5173ff; }
|
5
|
+
|
6
|
+
#minus { num-num: 900; col-num: #f9f9f4; col-col: #000035; unary-num: -1; unary-const: 10; unary-paren: -11; unary-two: 12; unary-many: 12; unary-crazy: -15; }
|
7
|
+
|
8
|
+
#times { num-num: 7; num-col: #7496b8; col-num: #092345; col-col: #243648; }
|
9
|
+
|
10
|
+
#div { num-num: 3.333; num-num2: 3.333; col-num: #092345; col-col: #0b0d0f; comp: 1px; }
|
11
|
+
|
12
|
+
#mod { num-num: 2; col-col: #0f0e05; col-num: #020001; }
|
13
|
+
|
14
|
+
#const { escaped-quote: !foo; default: Hello! !important; }
|
15
|
+
|
16
|
+
#regression { a: 4; }
|
@@ -0,0 +1 @@
|
|
1
|
+
#pi { width: 314px; }
|
@@ -0,0 +1,153 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
3
|
+
require 'sass/engine'
|
4
|
+
|
5
|
+
class SassScriptTest < Test::Unit::TestCase
|
6
|
+
include Sass::Script
|
7
|
+
|
8
|
+
def test_color_checks_input
|
9
|
+
assert_raise(Sass::SyntaxError, "Color values must be between 0 and 255") {Color.new([1, 2, -1])}
|
10
|
+
assert_raise(Sass::SyntaxError, "Color values must be between 0 and 255") {Color.new([256, 2, 3])}
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_string_escapes
|
14
|
+
assert_equal '"', resolve("\"\\\"\"")
|
15
|
+
assert_equal "\\", resolve("\"\\\\\"")
|
16
|
+
assert_equal "\\02fa", resolve("\"\\02fa\"")
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_color_names
|
20
|
+
assert_equal "white", resolve("white")
|
21
|
+
assert_equal "white", resolve("#ffffff")
|
22
|
+
assert_equal "#fffffe", resolve("white - #000001")
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_implicit_strings
|
26
|
+
silence_warnings do
|
27
|
+
assert_equal Sass::Script::String.new("foo"), eval("foo")
|
28
|
+
assert_equal Sass::Script::String.new("foo bar"), eval("foo bar")
|
29
|
+
assert_equal Sass::Script::String.new("foo/bar"), eval("foo/bar")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_interpolation
|
34
|
+
assert_equal "foo bar, baz bang", resolve('"foo #{"bar"}, #{"baz"} bang"')
|
35
|
+
assert_equal "foo bar baz bang", resolve('"foo #{"#{"ba" + "r"} baz"} bang"')
|
36
|
+
assert_equal 'foo #{bar baz} bang', resolve('"foo \#{#{"ba" + "r"} baz} bang"')
|
37
|
+
assert_equal 'foo #{baz bang', resolve('"foo #{"\#{" + "baz"} bang"')
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_rule_interpolation
|
41
|
+
assert_equal(<<CSS, render(<<SASS))
|
42
|
+
foo bar baz bang {
|
43
|
+
a: b; }
|
44
|
+
CSS
|
45
|
+
foo \#{"\#{"ba" + "r"} baz"} bang
|
46
|
+
a: b
|
47
|
+
SASS
|
48
|
+
assert_equal(<<CSS, render(<<SASS))
|
49
|
+
foo \#{bar baz} bang {
|
50
|
+
a: b; }
|
51
|
+
CSS
|
52
|
+
foo \\\#{\#{"ba" + "r"} baz} bang
|
53
|
+
a: b
|
54
|
+
SASS
|
55
|
+
assert_equal(<<CSS, render(<<SASS))
|
56
|
+
foo \#{baz bang {
|
57
|
+
a: b; }
|
58
|
+
CSS
|
59
|
+
foo \#{"\\\#{" + "baz"} bang
|
60
|
+
a: b
|
61
|
+
SASS
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_warning_reporting
|
65
|
+
assert_warning(<<WARN) {eval("foo")}
|
66
|
+
DEPRECATION WARNING:
|
67
|
+
On line 1, character 1 of 'test_warning_reporting_inline.sass'
|
68
|
+
Implicit strings have been deprecated and will be removed in version 2.4.
|
69
|
+
'foo' was not quoted. Please add double quotes (e.g. "foo").
|
70
|
+
WARN
|
71
|
+
assert_warning(<<WARN) {eval("1 + foo")}
|
72
|
+
DEPRECATION WARNING:
|
73
|
+
On line 1, character 5 of 'test_warning_reporting_inline.sass'
|
74
|
+
Implicit strings have been deprecated and will be removed in version 2.4.
|
75
|
+
'foo' was not quoted. Please add double quotes (e.g. "foo").
|
76
|
+
WARN
|
77
|
+
assert_warning(<<WARN) {render("@if 1 + foo")}
|
78
|
+
DEPRECATION WARNING:
|
79
|
+
On line 1, character 9 of 'test_warning_reporting_inline.sass'
|
80
|
+
Implicit strings have been deprecated and will be removed in version 2.4.
|
81
|
+
'foo' was not quoted. Please add double quotes (e.g. "foo").
|
82
|
+
WARN
|
83
|
+
|
84
|
+
# Regression
|
85
|
+
assert_warning(<<WARN) {render("@if if")}
|
86
|
+
DEPRECATION WARNING:
|
87
|
+
On line 1, character 5 of 'test_warning_reporting_inline.sass'
|
88
|
+
Implicit strings have been deprecated and will be removed in version 2.4.
|
89
|
+
'if' was not quoted. Please add double quotes (e.g. "if").
|
90
|
+
WARN
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_inaccessible_functions
|
94
|
+
assert_warning <<WARN do
|
95
|
+
DEPRECATION WARNING:
|
96
|
+
On line 2, character 6 of 'test_inaccessible_functions_inline.sass'
|
97
|
+
Implicit strings have been deprecated and will be removed in version 2.4.
|
98
|
+
'to_s' was not quoted. Please add double quotes (e.g. "to_s").
|
99
|
+
WARN
|
100
|
+
assert_equal "send(to_s)", resolve("send(to_s)", :line => 2)
|
101
|
+
end
|
102
|
+
assert_equal "public_instance_methods()", resolve("public_instance_methods()")
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_ruby_equality
|
106
|
+
assert_equal eval('"foo"'), eval('"foo"')
|
107
|
+
assert_equal eval('1'), eval('1.0')
|
108
|
+
assert_not_equal eval('1'), eval('"1"')
|
109
|
+
end
|
110
|
+
|
111
|
+
private
|
112
|
+
|
113
|
+
def resolve(str, opts = {}, environment = {})
|
114
|
+
munge_filename opts
|
115
|
+
eval(str, opts, environment).to_s
|
116
|
+
end
|
117
|
+
|
118
|
+
def eval(str, opts = {}, environment = {})
|
119
|
+
munge_filename opts
|
120
|
+
Sass::Script.parse(str, opts[:line] || 1,
|
121
|
+
opts[:offset] || 0, opts[:filename]).perform(environment)
|
122
|
+
end
|
123
|
+
|
124
|
+
def render(sass, options = {})
|
125
|
+
munge_filename options
|
126
|
+
Sass::Engine.new(sass, options).render
|
127
|
+
end
|
128
|
+
|
129
|
+
def assert_warning(message)
|
130
|
+
the_real_stderr, $stderr = $stderr, StringIO.new
|
131
|
+
yield
|
132
|
+
assert_equal message.strip, $stderr.string.strip
|
133
|
+
ensure
|
134
|
+
$stderr = the_real_stderr
|
135
|
+
end
|
136
|
+
|
137
|
+
def silence_warnings
|
138
|
+
the_real_stderr, $stderr = $stderr, StringIO.new
|
139
|
+
yield
|
140
|
+
ensure
|
141
|
+
$stderr = the_real_stderr
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_number_printing
|
145
|
+
assert_equal "1", eval("1")
|
146
|
+
assert_equal "1", eval("1.0")
|
147
|
+
assert_equal "1.121", eval("1.1214")
|
148
|
+
assert_equal "1.122", eval("1.1215")
|
149
|
+
assert_equal "Infinity", eval("1.0/0.0")
|
150
|
+
assert_equal "-Infinity", eval("-1.0/0.0")
|
151
|
+
assert_equal "NaN", eval("0.0/0.0")
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
body
|
4
|
+
:font Arial
|
5
|
+
:background blue
|
6
|
+
|
7
|
+
#page
|
8
|
+
:width 700px
|
9
|
+
:height 100
|
10
|
+
#header
|
11
|
+
:height 300px
|
12
|
+
h1
|
13
|
+
:font-size 50px
|
14
|
+
:color blue
|
15
|
+
|
16
|
+
#content.user.show
|
17
|
+
#container.top
|
18
|
+
#column.left
|
19
|
+
:width 100px
|
20
|
+
#column.right
|
21
|
+
:width 600px
|
22
|
+
#container.bottom
|
23
|
+
:background brown
|