Skip to content

Commit

Permalink
Unit test modified to relect changes that names are not automaticly c…
Browse files Browse the repository at this point in the history
…onverted to camel_case
  • Loading branch information
Adam Magaluk committed Nov 19, 2012
1 parent d45c173 commit bbb6092
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions test/unittest.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,80 +29,80 @@ assert.throws(function() {


assert.strictEqual(T.parse( assert.strictEqual(T.parse(
T.serialize({ T.serialize({
optionalInt32: '3' optional_int32: '3'
}) })
).optionalInt32, 3, 'Number conversion'); ).optional_int32, 3, 'Number conversion');


assert.strictEqual(T.parse( assert.strictEqual(T.parse(
T.serialize({ T.serialize({
optionalInt32: '' optional_int32: ''
}) })
).optionalInt32, 0, 'Number conversion'); ).optional_int32, 0, 'Number conversion');


assert.strictEqual(T.parse( assert.strictEqual(T.parse(
T.serialize({ T.serialize({
optionalInt32: 'foo' optional_int32: 'foo'
}) })
).optionalInt32, 0, 'Number conversion'); ).optional_int32, 0, 'Number conversion');


assert.strictEqual(T.parse( assert.strictEqual(T.parse(
T.serialize({ T.serialize({
optionalInt32: {} optional_int32: {}
}) })
).optionalInt32, 0, 'Number conversion'); ).optional_int32, 0, 'Number conversion');


assert.strictEqual(T.parse( assert.strictEqual(T.parse(
T.serialize({ T.serialize({
optionalInt32: null optional_int32: null
}) })
).optionalInt32, undefined, 'null'); ).optional_int32, undefined, 'null');


assert.throws(function() { assert.throws(function() {
T.serialize({ T.serialize({
optionalNestedEnum: 'foo' optional_nested_enum: 'foo'
}); });
}, Error, 'Unknown enum'); }, Error, 'Unknown enum');


assert.throws(function() { assert.throws(function() {
T.serialize({ T.serialize({
optionalNestedMessage: 3 optional_nested_message: 3
}); });
}, Error, 'Not an object'); }, Error, 'Not an object');


assert.throws(function() { assert.throws(function() {
T.serialize({ T.serialize({
repeatedNestedMessage: '' repeated_nested_message: ''
}); });
}, Error, 'Not an array'); }, Error, 'Not an array');


assert.bufferEqual(T.parse( assert.bufferEqual(T.parse(
T.serialize({ T.serialize({
optionalBytes: new Buffer('foo') optional_bytes: new Buffer('foo')
}) })
).optionalBytes, new Buffer('foo')); ).optional_bytes, new Buffer('foo'));


assert.bufferEqual(T.parse( assert.bufferEqual(T.parse(
T.serialize({ T.serialize({
optionalBytes: 'foo' optional_bytes: 'foo'
}) })
).optionalBytes, new Buffer('foo')); ).optional_bytes, new Buffer('foo'));


assert.bufferEqual(T.parse( assert.bufferEqual(T.parse(
T.serialize({ T.serialize({
optionalBytes: '\u20ac' optional_bytes: '\u20ac'
}) })
).optionalBytes, new Buffer('\u00e2\u0082\u00ac', 'binary')); ).optional_bytes, new Buffer('\u00e2\u0082\u00ac', 'binary'));


assert.bufferEqual(T.parse( assert.bufferEqual(T.parse(
T.serialize({ T.serialize({
optionalBytes: '\u0000' optional_bytes: '\u0000'
}) })
).optionalBytes, new Buffer('\u0000', 'binary')); ).optional_bytes, new Buffer('\u0000', 'binary'));


assert.equal(T.parse( assert.equal(T.parse(
T.serialize({ T.serialize({
optionalString: new Buffer('f\u0000o') optional_string: new Buffer('f\u0000o')
}) })
).optionalString, 'f\u0000o'); ).optional_string, 'f\u0000o');


puts('Success'); puts('Success');

1 comment on commit bbb6092

@chrisdew
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work, but this will brake existing code. I think camelCasing needs to be part of a 'options framework' for protobuf, defaulting to true for camelCasing.

Please sign in to comment.