Browse Source

test: remove smalloc add-on test

The smalloc module is about to be deprecated and removed.  Remove the
add-on test now so it's not forgotten about in the upcoming purge.

PR-URL: https://github.com/nodejs/io.js/pull/1835
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
v2.3.1-release
Ben Noordhuis 10 years ago
parent
commit
e0e96acc6f
  1. 30
      test/addons/smalloc-alloc/binding.cc
  2. 8
      test/addons/smalloc-alloc/binding.gyp
  3. 10
      test/addons/smalloc-alloc/test.js

30
test/addons/smalloc-alloc/binding.cc

@ -1,30 +0,0 @@
#include <node.h>
#include <smalloc.h>
#include <v8.h>
using namespace v8;
void Alloc(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<Object> obj = Object::New(isolate);
size_t len = args[0]->Uint32Value();
node::smalloc::Alloc(isolate, obj, len);
args.GetReturnValue().Set(obj);
}
void Dispose(const FunctionCallbackInfo<Value>& args) {
node::smalloc::AllocDispose(args.GetIsolate(), args[0].As<Object>());
}
void HasExternalData(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(
node::smalloc::HasExternalData(args.GetIsolate(), args[0].As<Object>()));
}
void init(Handle<Object> target) {
NODE_SET_METHOD(target, "alloc", Alloc);
NODE_SET_METHOD(target, "dispose", Dispose);
NODE_SET_METHOD(target, "hasExternalData", HasExternalData);
}
NODE_MODULE(binding, init);

8
test/addons/smalloc-alloc/binding.gyp

@ -1,8 +0,0 @@
{
'targets': [
{
'target_name': 'binding',
'sources': [ 'binding.cc' ]
}
]
}

10
test/addons/smalloc-alloc/test.js

@ -1,10 +0,0 @@
'use strict';
var assert = require('assert');
var binding = require('./build/Release/binding');
var obj = binding.alloc(16);
for (var i = 0; i < 16; i++) {
assert.ok(typeof obj[i] == 'number');
}
assert.ok(binding.hasExternalData(obj));
binding.dispose(obj);
assert.ok(typeof obj[0] !== 'number');
Loading…
Cancel
Save