@@ -379,7 +379,28 @@ suite('Hover Definition', () => {
379379 assert . equal ( `${ def [ 0 ] . range . start . line } ,${ def [ 0 ] . range . start . character } ` , '12,5' , 'Start position is incorrect' ) ;
380380 assert . equal ( `${ def [ 0 ] . range . end . line } ,${ def [ 0 ] . range . end . character } ` , '12,12' , 'End position is incorrect' ) ;
381381 assert . equal ( def [ 0 ] . contents [ 0 ] . value , 'def randint(self, a, b)' , 'Invalid content items' ) ;
382- const documentation = `Return random integer in range [a, b], including both end points.${ EOL } ` ;
382+ const documentation = `Return random integer in range [a, b], including both end points.` ;
383+ assert . equal ( def [ 0 ] . contents [ 1 ] , documentation , 'Invalid conents' ) ;
384+ } ) . then ( done , done ) ;
385+ } ) ;
386+
387+ test ( 'Highlight Function' , done => {
388+ let textEditor : vscode . TextEditor ;
389+ let textDocument : vscode . TextDocument ;
390+ return vscode . workspace . openTextDocument ( fileHover ) . then ( document => {
391+ textDocument = document ;
392+ return vscode . window . showTextDocument ( textDocument ) ;
393+ } ) . then ( editor => {
394+ assert ( vscode . window . activeTextEditor , 'No active editor' ) ;
395+ textEditor = editor ;
396+ const position = new vscode . Position ( 8 , 14 ) ;
397+ return vscode . commands . executeCommand ( 'vscode.executeHoverProvider' , textDocument . uri , position ) ;
398+ } ) . then ( ( def : [ { range : vscode . Range , contents : { language : string , value : string } [ ] } ] ) => {
399+ assert . equal ( def . length , 1 , 'Definition lenght is incorrect' ) ;
400+ assert . equal ( `${ def [ 0 ] . range . start . line } ,${ def [ 0 ] . range . start . character } ` , '8,11' , 'Start position is incorrect' ) ;
401+ assert . equal ( `${ def [ 0 ] . range . end . line } ,${ def [ 0 ] . range . end . character } ` , '8,15' , 'End position is incorrect' ) ;
402+ assert . equal ( def [ 0 ] . contents [ 0 ] . value , 'def acos(x)' , 'Invalid content items' ) ;
403+ const documentation = `Return the arc cosine (measured in radians) of x.` ;
383404 assert . equal ( def [ 0 ] . contents [ 1 ] , documentation , 'Invalid conents' ) ;
384405 } ) . then ( done , done ) ;
385406 } ) ;
@@ -393,27 +414,15 @@ suite('Hover Definition', () => {
393414 } ) . then ( editor => {
394415 assert ( vscode . window . activeTextEditor , 'No active editor' ) ;
395416 textEditor = editor ;
396- const position = new vscode . Position ( 15 , 10 ) ;
417+ const position = new vscode . Position ( 14 , 14 ) ;
397418 return vscode . commands . executeCommand ( 'vscode.executeHoverProvider' , textDocument . uri , position ) ;
398419 } ) . then ( ( def : [ { range : vscode . Range , contents : { language : string , value : string } [ ] } ] ) => {
399420 assert . equal ( def . length , 1 , 'Definition lenght is incorrect' ) ;
400- assert . equal ( `${ def [ 0 ] . range . start . line } ,${ def [ 0 ] . range . start . character } ` , '15,2 ' , 'Start position is incorrect' ) ;
401- assert . equal ( `${ def [ 0 ] . range . end . line } ,${ def [ 0 ] . range . end . character } ` , '15,10 ' , 'End position is incorrect' ) ;
402- const signature = `def __init__ (self, group=None, target=None, name=None,${ EOL } args=(), kwargs=None, verbose=None)` ;
421+ assert . equal ( `${ def [ 0 ] . range . start . line } ,${ def [ 0 ] . range . start . character } ` , '14,9 ' , 'Start position is incorrect' ) ;
422+ assert . equal ( `${ def [ 0 ] . range . end . line } ,${ def [ 0 ] . range . end . character } ` , '14,15 ' , 'End position is incorrect' ) ;
423+ const signature = `"class Thread (self, group=None, target=None, name=None,${ EOL } args=(), kwargs=None, verbose=None)" ` ;
403424 assert . equal ( def [ 0 ] . contents [ 0 ] . value , signature , 'Invalid content items' ) ;
404- const documentation = `This constructor should always be called with keyword arguments. Arguments are:${ EOL } ${ EOL } ` +
405- `*group* should be None; reserved for future extension when a ThreadGroup${ EOL } ` +
406- `class is implemented.${ EOL } ${ EOL } ` +
407- `*target* is the callable object to be invoked by the run()${ EOL } ` +
408- `method. Defaults to None, meaning nothing is called.${ EOL } ${ EOL } ` +
409- `*name* is the thread name. By default, a unique name is constructed of${ EOL } ` +
410- `the form "Thread-N" where N is a small decimal number.${ EOL } ${ EOL } ` +
411- `*args* is the argument tuple for the target invocation. Defaults to ().${ EOL } ${ EOL } ` +
412- `*kwargs* is a dictionary of keyword arguments for the target${ EOL } ` +
413- `invocation. Defaults to {}.${ EOL } ${ EOL } ` +
414- `If a subclass overrides the constructor, it must make sure to invoke${ EOL } ` +
415- `the base class constructor (Thread.__init__()) before doing anything${ EOL } ` +
416- `else to the thread.` ;
425+ const documentation = `A class that represents a thread of control.${ EOL } ${ EOL } This class can be safely subclassed in a limited fashion.` ;
417426 assert . equal ( def [ 0 ] . contents [ 1 ] , documentation , 'Invalid conents' ) ;
418427 } ) . then ( done , done ) ;
419428 } ) ;
0 commit comments