'Test that ** expressions mean recursion.'

def testGlobWithStarStar(self):

    self._MakeTestDirs()
    os.makedirs(utils.JoinPath(self.temp_dir, '1/2    space'))
    path_spaces = utils.JoinPath(self.temp_dir, '1/2    space/foo    something')
    open(path_spaces, 'wb').close()
    self.assertTrue(os.path.exists(path_spaces))
    paths = [os.path.join(self.temp_dir, '1/**/foo*')]
    results = ['1/2/3/4/foo4', '/1/2/3/foo3', '1/2/foo2', '1/2    space/foo    something']
    if (platform.system() == 'Linux'):
        results = ['1/2/3/4/fOo4', '1/2/3/4/foo4', '/1/2/3/fOo3', '/1/2/3/foo3', '1/2/fOo2', '1/2/foo2', '1/2    space/foo    something']
    self._RunGlob(paths)
    self.assertItemsEqual(self.flow_replies, [utils.JoinPath(self.temp_dir, x) for x in results])
    paths = [os.path.join(self.temp_dir, '1/', '**2/foo*')]
    results = ['1/2/3/foo3', '/1/2/foo2', '1/2    space/foo    something']
    if (platform.system() == 'Linux'):
        results = ['1/2/3/foo3', '1/2/3/fOo3', '/1/2/fOo2', '/1/2/foo2', '1/2    space/foo    something']
    self._RunGlob(paths)
    self.assertItemsEqual(self.flow_replies, [utils.JoinPath(self.temp_dir, x) for x in results])
    paths = [os.path.join(self.temp_dir, '**10bar*')]
    results = ['bar', '1/bar1', '/1/2/bar2', '/1/2/3/bar3', '/1/2/3/4/bar4']
    self._RunGlob(paths)
    self.assertItemsEqual(self.flow_replies, [utils.JoinPath(self.temp_dir, x) for x in results])
