Squashed 'vendor/ruvector/' content from commit b64c2172
git-subtree-dir: vendor/ruvector git-subtree-split: b64c21726f2bb37286d9ee36a7869fef60cc6900
This commit is contained in:
46
npm/core/test-binding.mjs
Normal file
46
npm/core/test-binding.mjs
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Test to inspect what's actually exported from the native binding
|
||||
*/
|
||||
|
||||
import { createRequire } from 'node:module';
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
try {
|
||||
const nativeBinding = require('./native/linux-x64/ruvector.node');
|
||||
|
||||
console.log('=== Native Binding Inspection ===\n');
|
||||
console.log('Type:', typeof nativeBinding);
|
||||
console.log('Is null:', nativeBinding === null);
|
||||
console.log('Is undefined:', nativeBinding === undefined);
|
||||
console.log('\nKeys:', Object.keys(nativeBinding));
|
||||
console.log('\nProperties:');
|
||||
|
||||
for (const key of Object.keys(nativeBinding)) {
|
||||
const value = nativeBinding[key];
|
||||
console.log(` ${key}: ${typeof value}`);
|
||||
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
console.log(` Methods:`, Object.keys(value));
|
||||
}
|
||||
if (typeof value === 'function') {
|
||||
console.log(` Is constructor:`, value.prototype !== undefined);
|
||||
if (value.prototype) {
|
||||
console.log(` Prototype methods:`, Object.getOwnPropertyNames(value.prototype));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('\n=== Testing Functions ===\n');
|
||||
|
||||
if (nativeBinding.version) {
|
||||
console.log('version():', nativeBinding.version());
|
||||
}
|
||||
|
||||
if (nativeBinding.hello) {
|
||||
console.log('hello():', nativeBinding.hello());
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error.message);
|
||||
console.error(error.stack);
|
||||
}
|
||||
Reference in New Issue
Block a user