1""" 2Test that we can call C++ template fucntions. 3""" 4import lldb 5from lldbsuite.test.decorators import * 6from lldbsuite.test.lldbtest import * 7from lldbsuite.test import lldbutil 8 9 10class TemplateFunctionsTestCase(TestBase): 11 12 mydir = TestBase.compute_mydir(__file__) 13 14 def do_test_template_function(self, add_cast): 15 self.build() 16 (_, _, thread, _) = lldbutil.run_to_name_breakpoint(self, "main") 17 frame = thread.GetSelectedFrame() 18 expr = "foo(42)" 19 if add_cast: 20 expr = "(int)" + expr 21 expr_result = frame.EvaluateExpression(expr) 22 self.assertTrue(expr_result.IsValid()) 23 self.assertEqual(expr_result.GetValue(), "42") 24 25 @skipIfWindows 26 def test_template_function_with_cast(self): 27 self.do_test_template_function(True) 28 29 @skipIfWindows 30 @expectedFailureAll(debug_info=["dwarf", "gmodules", "dwo"]) 31 def test_template_function_without_cast(self): 32 self.do_test_template_function(False) 33