Skip to content

Commit

Permalink
Merge pull request #7 from k--kato/fix/#6
Browse files Browse the repository at this point in the history
fixed #6
  • Loading branch information
Keisuke KATO committed Apr 2, 2016
2 parents a11e798 + 5c84873 commit c2f8ae1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "out/src"
"outDir": "${workspaceRoot}/out/src"
},
{
"name": "Launch Tests",
Expand All @@ -20,7 +20,7 @@
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "out/test"
"outDir": "${workspaceRoot}/out/test"
}
]
}
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "docomment",
"version": "0.0.4",
"version": "0.0.5",
"publisher": "k--kato",
"engines": {
"vscode": "^0.10.6"
"vscode": "^0.10.x"
},
"displayName": "C# XML Documentation Comments",
"description": "Generate C# XML documentation comments for ///",
Expand Down Expand Up @@ -34,13 +34,13 @@
"dependencies": {
},
"devDependencies": {
"typescript": "^1.7.5",
"vscode": "^0.10.x",
"tslint": "^3.3.0",
"typescript": "^1.8.9",
"vscode": "^0.11.10",
"tslint": "^3.6.0",
"istanbul": "^0.4.2",
"coveralls": "^2.11.6",
"coveralls": "^2.11.9",
"mocha": "^2.4.5",
"mocha-lcov-reporter": "^1.0.0"
"mocha-lcov-reporter": "^1.2.0"
},
"extensionDependencies": [
],
Expand All @@ -51,7 +51,8 @@
"watch": "node ./node_modules/vscode/bin/compile -watch -p ./",
"test": "node ./node_modules/vscode/bin/test",
"coverage_travis": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec --ui tdd ./out/test/**/*.js",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec --ui tdd ./out/test/**/*.js"
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec --ui tdd ./out/test/**/*.js",
"postinstall": "node ./node_modules/vscode/bin/install"
},
"icon": "images/docomment.png",
"license": "MIT",
Expand Down
5 changes: 4 additions & 1 deletion src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ export class SyntacticAnalysisCSharp {

let paramName: Array<string> = new Array<string>();
params[1].split(',').forEach(param => {
const name: RegExpMatchArray = param.match(/\s(\w+)$/);
const hasOptionaParam: boolean = param.match(/\S+\s+\S+\s*=/) !== null;
const name: RegExpMatchArray = (hasOptionaParam)
? param.match(/\S+\s+(\S+)\s*=.*/)
: param.match(/(\S+)\s*$/);
if (name !== null && name.length === 2) {
paramName.push(name[1]);
}
Expand Down
19 changes: 19 additions & 0 deletions test/SyntacticAnalysis/SyntacticAnalysisCSharp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,23 @@ suite('SyntacticAnalysis.SyntacticAnalysisCSharp.IsClass Tests', () => {
assert.equal(actual, true);
});

test(`
Category: Black-box testing
Class : SyntacticAnalysis.SyntacticAnalysisCSharp
Method : GetMethodParamNameList
STATE : -
IN : ' public void Save(string data, Action<AchievementSavedResponse> onComplete = null) {'
OUT : [0]='data', [1]='onComplete'
`, () => {
// arrange
const code = ' public void Save(string data, Action<AchievementSavedResponse> onComplete = null) {';

// act
const actual: Array<string> = SyntacticAnalysisCSharp.GetMethodParamNameList(code);

// assert
assert.equal(actual[0], 'data');
assert.equal(actual[1], 'onComplete');
});

});
1 change: 1 addition & 0 deletions test/TestData/X.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ public class Nested{} // "T:N.X.Nested"
public List<int> bb<int>(string s, ref List<int> y, void * z){return 1;} // "M:N.X.bb(System.String,System.Int32@,=System.Void*)"
int bb(string s, ref int y, void * z){return 1;} // "M:N.X.bb(System.String,System.Int32@,=System.Void*)"
int Generate(int level);
public void Save(string data, Action<AchievementSavedResponse> onComplete = null);
}
}

0 comments on commit c2f8ae1

Please sign in to comment.