16 lines
406 B
JavaScript
Raw Permalink Normal View History

2025-04-28 12:25:20 +08:00
'use strict';
const assert = require('assert');
const ref = require('../');
describe('char', function() {
it('should accept a JS String, and write the first char\'s code', function() {
const val = 'a';
let buf = ref.alloc('char', val);
assert.strictEqual(val.charCodeAt(0), buf.deref());
buf = ref.alloc('uchar', val);
assert.strictEqual(val.charCodeAt(0), buf.deref());
});
});