Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
item4 committed Sep 29, 2014
1 parent 127478f commit b4745bb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
13 changes: 12 additions & 1 deletion sasstests.py
Expand Up @@ -66,6 +66,11 @@
font: '나눔고딕', sans-serif; }
'''

E_EXPECTED_CSS = '''\
a {
color: red; }
'''

SUBDIR_RECUR_EXPECTED_CSS = '''\
body p {
color: blue; }
Expand Down Expand Up @@ -187,6 +192,8 @@ def test_compile_filename(self):
self.assertEqual(D_EXPECTED_CSS, actual)
else:
self.assertEqual(D_EXPECTED_CSS.decode('utf-8'), actual)
actual = sass.compile(filename='test/e.scss')
assert actual == E_EXPECTED_CSS
self.assertRaises(IOError, sass.compile,
filename='test/not-exist.sass')
self.assertRaises(TypeError, sass.compile, filename=1234)
Expand Down Expand Up @@ -234,7 +241,7 @@ def test_builder_build_directory(self):
css_path = os.path.join(temp_path, 'css')
shutil.copytree('test', sass_path)
result_files = build_directory(sass_path, css_path)
assert len(result_files) == 5
assert len(result_files) == 6
assert result_files['a.scss'] == 'a.scss.css'
with open(os.path.join(css_path, 'a.scss.css'), **utf8_if_py3) as f:
css = f.read()
Expand All @@ -251,6 +258,10 @@ def test_builder_build_directory(self):
with open(os.path.join(css_path, 'd.scss.css'), **utf8_if_py3) as f:
css = f.read()
self.assertEqual(D_EXPECTED_CSS, css)
assert result_files['e.scss'] == 'e.scss.css'
with open(os.path.join(css_path, 'e.scss.css'), **utf8_if_py3) as f:
css = f.read()
assert css == E_EXPECTED_CSS
assert (result_files[os.path.join('subdir', 'recur.scss')] ==
os.path.join('subdir', 'recur.scss.css'))
with open(os.path.join(css_path, 'subdir', 'recur.scss.css'),
Expand Down
1 change: 1 addition & 0 deletions test/_f.scss
@@ -0,0 +1 @@
$test-variable : true !default;
2 changes: 2 additions & 0 deletions test/e.scss
@@ -0,0 +1,2 @@
@import "f";
@import "subdir/sub";
5 changes: 5 additions & 0 deletions test/subdir/_sub.scss
@@ -0,0 +1,5 @@
@if $test-variable == true {
a {
color: red;
}
}

0 comments on commit b4745bb

Please sign in to comment.