From 9b96e9f8e6b9978871caf86ff300de15b9dc5469 Mon Sep 17 00:00:00 2001 From: Daniel Marcotte Date: Sun, 19 May 2013 14:52:58 -0700 Subject: [PATCH] Fix dash_s_spec Replace any dashes in a global defined in -- arguments with underscores. Also untag the other dash_s specs (they're passing) --- spec/tags/1.8/ruby/command_line/dash_s_tags.txt | 4 ---- spec/tags/1.9/ruby/command_line/dash_s_tags.txt | 8 -------- src/org/jruby/util/cli/ArgumentProcessor.java | 5 ++++- 3 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 spec/tags/1.8/ruby/command_line/dash_s_tags.txt delete mode 100644 spec/tags/1.9/ruby/command_line/dash_s_tags.txt diff --git a/spec/tags/1.8/ruby/command_line/dash_s_tags.txt b/spec/tags/1.8/ruby/command_line/dash_s_tags.txt deleted file mode 100644 index 707292fe703..00000000000 --- a/spec/tags/1.8/ruby/command_line/dash_s_tags.txt +++ /dev/null @@ -1,4 +0,0 @@ -fails:The -s command line option when using -- to stop parsing parses long args into globals -fails:The -s command line option when using -- to stop parsing converts extra dashes into underscorse -fails:The -s command line option when running a script parses long args into globals -fails:The -s command line option when running a script converts extra dashes into underscorse diff --git a/spec/tags/1.9/ruby/command_line/dash_s_tags.txt b/spec/tags/1.9/ruby/command_line/dash_s_tags.txt deleted file mode 100644 index a59a09fd742..00000000000 --- a/spec/tags/1.9/ruby/command_line/dash_s_tags.txt +++ /dev/null @@ -1,8 +0,0 @@ -fails:The -s command line option when using -- to stop parsing parses long args into globals -fails:The -s command line option when using -- to stop parsing converts extra dashes into underscorse -fails:The -s command line option when running a script parses long args into globals -fails:The -s command line option when running a script converts extra dashes into underscorse -fails(compiler):The -s command line option when using -- to stop parsing parses long args into globals -fails(compiler):The -s command line option when using -- to stop parsing converts extra dashes into underscorse -fails(compiler):The -s command line option when running a script parses long args into globals -fails(compiler):The -s command line option when running a script converts extra dashes into underscorse diff --git a/src/org/jruby/util/cli/ArgumentProcessor.java b/src/org/jruby/util/cli/ArgumentProcessor.java index 72cc7cc7f3a..710768ee19b 100644 --- a/src/org/jruby/util/cli/ArgumentProcessor.java +++ b/src/org/jruby/util/cli/ArgumentProcessor.java @@ -118,7 +118,10 @@ private void processArgv() { arg = arg.substring(1); if (arg.indexOf('=') > 0) { String[] keyvalue = arg.split("=", 2); - config.getOptionGlobals().put(keyvalue[0], keyvalue[1]); + + // argv globals get their dashes replaced with underscores + String globalName = keyvalue[0].replaceAll("-", "_"); + config.getOptionGlobals().put(globalName, keyvalue[1]); } else { config.getOptionGlobals().put(arg, null); }