Skip to content

Commit

Permalink
Showing 687 changed files with 2,501 additions and 2,036 deletions.
50 changes: 34 additions & 16 deletions core/src/main/java/org/jruby/util/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
@@ -714,33 +714,51 @@ private void logScriptResolutionFailure(String path) {
}
}

private static final Set<String> KNOWN_PROPERTIES;
private static final Set<String> KNOWN_PROPERTIES = new HashSet<>();

static {
final Set<String> propertyNames = new HashSet<>();
propertyNames.addAll(Options.getPropertyNames());
propertyNames.add("jruby.home");
propertyNames.add("jruby.script");
propertyNames.add("jruby.shell");
propertyNames.add("jruby.lib");
propertyNames.add("jruby.bindir");
propertyNames.add("jruby.jar");
propertyNames.add("jruby.compat.version");
propertyNames.add("jruby.reflection");
propertyNames.add("jruby.thread.pool.enabled");
propertyNames.add("jruby.memory.max");
propertyNames.add("jruby.stack.max");
KNOWN_PROPERTIES = propertyNames;
KNOWN_PROPERTIES.addAll(Options.getPropertyNames());
KNOWN_PROPERTIES.add("jruby.home");
KNOWN_PROPERTIES.add("jruby.script");
KNOWN_PROPERTIES.add("jruby.shell");
KNOWN_PROPERTIES.add("jruby.lib");
KNOWN_PROPERTIES.add("jruby.bindir");
KNOWN_PROPERTIES.add("jruby.jar");
KNOWN_PROPERTIES.add("jruby.compat.version");
KNOWN_PROPERTIES.add("jruby.reflection");
KNOWN_PROPERTIES.add("jruby.thread.pool.enabled");
KNOWN_PROPERTIES.add("jruby.memory.max");
KNOWN_PROPERTIES.add("jruby.stack.max");
}

private static final List<String> KNOWN_PROPERTY_PREFIXES = new ArrayList<>();

static {
KNOWN_PROPERTY_PREFIXES.add("jruby.openssl.");
}

private void checkProperties() {
for (String propertyName : System.getProperties().stringPropertyNames()) {
if (propertyName.startsWith("jruby.")) {
if (!KNOWN_PROPERTIES.contains(propertyName)) {
if (!isPropertySupported(propertyName)) {
System.err.println("jruby: warning: unknown property " + propertyName);
}
}
}
}

private boolean isPropertySupported(String propertyName) {
if (KNOWN_PROPERTIES.contains(propertyName)) {
return true;
}

for (String prefix : KNOWN_PROPERTY_PREFIXES) {
if (propertyName.startsWith(prefix)) {
return true;
}
}

return false;
}

}
1 change: 1 addition & 0 deletions maven/jruby-complete/pom.rb
Original file line number Diff line number Diff line change
@@ -117,5 +117,6 @@
jdk '1.8'
end
plugin :invoker, :pomExcludes => ['osgi_many_bundles_with_embedded_gems_felix-3.2/pom.xml', '${its.j2ee}', '${its.osgi}']
properties 'javadoc.opts' => '-Xdoclint:none'
end
end
2 changes: 1 addition & 1 deletion pom.rb
Original file line number Diff line number Diff line change
@@ -288,7 +288,7 @@
execute_goals('jar-no-fork', :id => 'attach-sources')
end
plugin(:javadoc) do
execute_goals('jar', :id => 'attach-javadocs')
execute_goals('jar', :id => 'attach-javadocs', :configuration => [ xml('<additionalparam>${javadoc.opts}</additionalparam>') ])
end
end

4 changes: 2 additions & 2 deletions spec/mspec/README.md
Original file line number Diff line number Diff line change
@@ -75,12 +75,12 @@ ruby -S bundle exec rspec spec/helpers/ruby_exe_spec.rb

## Documentation

See http://rubyspec.org
See http://ruby.github.io/rubyspec.github.io/


## Source Code

See https://github.com/rubyspec/mspec
See https://github.com/ruby/mspec


## License
10 changes: 9 additions & 1 deletion spec/mspec/lib/mspec/helpers/numeric.rb
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ def bignum_value(plus=0)
# values.
guard = SpecGuard.new

if guard.standard? or guard.implementation? :topaz or guard.implementation? :opal
if guard.standard? or guard.implementation? :topaz
if guard.wordsize? 32
def fixnum_max()
(2**30) - 1
@@ -36,6 +36,14 @@ def fixnum_min()
-(2**62)
end
end
elsif guard.implementation? :opal
def fixnum_max()
Integer::MAX
end

def fixnum_min()
Integer::MIN
end
elsif guard.implementation? :rubinius
def fixnum_max()
Fixnum::MAX
7 changes: 0 additions & 7 deletions spec/ruby/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
language: ruby
os:
- linux
- osx
rvm:
- 2.0.0-p598
- 2.1.5
@@ -11,10 +8,6 @@ install:
- git clone https://github.com/ruby/mspec.git ../mspec
script:
- ../mspec/bin/mspec
matrix:
allow_failures:
- os: osx
rvm: ruby-head
branches:
only:
- master
2 changes: 1 addition & 1 deletion spec/ruby/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ Specify `core` or `library` as the `base`.
This is very easy, just run the command below in your `rubyspec` directory.
`ruby` must be a recent version of MRI.

