@@ -18,6 +18,7 @@ let autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'python
1818const fileOne = path . join ( autoCompPath , 'one.py' ) ;
1919const fileTwo = path . join ( autoCompPath , 'two.py' ) ;
2020const fileThree = path . join ( autoCompPath , 'three.py' ) ;
21+ const fileDecorator = path . join ( autoCompPath , 'decorators.py' ) ;
2122const fileEncoding = path . join ( autoCompPath , 'four.py' ) ;
2223const fileEncodingUsed = path . join ( autoCompPath , 'five.py' ) ;
2324
@@ -72,6 +73,26 @@ suite('Code Definition', () => {
7273 } ) . then ( done , done ) ;
7374 } ) ;
7475
76+ test ( 'Go to function with decorator' , async ( ) => {
77+ const textDocument = await vscode . workspace . openTextDocument ( fileDecorator ) ;
78+ await vscode . window . showTextDocument ( textDocument ) ;
79+ const position = new vscode . Position ( 7 , 2 ) ;
80+ const def = await vscode . commands . executeCommand < vscode . Location [ ] > ( 'vscode.executeDefinitionProvider' , textDocument . uri , position ) ;
81+ assert . equal ( def . length , 1 , 'Definition length is incorrect' ) ;
82+ assert . equal ( `${ def [ 0 ] . range . start . line } ,${ def [ 0 ] . range . start . character } ` , '4,0' , 'Start position is incorrect' ) ;
83+ assert . equal ( `${ def [ 0 ] . range . end . line } ,${ def [ 0 ] . range . end . character } ` , '5,22' , 'End position is incorrect' ) ;
84+ } ) ;
85+
86+ test ( 'Go to function decorator' , async ( ) => {
87+ const textDocument = await vscode . workspace . openTextDocument ( fileDecorator ) ;
88+ await vscode . window . showTextDocument ( textDocument ) ;
89+ const position = new vscode . Position ( 3 , 3 ) ;
90+ const def = await vscode . commands . executeCommand < vscode . Location [ ] > ( 'vscode.executeDefinitionProvider' , textDocument . uri , position ) ;
91+ assert . equal ( def . length , 1 , 'Definition length is incorrect' ) ;
92+ assert . equal ( `${ def [ 0 ] . range . start . line } ,${ def [ 0 ] . range . start . character } ` , '0,0' , 'Start position is incorrect' ) ;
93+ assert . equal ( `${ def [ 0 ] . range . end . line } ,${ def [ 0 ] . range . end . character } ` , '1,12' , 'End position is incorrect' ) ;
94+ } ) ;
95+
7596 test ( 'Across files' , done => {
7697 let textEditor : vscode . TextEditor ;
7798 let textDocument : vscode . TextDocument ;
0 commit comments