def test_ForceFunction(self): """Test the internal functions directly.""" made_up_file1 = 'dummy1' filetype.SetForcedFileType('c') self.assertEqual(filetype.GetForcedFileType(), 'c') filetype.ForceFileType(made_up_file1) self.assertEqual(filetype.FileType(made_up_file1), 'c') filetype.ForceFileType(made_up_file1) made_up_file2 = 'dummy2' filetype.SetForcedFileType('cpp') filetype.ForceFileType(made_up_file2) self.assertEqual(filetype.FileType(made_up_file2), 'cpp') filetype.ForceFileType(made_up_file1)
def AddInputFileStdin(): global stdin_count # When stdin is an input, -x or -E must be given. forced_type = filetype.GetForcedFileType() if not forced_type: # Only allowed if -E is specified. forced_type = 'c' env.set('NEED_DASH_E', '1') stdin_name = '__stdin%d__' % stdin_count env.append('INPUTS', stdin_name) filetype.ForceFileType(stdin_name, forced_type) stdin_count += 1