From eeb5f77518da9501610f9c96e0e0a4bb35a593ed Mon Sep 17 00:00:00 2001 From: Maximiliano Korp Date: Tue, 11 Nov 2014 10:10:03 -0700 Subject: [PATCH] voidcheck string pointers and reenable attr test --- generate/descriptor.json | 8 ++++++++ generate/partials/convert_to_v8.cc | 12 +++++++++--- test/tests/attr.js | 11 ++--------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/generate/descriptor.json b/generate/descriptor.json index 4750ffb8c..37595e5f1 100644 --- a/generate/descriptor.json +++ b/generate/descriptor.json @@ -3,6 +3,14 @@ "functions": { "git_attr_foreach": { "ignore": true + }, + "git_attr_get": { + "isAsync": true, + "args": { + "value_out": { + "isReturn": true + } + } } } }, diff --git a/generate/partials/convert_to_v8.cc b/generate/partials/convert_to_v8.cc index 277d2b8da..fd2802a0d 100644 --- a/generate/partials/convert_to_v8.cc +++ b/generate/partials/convert_to_v8.cc @@ -1,12 +1,18 @@ // start convert_to_v8 block {%if cppClassName == 'String' %} + if ({{= parsedName =}}){ {%if size %} -to = NanNew({{= parsedName =}}, {{ size }}); + to = NanNew({{= parsedName =}}, {{ size }}); {%elsif cType == 'char **' %} -to = NanNew(*{{= parsedName =}}); + + to = NanNew(*{{= parsedName =}}); {%else%} -to = NanNew({{= parsedName =}}); + to = NanNew({{= parsedName =}}); {%endif%} + } + else { + to = NanNull(); + } {%if freeFunctionName %} {{ freeFunctionName }}({{= parsedName =}}); diff --git a/test/tests/attr.js b/test/tests/attr.js index 878c445fd..f847812ec 100644 --- a/test/tests/attr.js +++ b/test/tests/attr.js @@ -25,15 +25,8 @@ describe("Attr", function() { Attr.cacheFlush(this.repository); }); - // FIXME Currently segfaults. - it.skip("can lookup the value of a git attribute", function() { + it("can lookup the value of a git attribute", function() { var flags = Attr.Check.NO_SYSTEM; - var getAttr = Attr.get(this.repository, flags, ".gitattributes", "test"); - - return getAttr.then(function(val) { - console.log(val); - }).catch(function(ex) { - console.log(ex); - }); + Attr.get(this.repository, flags, ".gitattributes", "test"); }); });