From 96f5b8ff5868bb92fbf30203b6073b041d603c29 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 18 Jan 2011 19:33:33 -0500 Subject: [PATCH] Multiple spaces now properly handled in keyword parser --- lib/prop_parser.js | 2 +- test/test-util-prop-parse-keywords.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/prop_parser.js b/lib/prop_parser.js index 320b23b..1940d2d 100644 --- a/lib/prop_parser.js +++ b/lib/prop_parser.js @@ -43,7 +43,7 @@ exports.parseKeywords = function ( prop ) { // the keywords are all words, except for the last, which is the // property name - keywords = prop.split( ' ' ); + keywords = prop.split( /\s+/ ); name = keywords.pop(); var i = keywords.length; diff --git a/test/test-util-prop-parse-keywords.js b/test/test-util-prop-parse-keywords.js index 4986d6c..609bafa 100644 --- a/test/test-util-prop-parse-keywords.js +++ b/test/test-util-prop-parse-keywords.js @@ -131,6 +131,9 @@ var common = require( './common' ), 'public bogus keywords foo3': '', 'public static final method': function() {}, + + // tricky tricky + 'lots of spaces': function() {}, }, parsed_keywords = {}, @@ -141,6 +144,8 @@ var common = require( './common' ), foo3: { 'public': true, 'bogus': true, 'keywords': true }, method: { 'public': true, 'static': true, 'final': true }, + + spaces: { 'lots': true, 'of': true }, } ; @@ -162,7 +167,7 @@ var common = require( './common' ), parsed_keywords[ prop ], expected[ prop ], "Keywords are properly recognized and made available for " + - "interpretation" + "interpretation (" + prop + ")" ); } } )();