Skip to content

Commit

Permalink
Merge pull request #57 from Medium/daniel-fmt-upper
Browse files Browse the repository at this point in the history
fix upper-under formatting
  • Loading branch information
dmccartney authored Aug 17, 2016
2 parents aa19260 + 760ce2b commit b4d2fa1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ exports.toTitleCase = function(str) {
* @return {string}
*/
exports.toUpperUnderscoreCase = function(str) {
return String(str).replace(/([A-Z])/g, '_$1').toUpperCase()
return String(str).replace(/([a-z])([A-Z])/g, '$1_$2').toUpperCase()
}


Expand Down
5 changes: 3 additions & 2 deletions tests/project_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ builder.add(function testServiceTypeResolution(test) {

var running = shoes.services[0]
test.equal('shoes.RunningShoe', running.fullName)
test.equal('Lace', running.methods[0].name)
test.equal('lace', running.methods[0].camelName)
test.equal('LaceShoe', running.methods[0].name)
test.equal('laceShoe', running.methods[0].camelName)
test.equal('LACE_SHOE', running.methods[0].upperUnderscoreName)
var laceMethod = running.methods[0]
test.equal('shoes.Shoe', laceMethod.inputTypeDescriptor.fullName)
test.equal('shoes.FullShoe', laceMethod.outputTypeDescriptor.fullName)
Expand Down
2 changes: 1 addition & 1 deletion tests/protos/services.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ message FullShoe {
}

service RunningShoe {
rpc Lace (Shoe) returns (FullShoe);
rpc LaceShoe (Shoe) returns (FullShoe);
rpc Stride (Shoe) returns (FullShoe);
}

0 comments on commit b4d2fa1

Please sign in to comment.