Skip to content

Commit

Permalink
Complete doc and unit tests with column accessors
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick Galatol committed Jun 15, 2016
1 parent 6ff5bc7 commit 746066c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
44 changes: 44 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
- [ReflectionScope.getFunctionsByType](#reflectionscopegetfunctionsbytype) - Gets functions from given type
- [ReflectionScope.getStartLine](#reflectionscopegetstartline) - Gets starting line number
- [ReflectionScope.getEndLine](#reflectionscopegetendline) - Gets ending line number
- [ReflectionScope.getStartColumn](#reflectionscopegetstartcolumn) - Gets starting column number
- [ReflectionScope.getEndColumn](#reflectionscopegetendcolumn) - Gets ending column number
- [ReflectionScope.getVariables](#reflectionscopegetvariables) - Gets variables
- [ReflectionFile](#reflectionfile) - The ReflectionFile class
- [ReflectionFile.constructor](#reflectionfileconstructor) - Constructs a ReflectionFile
Expand Down Expand Up @@ -238,6 +240,48 @@ console.log(endLine);
// outputs "3"
````

#### ReflectionScope.getStartColumn()
Get the starting column number

##### Parameters
This function has no parameters

##### Return value
**Number** The starting column number

##### Examples
```javascript
// ./path/to/file.js
function foo(param) {
console.log("helloworld");
}

var startColumn = file.getStartColumn();
console.log(startColumn);
// outputs "0"
````

#### ReflectionScope.getEndColumn()
Get the ending column number

##### Parameters
This function has no parameters

##### Return value
**Number** The starting column number

##### Examples
```javascript
// ./path/to/file.js
function foo(param) {
console.log("helloworld");
}

var endColumn = file.getEndColumn();
console.log(endColumn);
// outputs "1"
````

#### ReflectionScope.getVariables([name])
Get the variables

Expand Down
8 changes: 8 additions & 0 deletions test/ReflectionScopeAbstract.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,13 @@ describe('ReflectionScopeAbstract', function () {
expect(reflectedScope.getEndLine).toThrowError('Implementing interface "ReflectionScopeAbstract" should override the method "getEndLine"');
});

it('should throw an error if the method getStartColumn is not overridden', function () {
expect(reflectedScope.getStartColumn).toThrowError('Implementing interface "ReflectionScopeAbstract" should override the method "getStartColumn"');
});

it('should throw an error if the method getEndColumn is not overridden', function () {
expect(reflectedScope.getEndColumn).toThrowError('Implementing interface "ReflectionScopeAbstract" should override the method "getEndColumn"');
});

});
});

0 comments on commit 746066c

Please sign in to comment.