From 01882a231bb8e14b09b4f0577bf3374b31a6f088 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Mon, 4 Nov 2013 07:51:23 -0800 Subject: [PATCH] test for variable-scoping issue in JSDoc 3.2.1 (#513) --- test/fixtures/exportstag5.js | 13 +++++++++++++ test/specs/tags/exportstag.js | 12 +++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/exportstag5.js diff --git a/test/fixtures/exportstag5.js b/test/fixtures/exportstag5.js new file mode 100644 index 00000000..b2c5fc8e --- /dev/null +++ b/test/fixtures/exportstag5.js @@ -0,0 +1,13 @@ +define(function() { + 'use strict'; + var bar = function() {}; + /** @exports Foo */ + var Foo = Object.create( + /** @lends module:Foo.prototype */ + { + /** This should be in the Foo module doc. */ + bar : function() {} + } + ); + return Foo; +}); diff --git a/test/specs/tags/exportstag.js b/test/specs/tags/exportstag.js index 6d422754..c1e06a04 100644 --- a/test/specs/tags/exportstag.js +++ b/test/specs/tags/exportstag.js @@ -1,3 +1,4 @@ +/*global describe: true, expect: true, it: true, jasmine: true */ describe("@exports tag", function() { describe("object literals", function() { @@ -86,4 +87,13 @@ describe("@exports tag", function() { //expect(inhead.memberof, 'module:html/utils'); }); }); -}); \ No newline at end of file + + describe('variable shadowing', function() { + var docSet = jasmine.getDocSetFromFile('test/fixtures/exportstag5.js'); + var method = docSet.getByLongname('module:Foo#bar')[0]; + + it('A variable defined in an inner scope should correctly shadow a variable in an outer scope.', function() { + expect(method.description).toBe('This should be in the Foo module doc.'); + }); + }); +});