Skip to content

Commit

Permalink
Merge pull request cucumber#2 from AndrewJohnBenjamin/master
Browse files Browse the repository at this point in the history
Table querying
  • Loading branch information
i-e-b committed Nov 26, 2014
2 parents 315b373 + 0a72950 commit a97320a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 7 deletions.
28 changes: 28 additions & 0 deletions lib/cucumber/ast/data_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,34 @@ var DataTable = function() {
return rawRows;
},

getRowForKey: function(key, aliases)
{
var positionOfPrimaryKey = 0;
var matchingRow = null;

if(key === null)
return null;

if (rowsCollection.length <= 1)
return null;

rowsCollection.syncForEach(function (row)
{
var rawRow = row.raw();
var cellValue = aliases ? aliases[rawRow[positionOfPrimaryKey]] : rawRow[positionOfPrimaryKey];

if(cellValue === null || cellValue === undefined)
return;

if (cellValue.trim() === key.trim())
{
matchingRow = rawRow;
}
});

return matchingRow;
},

hashes: function hashes() {
var raw = self.raw();
var hashDataTable = Cucumber.Type.HashDataTable(raw);
Expand Down
17 changes: 12 additions & 5 deletions lib/cucumber/cli/argument_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,21 @@ var ArgumentParser = function(argv) {
return tagGroups;
},

getStackFormat: function getStackFormat() {
var stackFormat = self.getOptionOrDefault(ArgumentParser.USE_SHORT_STACK_OPTION_NAME , ArgumentParser.DEFAULT_USE_SHORT_STACK_VALUE);
return stackFormat;
},
getStackFormat: function getStackFormat() {
var stackFormat = self.getOptionOrDefault(ArgumentParser.USE_SHORT_STACK_OPTION_NAME , ArgumentParser.DEFAULT_USE_SHORT_STACK_VALUE);
return stackFormat;
},

getFormat: function getFormat() {
getFormat: function getFormat() {
var format = self.getOptionOrDefault(ArgumentParser.FORMAT_OPTION_NAME, ArgumentParser.DEFAULT_FORMAT_VALUE);
return format;
},

getBreakOnSupportCodeLoaded: function getBreakOnSupportCodeLoaded() {
var breakOnSupportCodeLoaded = self.getOptionOrDefault(ArgumentParser.BRK_ON_SUPPORT_CODE_LOADED, ArgumentParser.DEFAULT_BRK_ON_SUPPORT_CODE_LOADED);
return breakOnSupportCodeLoaded;
},

getKnownOptionDefinitions: function getKnownOptionDefinitions() {
var definitions = {};
definitions[ArgumentParser.REQUIRE_OPTION_NAME] = [path, Array];
Expand Down Expand Up @@ -131,6 +136,8 @@ ArgumentParser.DEFAULT_FORMAT_VALUE = "progress";
ArgumentParser.TAGS_OPTION_NAME = "tags";
ArgumentParser.TAGS_OPTION_SHORT_NAME = "t";
ArgumentParser.USE_SHORT_STACK_OPTION_NAME = "shortStackTraces";
ArgumentParser.BRK_ON_SUPPORT_CODE_LOADED = "brkOnSupportCodeLoaded";
ArgumentParser.DEFAULT_BRK_ON_SUPPORT_CODE_LOADED = false;
ArgumentParser.DEFAULT_USE_SHORT_STACK_VALUE = false;
ArgumentParser.HELP_FLAG_NAME = "help";
ArgumentParser.HELP_FLAG_SHORT_NAME = "h";
Expand Down
6 changes: 5 additions & 1 deletion lib/cucumber/cli/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ var Configuration = function (argv) {
getSupportCodeLibrary: function getSupportCodeLibrary() {
var supportCodeFilePaths = argumentParser.getSupportCodeFilePaths();
var supportCodeLoader = Cucumber.Cli.SupportCodeLoader(supportCodeFilePaths);
var supportCodeLibrary = supportCodeLoader.getSupportCodeLibrary();
var supportCodeLibrary = supportCodeLoader.getSupportCodeLibrary();

if(argumentParser.getBreakOnSupportCodeLoaded())
debugger;

return supportCodeLibrary;
},

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"gherkin",
"tests"
],
"version": "0.4.4",
"version": "0.4.7",
"homepage": "http://github.com/cucumber/cucumber-js",
"author": "Julien Biezemans <[email protected]> (http://jbpros.net)",
"contributors": [
Expand Down

0 comments on commit a97320a

Please sign in to comment.