clayborg added a comment.

The refactoring comment should be done as well for this diff as suggested.



================
Comment at: 
lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py:564-566
+    @no_debug_info_test
+    @skipUnlessDarwin
+    def test_darwin_dwarf_missing_obj_with_symbol_ondemand_enabled(self):
----------------
If this function is just like the test_darwin_dwarf_missing_obj, I would 
suggest refactoring test_darwin_dwarf_missing_obj into a function that doesn't 
start with "test", and then having both test_darwin_dwarf_missing_obj and 
test_darwin_dwarf_missing_obj_with_symbol_ondemand_enabled call it. 

So copy the "test_darwin_dwarf_missing_obj" function and name it 
"darwin_dwarf_missing_obj" and add a new parameter named "initCommands":

```
def darwin_dwarf_missing_obj(self, initCommands):
```
Then copy the code from this function into that function, and replace the 
remove the line:
```
initCommands = ['settings set symbols.load-on-demand true']
```
Then just modify the code for both tests to call the refactored function
```
    @no_debug_info_test
    @skipUnlessDarwin
    def test_darwin_dwarf_missing_obj(self):
        '''
            Test that if we build a binary with DWARF in .o files and we remove
            the .o file for main.cpp, that we get a variable named "<error>"
            whose value matches the appriopriate error. Errors when getting
            variables are returned in the LLDB API when the user should be
            notified of issues that can easily be solved by rebuilding or
            changing compiler options and are designed to give better feedback
            to the user.
        '''
        darwin_dwarf_missing_obj(self, None)

    @no_debug_info_test
    @skipUnlessDarwin
    def test_darwin_dwarf_missing_obj_with_symbol_ondemand_enabled(self):
        '''
            Test that if we build a binary with DWARF in .o files and we remove
            the .o file for main.cpp, that we get a variable named "<error>"
            whose value matches the appriopriate error. Test with 
symbol_ondemand_enabled.
        '''
        darwin_dwarf_missing_obj(self, ['settings set symbols.load-on-demand 
true'])
```

Any method on a test suite class that doesn't start with "test" is just a help 
function.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137284/new/

https://reviews.llvm.org/D137284

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to