Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make sure `refType()` coerces string types properly

Test case included
  • Loading branch information...
commit 2807092a2e07242af034abb13d308e7ddbc8bcce 1 parent 27a7460
@TooTallNate authored
Showing with 11 additions and 1 deletion.
  1. +1 −1  lib/ref.js
  2. +10 −0 test/types.js
View
2  lib/ref.js
@@ -32,7 +32,7 @@ exports.cloneType = function cloneType (type) {
*/
exports.refType = function refType (type) {
- var rtn = exports.cloneType(type)
+ var rtn = exports.cloneType(exports.coerceType(type))
rtn.indirection++
return rtn
}
View
10 test/types.js
@@ -4,6 +4,16 @@ var ref = require('../')
describe('types', function () {
+ describe('refType()', function () {
+
+ it('should coerce string types', function () {
+ var intPtr = ref.refType('int')
+ assert.equal(2, intPtr.indirection)
+ assert.equal(intPtr.size, ref.types.int.size)
+ })
+
+ })
+
describe('size', function () {
Object.keys(ref.types).forEach(function (name) {
if (name === 'void') return
Please sign in to comment.
Something went wrong with that request. Please try again.