Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 0d4cf15

Browse files
committed
Merge pull request #83 from asottile/regression_test_72_82
Add regression test for #82.
2 parents 85ae1e2 + dd59f6e commit 0d4cf15

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

sasstests.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import contextlib
66
import glob
77
import json
8+
import io
89
import os
910
import os.path
1011
import re
@@ -710,6 +711,21 @@ def test_successful(self):
710711
self.assertEqual(contentsf1, 'a b {\n width: 100%; }\n')
711712
self.assertEqual(contentsf2, 'foo {\n width: 100%; }\n')
712713

714+
def test_compile_directories_unicode(self):
715+
with tempdir() as tmpdir:
716+
input_dir = os.path.join(tmpdir, 'input')
717+
output_dir = os.path.join(tmpdir, 'output')
718+
os.makedirs(input_dir)
719+
with io.open(
720+
os.path.join(input_dir, 'test.scss'), 'w', encoding='UTF-8',
721+
) as f:
722+
f.write(u'a { content: "☃"; }')
723+
# Raised a UnicodeEncodeError in py2 before #82 (issue #72)
724+
# Also raised a UnicodeEncodeError in py3 if the default encoding
725+
# couldn't represent it (such as cp1252 on windows)
726+
sass.compile(dirname=(input_dir, output_dir))
727+
assert os.path.exists(os.path.join(output_dir, 'test.css'))
728+
713729
def test_ignores_underscored_files(self):
714730
with tempdir() as tmpdir:
715731
input_dir = os.path.join(tmpdir, 'input')

0 commit comments

Comments
 (0)