$ ruby --disable-gem ../mspec/bin/mkspec
$ ruby --disable-gem ../mspec/bin/mkspec

You might also want to search for:

55 changes: 8 additions & 47 deletions spec/ruby/TODO
Original file line number Diff line number Diff line change
@@ -1,50 +1,11 @@
* Decide a way to test methods that are only visible given a specific
command-line option. For example, Kernel#gsub with -n/-p on 1.9.
* Decide how to guard bugs that are regressions. IOW, if a bug appears in 1.9
but not in 1.8, we should be able to guard it from 1.9 while still yielding
to 1.8.
* Look at automating discovery of guarded bugs which have been fixed. Use
mocks for all Math functions that coerce with #to_f; currently a fixture
* Look at automating discovery of guarded bugs which have been fixed.
* Use mocks for all Math functions that coerce with #to_f; currently a fixture
is used.
* Consider filing ticket about 1.8.6's ARGF#readlines returning nil at the end
of a stream. 1.8.7+ returns an empty Array, as the rdoc since 1.8.6 implies.
* File ticket: $ ruby86 -e 'p ARGF.skip'
-e:1:in `skip': undefined method `close' for false:FalseClass (NoMethodError)
from -e:1 (Reported as bug #1653; update spec based on outcome).
* Use the variable matchers which take into consideration the difference of the
returned type of variable name. Which is String on 1.8 and Symbol on 1.9.
Examples include: have_constant, have_instance_variable, etc.
* Ascertain backport policy for 1.9.2 -> 1.9.1 -> 1.8.7. Are bug fixes merged
backwards by default, or is it all case by case? The answer will inform how
we handle ruby_bug guards that pass on HEAD, but fail on earlier versions.
* Replace Infinity/NaN hacks with the new helpers.
* Think about how we can support exhaustive tests of certain features.
* Specify 'public' and 'protected' keywords.

# Windows
==========
* Run core/kernel/require_spec.rb on Windows, check all tests pass; fix as
necessary.
* Confirm that core/dir/home_spec.rb passes on Windows under 1.9.

# 1.8
=========
* File ticket about Rational(1, 2) != Rational.new!(4, 8) on 1.8...

# 1.9
=========
* Methods that could modify a frozen receiver should raise RuntimeError, even
if the method's arguments are such that no modification would occur.
* The inclusion of 'rational' by default has resulted in ZeroDivisionErrors
being raised where they previously weren't. What is the rule of thumb in
determining whether this outcome is intentional?
* Unify treatment of bugs after conversation with brixen. Bugs that occur only
in 1.9 shouldn't be guarded; we just tag them with the bug number, e.g. " mspec
tag --add 'fails(#555)' -e 'the failing stuff' path/to/spec".
* Spec Ripper.
* 1.9 defines methods such as instance_eval on BasicObject; not Kernel as in
1.8. Do we need to share these specs so that the methods are specified in
the correct place?
* Determine how we're going to specify the vast Gem module...
* Specify require_relative
* Share Enumerable#join with Hash#join once Enumerable#join is more stable.
* use ruby_exe instead of RUBY_EXE/RUBY_FLAGS.
* investigate slow specs (run with -fp) and make them faster.
* restore some caller specs from 642bf529
* restore refinements specs and update. See 56c5528f and f20a62e8.
* remove not_compliant_on/diverge_on guards, these specs are
implementation-specific and either should be generalized or removed.
8 changes: 4 additions & 4 deletions spec/ruby/command_line/dash_a_spec.rb
Original file line number Diff line number Diff line change
@@ -4,14 +4,14 @@
end

it "runs the code in loop conditional on Kernel.gets()" do
ruby_exe("puts $F.last", :options => "-n -a", :escape => true,
:args => " < #{@names}").should ==
ruby_exe("puts $F.last", options: "-n -a", escape: true,
args: " < #{@names}").should ==
"jones\nfield\ngrey\n"
end

it "sets $-a" do
ruby_exe("puts $-a", :options => "-n -a", :escape => true,
:args => " < #{@names}").should ==
ruby_exe("puts $-a", options: "-n -a", escape: true,
args: " < #{@names}").should ==
"true\ntrue\ntrue\n"
end
end
4 changes: 2 additions & 2 deletions spec/ruby/command_line/dash_c_spec.rb
Original file line number Diff line number Diff line change
@@ -2,11 +2,11 @@

describe "The -c command line option" do
it "checks syntax in given file" do
ruby_exe(nil, :args => "-c #{__FILE__}").chomp.should == "Syntax OK"
ruby_exe(nil, args: "-c #{__FILE__}").chomp.should == "Syntax OK"
end

it "checks syntax in -e strings" do
ruby_exe(nil, :args => "-c -e 'puts 1' -e 'hello world'").chomp.should == "Syntax OK"
ruby_exe(nil, args: "-c -e 'puts 1' -e 'hello world'").chomp.should == "Syntax OK"
end

#Also needs spec for reading from STDIN
12 changes: 6 additions & 6 deletions spec/ruby/command_line/dash_d_spec.rb
Original file line number Diff line number Diff line change
@@ -6,17 +6,17 @@
end

it "sets $DEBUG to true" do
ruby_exe(@script, :options => "-d",
:args => "0 2> #{dev_null()}").chomp.should == "$DEBUG true"
ruby_exe(@script, options: "-d",
args: "0 2> #{dev_null()}").chomp.should == "$DEBUG true"
end

it "sets $VERBOSE to true" do
ruby_exe(@script, :options => "-d",
:args => "1 2> #{dev_null()}").chomp.should == "$VERBOSE true"
ruby_exe(@script, options: "-d",
args: "1 2> #{dev_null()}").chomp.should == "$VERBOSE true"
end

it "sets $-d to true" do
ruby_exe(@script, :options => "-d",
:args => "2 2> #{dev_null()}").chomp.should == "$-d true"
ruby_exe(@script, options: "-d",
args: "2 2> #{dev_null()}").chomp.should == "$-d true"
end
end
10 changes: 5 additions & 5 deletions spec/ruby/command_line/dash_e_spec.rb
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
end

it "joins multiple strings with newlines" do
ruby_exe(nil, :args => %Q{-e "puts 'hello" -e "world'" 2>&1}).chomp.should == "hello\nworld"
ruby_exe(nil, args: %Q{-e "puts 'hello" -e "world'" 2>&1}).chomp.should == "hello\nworld"
end

it "uses 'main' as self" do
@@ -26,13 +26,13 @@
end

it "mimics an awk conditional by comparing an inclusive-end range with $." do
ruby_exe(nil, :args => (@script % "2..3")).should == "2\n3\n"
ruby_exe(nil, :args => (@script % "2..2")).should == "2\n"
ruby_exe(nil, args: (@script % "2..3")).should == "2\n3\n"
ruby_exe(nil, args: (@script % "2..2")).should == "2\n"
end

it "mimics a sed conditional by comparing an exclusive-end range with $." do
ruby_exe(nil, :args => (@script % "2...3")).should == "2\n3\n"
ruby_exe(nil, :args => (@script % "2...2")).should == "2\n3\n4\n5\n"
ruby_exe(nil, args: (@script % "2...3")).should == "2\n3\n"
ruby_exe(nil, args: (@script % "2...2")).should == "2\n3\n4\n5\n"
end
end
end
16 changes: 8 additions & 8 deletions spec/ruby/command_line/dash_n_spec.rb
Original file line number Diff line number Diff line change
@@ -4,20 +4,20 @@
end

it "runs the code in loop conditional on Kernel.gets()" do
ruby_exe("puts $_", :options => "-n", :escape => true,
:args => " < #{@names}").should ==
ruby_exe("puts $_", options: "-n", escape: true,
args: " < #{@names}").should ==
"alice\nbob\njames\n"
end

it "only evaluates BEGIN blocks once" do
ruby_exe("BEGIN { puts \"hi\" }; puts $_", :options => "-n", :escape => true,
:args => " < #{@names}").should ==
ruby_exe("BEGIN { puts \"hi\" }; puts $_", options: "-n", escape: true,
args: " < #{@names}").should ==
"hi\nalice\nbob\njames\n"
end

it "only evaluates END blocks once" do
ruby_exe("puts $_; END {puts \"bye\"}", :options => "-n", :escape => true,
:args => " < #{@names}").should ==
ruby_exe("puts $_; END {puts \"bye\"}", options: "-n", escape: true,
args: " < #{@names}").should ==
"alice\nbob\njames\nbye\n"
end

@@ -27,8 +27,8 @@
$total += 1
END { puts $total }
script
ruby_exe(script, :options => "-n", :escape => true,
:args => " < #{@names}").should ==
ruby_exe(script, options: "-n", escape: true,
args: " < #{@names}").should ==
"3\n"
end
end
8 changes: 4 additions & 4 deletions spec/ruby/command_line/dash_p_spec.rb
Original file line number Diff line number Diff line change
@@ -4,14 +4,14 @@
end

it "runs the code in loop conditional on Kernel.gets() and prints $_" do
ruby_exe("$_ = $_.upcase", :options => "-p", :escape => true,
:args => " < #{@names}").should ==
ruby_exe("$_ = $_.upcase", options: "-p", escape: true,
args: " < #{@names}").should ==
"ALICE\nBOB\nJAMES\n"
end

it "sets $-p" do
ruby_exe("$_ = $-p", :options => "-p", :escape => true,
:args => " < #{@names}").should ==
ruby_exe("$_ = $-p", options: "-p", escape: true,
args: " < #{@names}").should ==
"truetruetrue"
end
end
2 changes: 1 addition & 1 deletion spec/ruby/command_line/dash_r_spec.rb
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
end

it "requires the specified file" do
result = ruby_exe(@script, :options => "-r #{@test_file}")
result = ruby_exe(@script, options: "-r #{@test_file}")
result.should include(@test_file + ".rb")
end
end
Loading

0 comments on commit bb76e66

Please sign in to comment.