def test_simple(self): makefile = mock.Mock() src = self.context['source_file']('main.cpp') result = self.context['object_file'](file=src) compile.make_compile(result.creator, self.build, makefile, self.env) makefile.rule.assert_called_once_with(result, [src], [], AlwaysEqual(), {}, None)
def test_extra_deps(self): makefile = mock.Mock() dep = self.context['generic_file']('dep.txt') src = self.context['source_file']('main.cpp') result = self.context['object_file'](file=src, extra_deps=dep) compile.make_compile(result.creator, self.build, makefile, self.env) makefile.rule.assert_called_once_with(result, [src, dep], [], AlwaysEqual(), {}, None)
def test_simple(self): makefile = make.Makefile(None) src = self.context['source_file']('main.cpp') result = self.context['object_file'](file=src) with mock.patch.object(make.Makefile, 'rule') as mrule, \ mock.patch('logging.log'): compile.make_compile(result.creator, self.build, makefile, self.env) mrule.assert_called_once_with( result, [src], [], AlwaysEqual(), AlwaysEqual(), None )
def test_extra_deps(self): makefile = make.Makefile(None) dep = self.context['generic_file']('dep.txt') src = self.context['source_file']('main.cpp') result = self.context['object_file'](file=src, extra_deps=dep) with mock.patch.object(make.Makefile, 'rule'), \ mock.patch('logging.log'): compile.make_compile(result.creator, self.build, makefile, self.env) makefile.rule.assert_called_once_with( result, [src, dep], [], AlwaysEqual(), AlwaysEqual(), None, )
def test_local_options(self): env = make_env('winnt', clear_variables=True, variables={'CXX': 'nonexist'}) build, context = self._make_context(env) with mock.patch('bfg9000.tools.c_family._builders', (MsvcBuilder,)), \ mock.patch('logging.log'): context['global_options'](opts.debug(), lang='c++') src = context['source_file']('main.cpp') result = context['object_file'](file=src, options=[opts.static()]) makefile = make.Makefile(None) with mock.patch.object(make.Makefile, 'rule') as mrule, \ mock.patch.object(make.Makefile, 'variable', wraps=makefile.variable) as mvar, \ mock.patch('logging.log'): compile.make_compile(result.creator, build, makefile, env) mrule.assert_called_once_with(result, [src], [], AlwaysEqual(), { make.var('CXXFLAGS'): [make.var('GLOBAL_CXXFLAGS'), '/MTd'] }, None) mvar.assert_any_call('GLOBAL_CXXFLAGS', ['/Zi'], make.Section.flags, True)