aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-08-17 22:00:16 +0300
committerJukka Jylänki <jujjyl@gmail.com>2013-08-17 22:01:48 +0300
commita63686c1bbf93288248ee26a9beec819e319a3b9 (patch)
tree60f2eff703069c90b9587ad47836adf35600ca23 /tests
parentbff2b8740aba888bd67ee93198abc8fa0e116b80 (diff)
Fix source map generation on Windows. Fixes #1333.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runner.py12
-rw-r--r--tests/test_core.py8
2 files changed, 16 insertions, 4 deletions
diff --git a/tests/runner.py b/tests/runner.py
index bdbd2676..318946e6 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -275,6 +275,18 @@ process(sys.argv[1])
print "Output: " + output[0]
return output[0]
+ # Tests that the given two paths are identical, modulo path delimiters. E.g. "C:/foo" is equal to "C:\foo".
+ def assertPathsIdentical(self, path1, path2):
+ path1 = path1.replace('\\', '/')
+ path2 = path2.replace('\\', '/')
+ return self.assertIdentical(path1, path2)
+
+ # Tests that the given two multiline text content are identical, modulo line ending differences (\r\n on Windows, \n on Unix).
+ def assertTextDataIdentical(self, text1, text2):
+ text1 = text1.replace('\r\n', '\n')
+ text2 = text2.replace('\r\n', '\n')
+ return self.assertIdentical(text1, text2)
+
def assertIdentical(self, values, y):
if type(values) not in [list, tuple]: values = [values]
for x in values:
diff --git a/tests/test_core.py b/tests/test_core.py
index 31db6ca5..88f6674a 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -9582,15 +9582,15 @@ def process(filename):
self.assertIdentical(clean(no_maps_file), clean(out_file))
map_filename = out_filename + '.map'
data = json.load(open(map_filename, 'r'))
- self.assertIdentical(out_filename, data['file'])
- self.assertIdentical(src_filename, data['sources'][0])
- self.assertIdentical(src, data['sourcesContent'][0])
+ self.assertPathsIdentical(out_filename, data['file'])
+ self.assertPathsIdentical(src_filename, data['sources'][0])
+ self.assertTextDataIdentical(src, data['sourcesContent'][0])
mappings = json.loads(jsrun.run_js(
path_from_root('tools', 'source-maps', 'sourcemap2json.js'),
tools.shared.NODE_JS, [map_filename]))
seen_lines = set()
for m in mappings:
- self.assertIdentical(src_filename, m['source'])
+ self.assertPathsIdentical(src_filename, m['source'])
seen_lines.add(m['originalLine'])
# ensure that all the 'meaningful' lines in the original code get mapped
assert seen_lines.issuperset([6, 7, 11, 12])