Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for writing JS strings to the "char" and "uchar" types
- Loading branch information
1 parent
313157f
commit f9b4aac
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
var assert = require('assert') | ||
var ref = require('../') | ||
|
||
describe('char', function () { | ||
|
||
it('should accept a JS String, and write the first char\'s code', function () { | ||
var val = 'a' | ||
|
||
var buf = ref.alloc('char', val) | ||
assert.strictEqual(val.charCodeAt(0), buf.deref()) | ||
|
||
buf = ref.alloc('uchar', val) | ||
assert.strictEqual(val.charCodeAt(0), buf.deref()) | ||
}) | ||
|
||
}) |