def test_GLOB(self): """ test Syntax.GLOB """ #test case of one file files = Syntax.GLOB("./*.cpp") self.assertEqual(files, "hello.cpp") #test case of more files and those files must in the lexicographical order module = self._module Function.RunCommand("touch %s/hello1.h" % module.root_path, ignore_stderr_when_ok = True) Function.RunCommand("touch %s/hello2.h" % module.root_path, ignore_stderr_when_ok = True) Function.RunCommand("touch %s/hello3.h" % module.root_path, ignore_stderr_when_ok = True) Function.RunCommand("touch %s/hello10.h" % module.root_path, ignore_stderr_when_ok = True) files = Syntax.GLOB("./*.h") self.assertEqual(files, "hello.h hello1.h hello10.h hello2.h hello3.h") #test case of files not in self module Function.RunCommand("touch %s/../README" % module.root_path, ignore_stderr_when_ok = True) flag = False try: Syntax.GLOB("../README") except Syntax.NotInSelfModuleError as e: flag = True self.assertTrue(flag) #test case of no such files flag = False try: Syntax.GLOB("./just_test.cpp") except Syntax.BrocArgumentIllegalError as e: flag = True self.assertTrue(flag)