Esempio n. 1
0
    def test_merge(self):
        smap = SourceMap()

        path = dirname(__file__)

        # smap.read(open(join(path, 'a.min.js.map')).read())
        # smap.read(open(join(path, 'b.min.js.map')).read())

        both = SourceMap()
        both.read(open(join(path, 'both.min.js.map')).read())
Esempio n. 2
0
    def _testfile(self, prefix):
        content = readfile(prefix + '.min.js.map')
        original = json.loads(content)

        smap = SourceMap()
        smap.read(content)
        generated = smap.generate()

        # Start with the items we use to calculate mappings.  If they are off
        # then the rest is going to be wrong.

        self.assertEqual(original['sources'], generated['sources'])

        self.assertEqual(original['names'], generated['names'])

        r = re.compile(r'(;|,|[a-zA-Z0-9+\/]+)')
        lhs = [ p for p in r.findall(original['mappings']) if p != ',' ]

        rhs = [ p for p in r.findall(generated['mappings']) if p != ',' ]

        self.assertEqual(lhs, rhs)