def test_extras(self): test_exe = self.make_extras() cmd, deps = self._build_commands() self.assertEqual(cmd, [shell_list([ jbos('VAR', shell_literal('='), 'value'), test_exe, '--foo' ])]) self.assertEqual(deps, [test_exe])
def test_env_vars(self): self._init_setenv() env = {'FOO': 'foo'} self.assertEqual(self.setenv(env, ['echo', 'hi']), [ self.setenv, jbos('FOO', shell_literal('='), 'foo'), '--', 'echo', 'hi' ]) self.assertEqual( self.setenv(env, 'echo hi'), shell_list([ self.setenv, jbos('FOO', shell_literal('='), 'foo'), '--', shell_literal('echo hi') ]))
def test_arguments_funky_shell_list(self): file = file_types.File(Path('foo.c', Root.srcdir)) output = file_types.File(Path('foo.o')) self.compdb.append(file=file, output=output, arguments=shell_list( ['cmd', shell_literal('<') + 'foo bar'])) self.assertEqual(self._db_to_json(), [ { 'directory': self.env.builddir.string(), 'command': 'cmd <{}'.format(shell_quote('foo bar')), 'file': file.path.string(self.base_dirs), 'output': 'foo.o' }, ])
def test_basic(self): self._init_setenv() self.assertEqual(self.setenv({}, ['echo', 'hi']), ['echo', 'hi']) self.assertEqual(self.setenv({}, 'echo hi'), shell_list([shell_literal('echo hi')]))