Example #1
0
    def test_dependency_in_subdir(self):
        resource_finder = parse_deps.ResourceFinder(srcdir)
        module = parse_deps.Module("unittest")
        module.load_and_parse(os.path.join(srcdir, "unittest.js"))
        filename, contents = resource_finder.find_and_load_module(
            module, "tracks.timeline_track")

        self.assertEquals(filename, "tracks/timeline_track.js")
        expected_contents = ''
        with open(os.path.join(srcdir, "tracks/timeline_track.js")) as f:
            expected_contents = f.read()
        self.assertEquals(contents, expected_contents)
Example #2
0
  def test_basic(self):

    resource_finder = parse_deps.ResourceFinder(srcdir)
    module = parse_deps.Module("unittest")
    module.load_and_parse(os.path.join(srcdir, "unittest.js"))
    filename, contents = resource_finder.find_and_load_module(module, "base")

    self.assertTrue(os.path.samefile(filename, os.path.join(srcdir, "base.js")))
    expected_contents = ''
    with open(os.path.join(srcdir, "base.js")) as f:
      expected_contents = f.read()
    self.assertEquals(contents, expected_contents)
Example #3
0
    def test_basic(self):

        resource_finder = parse_deps.ResourceFinder([src_dir])
        module = parse_deps.Module('guid')
        module.load_and_parse(os.path.join(src_dir, 'base', 'guid.js'))
        filename, contents = resource_finder.find_and_load_module(
            module, 'base')

        self.assertTrue(
            os.path.samefile(filename, os.path.join(src_dir, 'base.js')))
        expected_contents = ''
        with open(os.path.join(src_dir, 'base.js')) as f:
            expected_contents = f.read()
        self.assertEquals(contents, expected_contents)
Example #4
0
    def test_dependency_in_subdir(self):
        resource_finder = parse_deps.ResourceFinder([src_dir])
        module = parse_deps.Module('base.guid')
        module.load_and_parse(os.path.join(src_dir, 'base', 'guid.js'))
        filename, contents = resource_finder.find_and_load_module(
            module, 'tracing.tracks.track')

        assert filename

        self.assertTrue(
            os.path.samefile(
                filename, os.path.join(src_dir, 'tracing', 'tracks',
                                       'track.js')))
        expected_contents = ''
        with open(os.path.join(src_dir, 'tracing', 'tracks', 'track.js')) as f:
            expected_contents = f.read()
        self.assertEquals(contents, expected_contents)