Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d273188355c1
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2359c8c5f342
Choose a head ref

Commits on Sep 29, 2015

  1. put all the temporary jar created by the JRubyClassLoader into on dir…

    …ectory
    
    these temporary jars get cleaned up after the jvm exits BUT on hard kill
    the jars do not get cleaned. creating a directory 'jruby-${PID}' might help
    to clean up easier.
    
    Sponsored by Lookout Inc.
    mkristian committed Sep 29, 2015
    Copy the full SHA
    28f6507 View commit details
  2. Copy the full SHA
    89ee83c View commit details
  3. Copy the full SHA
    e139d9c View commit details
  4. Squashed 'spec/mspec/' changes from 77b49c2..c60587f

    c60587f Remove some uninitialized ivar warnings
    3e76cd0 Add spec for SpecTag#unescape
    e13dde3 Simplify espacing in SpecTag
    57652ef Fix SpecTag#unescape
    1e1b4af Support escape: true only in ruby_exe, by executing from a temporary file
    cc5fd36 Merge pull request #10 from nobu/bug/9-portable-backtick
    d0406c9 Do not use $() for portability
    
    git-subtree-dir: spec/mspec
    git-subtree-split: c60587f02dc806de53521a38cb029959126c7dea
    eregon committed Sep 29, 2015
    Copy the full SHA
    2c48369 View commit details
  5. Copy the full SHA
    a6f282c View commit details
  6. Squashed 'spec/ruby/' changes from f06add1..fa9e1cd

    fa9e1cd Add some other cases for #super_method specs
    3481f99 Add Enumerable#{min,max,min_by,max_by} specs with nil
    00f2439 added spec for lambda with optional parameter
    a9de138 Add version guard
    f424cb0 Add block and lambda specs for MRI bug #9593
    9d36115 Add spec for MRI bug #9593
    14f3122 Update hash spec to include quoted symbol key syntax
    8cb48a7 Spec for Method and UnboundMethod #super_method (Ruby 2.2+)
    d6e3175 Fix Float#prev_float and Float#next_float specs
    be46b2c More edge case specs for Float#next_float and #prev_float near zero
    d7434d3 Specs for Float#next_float and #prev_float use eql? instead of ==
    8fa732b Specs for Float#next_float and #prev_float on NAN
    41a949b Specs for Float#next_float and #prev_float
    4296712 Kernel#throw now raises an UncaughtThrowError when there is no matching catch block.
    1b79214 Add version guard
    3529807 birthtime can also be implemented on Windows
    cd31973 Only darwin supports birthtime
    e6cbae8 adapt specs for specifics platform checks
    6cca077 Add File.birthtime and File#birthtime specs
    ca27d37 Add a single space between after and :each
    8944d0c Add version guard
    8e3cfa6 File#birthtime is not be implemented on some platforms
    af195cb Add File::Stat#birthtime specs
    654c1ee Add version guard
    933b95f Add specs for Enumerable#slice_when
    8011bb5 Argument error -> ArgumentError
    1a9abba Add version guard
    9d9aa3e Add specs for Enumerable#max_by optional arg
    fa4e34a Add version guard
    18d00f6 Add specs for Binding#receiver
    c1a1972 Add version guard
    5f44013 Add spec for Enumerable#max optional arg
    534d780 Fix typo in Enumerable#max's spec. s/minimum/maximum
    78345ae We are already in the Enumerable#max block, there's no need to repeat it.
    559210b Remove unused @A instance variable
    c9b9cd0 Use context for readability
    56639ab Add version guard
    53c2397 Add specs for Enumberable#min_by optional args
    553610a Fix typo in Enumerable#min_by's descriptions: Minimum, not maximum
    549d3b7 Specify some edge cases for Enumerable#min optional arg
    e8a21bb Remove unused instance variable @A
    1469d34 Add version guard
    f8a2be8 Add specs for Enumerable#min with optional arg.
    bf8cd32 Add version guard and fix style
    976c355 Add spec for Enumerable#slice_after
    b92dde0 Add an example to Binding#local_variables
    45f2788 Add version guard
    41b3c09 Add specs for Binding#local_variables
    9b8336e Fix Method#curry spec and add version guard
    60ba4e9 Add Method#curry specs
    9f0f050 Fix an example in ObjectSpace#each_object to run in 2.0.0
    b68632e Specify Binding#local_variable_get
    0291545 Enumerable#find_index should use #== semantics for testing equality
    6e9cc19 Simplify the #=== private spec
    78ed9fc Super uses given block even if arguments are passed explicitly
    3f8b74b Case can call private #=== method
    d0d4f14 Synchronize Fixnum#<< and #>>
    fb52f65 Add a few examples to Fixnum#<<
    9a888d0 Add more examples for Fixnum#>>
    a1aabf0 Fixes to ObjectSpaces specs.
    cf62939 Fix spec name.
    b09b120 More places objects could hide from ObjectSpace - thread and fiber locals and at_exit handlers.
    b91a806 ObjectSpace can reach both implicitly and explicitly captured locals
    9c7123a Add specs for where ObjectSpace.each_object can find objects.
    254ccdf Improve Thread#raise spec to be more precise about the backtrace
    9955865 Remove trailing spaces
    4ab3965 Merge pull request #136 from wied03/master
    477068f Account for cases where the LHS is a nil local variable - opal/opal#1090 (comment)
    5cab2a8 Improve specdocs of class specs
    c9eb2f1 Remove trailing spaces
    db3c823 Merge pull request #135 from wied03/master
    ff28bca Test creating classes within Class.new blocks
    cd78752 Merge pull request #133 from ngoto/use-CCDLFLAGS
    23c373d CCDLFLAGS should be used to build Position Independent Code
    b027be8 Use the output matcher in PP.pp to avoid touching $stdout directly
    a01fdc4 Fix formatting and trailing spaces
    9a73ed9 Merge pull request #130 from wied03/master
    f02ff7d Remove stringio dependency and use IOStub
    ae1aa04 Try to simplify the File#flock blocking spec
    159de46 Get started with PP stdlib specs, especially the PP::pp method
    0e097ec Merge pull request #131 from nobu/ftp#system-fix
    de0d559 newlines do not matter
    46c3fb2 Inline shared describe for Kernel#lambda with single usage.
    80729a3 Merge pull request #129 from iliabylich/stop-generating-dynamic-test-names
    8343600 Stop generating dynamic test names for lambda.
    0dbf847 Merge pull request #128 from ngoto/atan2-revert-ac7ca51
    4abb3c6 Merge pull request #126 from ngoto/File-stat-NFS
    0995c96 Remove needless "platform_is :solaris" guards.
    ec6ce28 Use 1 second ago from now to avoid failure due to NFS cache behavior.
    1f65cb6 Merge pull request #124 from ngoto/flock-Solaris
    5190db6 Merge pull request #123 from ngoto/DATA-flock-Solaris
    aeeb3dd DATA (read-only opened) can not be locked by File#flock on Solaris
    73857c7 Rewrite some File#flock specs using ruby_exe for supporting Solaris
    a0570cc Rewrite -s flag specs to explicitly pass inline code
    25cda76 Use a fixture for the autoload with frozen Object spec
    6e93ec5 Merge pull request #117 from rashmirathi1729/master
    2a4a08c Add Matrix#to_a specs
    96b4183 Merge pull request #119 from tobiashm/master
    0bc0537 String#start_with? and #end_with? for empty string
    f7cf2bd Module#singleton_class? is 2.1+ only
    7afc6fb toplevel visibility is already specified in language/
    08088b9 There is no Kernel#type.
    c695c91 Move method_missing fixture
    48eff07 Move method_missing specs to the right place
    4ddc433 Relax spec of send arity
    511568b Organize send specs
    821845d Unshare Continuation specs
    329d7cc Continuations are only available as a library in 2.0+
    5cebf8e Fix specdocs for Float constants
    20cad95 Move Module#singleton_class? to the right file
    
    git-subtree-dir: spec/ruby
    git-subtree-split: fa9e1cdc2815fa006b89cf83344ba6041d0d566c
    eregon committed Sep 29, 2015
    Copy the full SHA
    ca0e14f View commit details
  7. Merge RubySpec commit 'ca0e14f96fee9cf3438e6513893a0770142798e6'

    * Conflicts:
    *	spec/ruby/core/objectspace/each_object_spec.rb
    eregon committed Sep 29, 2015
    Copy the full SHA
    b0488b8 View commit details
  8. [Truffle] Add new specs tags.

    eregon committed Sep 29, 2015
    Copy the full SHA
    fbb55c5 View commit details
  9. Copy the full SHA
    33d0851 View commit details
  10. Add new specs tags

    eregon committed Sep 29, 2015
    Copy the full SHA
    b3a6d4f View commit details
  11. 4
    Copy the full SHA
    c06ac7c View commit details
  12. Copy the full SHA
    22ee01d View commit details
  13. Remove inappropriate spec

    eregon committed Sep 29, 2015
    Copy the full SHA
    87d7b75 View commit details
  14. Copy the full SHA
    595d87a View commit details
  15. Copy the full SHA
    f149501 View commit details
  16. [Truffle] New spec tag.

    eregon committed Sep 29, 2015
    Copy the full SHA
    0358bcc View commit details
  17. Copy the full SHA
    c6ce091 View commit details
  18. Copy the full SHA
    5e0eece View commit details
  19. [Truffle] Fix wrong lowering indices in StringPrimitiveNodes.

    * Other lowerFixnumParameters seem good for @RubiniusPrimitive.
    eregon committed Sep 29, 2015
    Copy the full SHA
    82dc923 View commit details
  20. Copy the full SHA
    5f1f2e2 View commit details
  21. Copy the full SHA
    5c1a9c0 View commit details
  22. [Truffle] Findbugs.

    chrisseaton committed Sep 29, 2015
    Copy the full SHA
    c5a4e7f View commit details
  23. Copy the full SHA
    2359c8c View commit details
Showing with 1,371 additions and 608 deletions.
  1. +10 −3 core/src/main/java/org/jruby/exceptions/RaiseException.java
  2. +1 −1 core/src/main/java/org/jruby/ir/IRBuilder.java
  3. +19 −1 core/src/main/java/org/jruby/util/JRubyClassLoader.java
  4. +0 −4 spec/jruby.2.2.mspec
  5. +14 −11 spec/mspec/lib/mspec/helpers/ruby_exe.rb
  6. +1 −1 spec/mspec/lib/mspec/runner/actions/filter.rb
  7. +2 −0 spec/mspec/lib/mspec/runner/mspec.rb
  8. +10 −4 spec/mspec/lib/mspec/runner/tag.rb
  9. +1 −0 spec/mspec/spec/helpers/io_spec.rb
  10. +5 −0 spec/mspec/spec/runner/exception_spec.rb
  11. +2 −2 spec/mspec/spec/runner/formatters/method_spec.rb
  12. +0 −1 spec/mspec/spec/runner/mspec_spec.rb
  13. +12 −0 spec/mspec/spec/runner/tag_spec.rb
  14. +8 −12 spec/ruby/command_line/dash_s_spec.rb
  15. +7 −7 spec/ruby/core/array/any_spec.rb
  16. +3 −0 spec/ruby/core/basicobject/__send___spec.rb
  17. +25 −1 spec/ruby/core/basicobject/method_missing_spec.rb
  18. +37 −0 spec/ruby/core/binding/local_variables_spec.rb
  19. +13 −0 spec/ruby/core/binding/receiver_spec.rb
  20. +0 −8 spec/ruby/core/continuation/call_spec.rb
  21. +0 −8 spec/ruby/core/continuation/element_reference_spec.rb
  22. +0 −8 spec/ruby/core/continuation/new_spec.rb
  23. +1 −1 spec/ruby/core/enumerable/each_cons_spec.rb
  24. +1 −1 spec/ruby/core/enumerable/each_entry_spec.rb
  25. +1 −1 spec/ruby/core/enumerable/each_slice_spec.rb
  26. +5 −5 spec/ruby/core/enumerable/grep_v_spec.rb
  27. +40 −0 spec/ruby/core/enumerable/max_by_spec.rb
  28. +50 −15 spec/ruby/core/enumerable/max_spec.rb
  29. +42 −3 spec/ruby/core/enumerable/min_by_spec.rb
  30. +36 −2 spec/ruby/core/enumerable/min_spec.rb
  31. +55 −0 spec/ruby/core/enumerable/slice_after_spec.rb
  32. +1 −1 spec/ruby/core/enumerable/slice_before_spec.rb
  33. +38 −0 spec/ruby/core/enumerable/slice_when_spec.rb
  34. +1 −1 spec/ruby/core/exception/receiver_spec.rb
  35. +60 −0 spec/ruby/core/file/birthtime_spec.rb
  36. +1 −1 spec/ruby/core/file/ctime_spec.rb
  37. +21 −17 spec/ruby/core/file/flock_spec.rb
  38. +29 −0 spec/ruby/core/file/stat/birthtime_spec.rb
  39. +1 −1 spec/ruby/core/file/stat/comparison_spec.rb
  40. +14 −14 spec/ruby/core/float/constants_spec.rb
  41. +46 −0 spec/ruby/core/float/next_float_spec.rb
  42. +46 −0 spec/ruby/core/float/prev_float_spec.rb
  43. +0 −7 spec/ruby/core/kernel/__send___spec.rb
  44. +1 −15 spec/ruby/core/kernel/autoload_spec.rb
  45. +0 −15 spec/ruby/core/kernel/callcc_spec.rb
  46. +7 −0 spec/ruby/core/kernel/fixtures/autoload_frozen.rb
  47. +13 −1 spec/ruby/core/kernel/lambda_spec.rb
  48. +0 −25 spec/ruby/core/kernel/method_missing_spec.rb
  49. +2 −2 spec/ruby/core/kernel/public_send_spec.rb
  50. +2 −2 spec/ruby/core/kernel/send_spec.rb
  51. +0 −17 spec/ruby/core/kernel/shared/lambda.rb
  52. +0 −116 spec/ruby/core/kernel/shared/send.rb
  53. +0 −28 spec/ruby/core/kernel/singleton_class_spec.rb
  54. +6 −0 spec/ruby/core/kernel/throw_spec.rb
  55. +0 −6 spec/ruby/core/kernel/type_spec.rb
  56. +0 −27 spec/ruby/core/main/def_spec.rb
  57. +6 −30 spec/ruby/core/math/atan2_spec.rb
  58. +38 −0 spec/ruby/core/method/curry_spec.rb
  59. +12 −0 spec/ruby/core/method/fixtures/classes.rb
  60. +41 −0 spec/ruby/core/method/super_method_spec.rb
  61. +6 −6 spec/ruby/core/module/deprecate_constant_spec.rb
  62. +29 −0 spec/ruby/core/module/singleton_class_spec.rb
  63. +2 −2 spec/ruby/core/numeric/negative_spec.rb
  64. +2 −2 spec/ruby/core/numeric/positive_spec.rb
  65. +1 −1 spec/ruby/core/objectspace/each_object_spec.rb
  66. +1 −0 spec/ruby/core/proc/curry_spec.rb
  67. +3 −3 spec/ruby/core/string/end_with_spec.rb
  68. +1 −0 spec/ruby/core/string/start_with_spec.rb
  69. +3 −0 spec/ruby/core/unboundmethod/fixtures/classes.rb
  70. +28 −0 spec/ruby/core/unboundmethod/super_method_spec.rb
  71. 0 spec/ruby/fixtures/{kernel/classes.rb → basicobject/method_missing.rb}
  72. +12 −0 spec/ruby/fixtures/class.rb
  73. +14 −0 spec/ruby/language/and_spec.rb
  74. +19 −0 spec/ruby/language/block_spec.rb
  75. +54 −0 spec/ruby/language/class_spec.rb
  76. +12 −1 spec/ruby/language/def_spec.rb
  77. +8 −1 spec/ruby/language/hash_spec.rb
  78. +19 −0 spec/ruby/language/lambda_spec.rb
  79. +1 −1 spec/ruby/language/predefined/data_spec.rb
  80. +0 −4 spec/ruby/library/bigdecimal/new_spec.rb
  81. +1 −1 spec/ruby/library/continuation/call_spec.rb
  82. +1 −1 spec/ruby/library/continuation/element_reference_spec.rb
  83. 0 spec/ruby/{fixtures/kernel → library/continuation/fixtures}/callcc.rb
  84. +67 −3 spec/ruby/library/continuation/kernel/callcc_spec.rb
  85. +3 −2 spec/ruby/library/continuation/new_spec.rb
  86. 0 spec/ruby/{shared/continuation → library/continuation/shared}/call.rb
  87. +6 −1 spec/ruby/library/matrix/to_a_spec.rb
  88. +2 −2 spec/ruby/library/net/ftp/system_spec.rb
  89. +25 −0 spec/ruby/library/pp/pp_spec.rb
  90. +1 −1 spec/ruby/optional/capi/spec_helper.rb
  91. +6 −6 spec/ruby/shared/{kernel → basicobject}/method_missing.rb
  92. +110 −0 spec/ruby/shared/basicobject/send.rb
  93. +0 −5 spec/ruby/shared/continuation/new.rb
  94. +0 −68 spec/ruby/shared/kernel/callcc.rb
  95. +1 −0 spec/tags/ruby/core/enumerable/each_cons_tags.txt
  96. +1 −0 spec/tags/ruby/core/enumerable/each_slice_tags.txt
  97. +2 −0 spec/tags/ruby/core/enumerable/max_by_tags.txt
  98. +1 −0 spec/tags/ruby/core/enumerable/max_tags.txt
  99. +2 −0 spec/tags/ruby/core/enumerable/min_by_tags.txt
  100. +1 −0 spec/tags/ruby/core/enumerable/min_tags.txt
  101. +4 −0 spec/tags/ruby/core/enumerable/slice_when_tags.txt
  102. +2 −0 spec/tags/ruby/core/file/birthtime_tags.txt
  103. +1 −0 spec/tags/ruby/core/file/stat/birthtime_tags.txt
  104. +1 −0 spec/tags/ruby/core/kernel/eval_tags.txt
  105. +1 −0 spec/tags/ruby/core/kernel/throw_tags.txt
  106. +1 −0 spec/tags/ruby/core/method/curry_tags.txt
  107. +17 −0 spec/tags/ruby/core/objectspace/each_object_tags.txt
  108. +2 −0 spec/tags/ruby/language/block_tags.txt
  109. +1 −0 spec/tags/ruby/language/def_tags.txt
  110. +2 −0 spec/tags/ruby/language/lambda_tags.txt
  111. +6 −0 spec/truffle/tags/core/basicobject/method_missing_tags.txt
  112. +1 −0 spec/truffle/tags/core/binding/local_variables_tags.txt
  113. +1 −0 spec/truffle/tags/core/binding/receiver_tags.txt
  114. +4 −0 spec/truffle/tags/core/enumerable/max_by_tags.txt
  115. +4 −0 spec/truffle/tags/core/enumerable/max_tags.txt
  116. +4 −0 spec/truffle/tags/core/enumerable/min_by_tags.txt
  117. +4 −0 spec/truffle/tags/core/enumerable/min_tags.txt
  118. +6 −0 spec/truffle/tags/core/enumerable/slice_after_tags.txt
  119. +4 −0 spec/truffle/tags/core/enumerable/slice_when_tags.txt
  120. +2 −0 spec/truffle/tags/core/file/birthtime_tags.txt
  121. +1 −0 spec/truffle/tags/core/file/flock_tags.txt
  122. +1 −0 spec/truffle/tags/core/file/stat/birthtime_tags.txt
  123. +7 −0 spec/truffle/tags/core/float/next_float_tags.txt
  124. +7 −0 spec/truffle/tags/core/float/prev_float_tags.txt
  125. +1 −0 spec/truffle/tags/core/kernel/throw_tags.txt
  126. +4 −0 spec/truffle/tags/core/method/curry_tags.txt
  127. +3 −0 spec/truffle/tags/core/method/super_method_tags.txt
  128. +1 −0 spec/truffle/tags/core/proc/curry_tags.txt
  129. +3 −0 spec/truffle/tags/core/unboundmethod/super_method_tags.txt
  130. +1 −0 spec/truffle/tags/language/block_tags.txt
  131. +1 −0 spec/truffle/tags/language/def_tags.txt
  132. +1 −0 spec/truffle/tags/language/lambda_tags.txt
  133. +1 −31 spec/truffle/truffle.mspec
  134. +1 −1 test/mri_truffle.index
  135. +6 −1 truffle/src/main/java/org/jruby/truffle/nodes/cast/SplatCastNode.java
  136. +14 −7 truffle/src/main/java/org/jruby/truffle/nodes/core/BindingNodes.java
  137. +1 −13 truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  138. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  139. +9 −10 truffle/src/main/java/org/jruby/truffle/nodes/ext/psych/PsychParserNodes.java
  140. +7 −7 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/StringPrimitiveNodes.java
13 changes: 10 additions & 3 deletions core/src/main/java/org/jruby/exceptions/RaiseException.java
Original file line number Diff line number Diff line change
@@ -203,11 +203,19 @@ private void preRaise(ThreadContext context, StackTraceElement[] javaTrace) {

if (RubyInstanceConfig.LOG_EXCEPTIONS) TraceType.dumpException(exception);

if (context.exceptionRequiresBacktrace) {
if (requiresBacktrace(context)) {
exception.prepareIntegratedBacktrace(context, javaTrace);
}
}

private boolean requiresBacktrace(ThreadContext context) {
IRubyObject debugMode = context.runtime.getGlobalVariables().get("$DEBUG");
// We can only omit backtraces of descendents of Standard error for 'foo rescue nil'
return context.exceptionRequiresBacktrace ||
(debugMode != null && debugMode.isTrue()) ||
!exception.kind_of_p(context, context.runtime.getStandardError()).isTrue();
}

private void preRaise(ThreadContext context, IRubyObject backtrace) {
context.runtime.incrementExceptionCount();
doSetLastError(context);
@@ -216,8 +224,7 @@ private void preRaise(ThreadContext context, IRubyObject backtrace) {
if (RubyInstanceConfig.LOG_EXCEPTIONS) TraceType.dumpException(exception);

// We can only omit backtraces of descendents of Standard error for 'foo rescue nil'
if (!exception.kind_of_p(context, context.runtime.getStandardError()).isTrue() ||
context.exceptionRequiresBacktrace) {
if (requiresBacktrace(context)) {
if (backtrace == null) {
exception.prepareBacktrace(context, nativeException);
} else {
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/IRBuilder.java
Original file line number Diff line number Diff line change
@@ -3036,7 +3036,7 @@ public Operand buildRescue(RescueNode node) {

private boolean canBacktraceBeRemoved(RescueNode rescueNode) {
// For now we will only contemplate 'foo rescue nil' cases but simple non-mod rescue forms can be added later.
if (!(rescueNode instanceof RescueModNode)) return false;
if (RubyInstanceConfig.FULL_TRACE_ENABLED || !(rescueNode instanceof RescueModNode)) return false;

// FIXME: This MIGHT be able to expand to more complicated expressions like Hash or Array if they
// contain only SideEffectFree nodes. Constructing a literal out of these should be safe from
20 changes: 19 additions & 1 deletion core/src/main/java/org/jruby/util/JRubyClassLoader.java
Original file line number Diff line number Diff line change
@@ -35,8 +35,10 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.management.ManagementFactory;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;

import org.jruby.util.log.Logger;
import org.jruby.util.log.LoggerFactory;
@@ -60,10 +62,26 @@ public class JRubyClassLoader extends ClassDefiningJRubyClassLoader {

private Runnable unloader;

private File tempdir;

public JRubyClassLoader(ClassLoader parent) {
super(parent);
}

private File getTempDir() {
if (tempdir == null) {
String processName = ManagementFactory.getRuntimeMXBean().getName();
long pid = Long.parseLong(processName.split("@")[0]);
File dir = new File(System.getProperty("java.io.tmpdir"), "jruby-" + pid);
if (dir.mkdirs()) {
dir.deleteOnExit();
}
;
tempdir = dir;
}
return tempdir;
}

// Change visibility so others can see it
@Override
public void addURL(URL url) {
@@ -74,7 +92,7 @@ public void addURL(URL url) {
OutputStream out = null;
try
{
File f = File.createTempFile( "jruby", new File(url.getFile()).getName());
File f = File.createTempFile("jruby", new File(url.getFile()).getName(), getTempDir());
f.deleteOnExit();
out = new BufferedOutputStream( new FileOutputStream( f ) );
in = new BufferedInputStream( url.openStream() );
4 changes: 0 additions & 4 deletions spec/jruby.2.2.mspec
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@ class MSpecScript
# Core library specs
set :core, [
SPEC_DIR + '/core',
'^' + SPEC_DIR + '/core/continuation'
]

set :fast, [
@@ -106,9 +105,6 @@ class MSpecScript
# This set of files is run by mspec ci
set :ci_files, get(:language) + get(:core) + get(:command_line) + get(:library)

# Optional library specs
set :ffi, SPEC_DIR + '/optional/ffi'

# A list of _all_ optional library specs
set :optional, [get(:ffi)]

25 changes: 14 additions & 11 deletions spec/mspec/lib/mspec/helpers/ruby_exe.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'mspec/utils/ruby_name'
require 'mspec/guards/platform'
require 'mspec/helpers/tmp'

# The ruby_exe helper provides a wrapper for invoking the
# same Ruby interpreter as the one running the specs and
@@ -124,6 +125,13 @@ def ruby_exe(code, opts = {})
ENV[key] = value
end

escape = opts.delete(:escape)
if escape
tmpfile = tmp("rubyexe.rb")
File.open(tmpfile, "w") { |f| f.write(code) }
code = tmpfile
end

begin
platform_is_not :opal do
`#{ruby_cmd(code, opts)}`
@@ -134,25 +142,20 @@ def ruby_exe(code, opts = {})
key = key.to_s
ENV.delete key unless saved_env.key? key
end
File.delete tmpfile if escape
end
end
end

def ruby_cmd(code, opts = {})
body = code

if code and not File.exist?(code)
if opts[:escape]
heredoc_separator = "END_OF_RUBYCODE"
lines = code.lines
until lines.none? {|line| line.start_with? heredoc_separator }
heredoc_separator << heredoc_separator
end
if opts[:escape]
raise "escape: true is no longer supported in ruby_cmd, use ruby_exe or a fixture"
end

body = %Q!-e "$(cat <<'#{heredoc_separator}'\n#{code}\n#{heredoc_separator}\n)"!
else
body = "-e #{code.inspect}"
end
if code and not File.exist?(code)
body = "-e #{code.inspect}"
end

[RUBY_EXE, ENV['RUBY_FLAGS'], opts[:options], body, opts[:args]].compact.join(' ')
2 changes: 1 addition & 1 deletion spec/mspec/lib/mspec/runner/actions/filter.rb
Original file line number Diff line number Diff line change
@@ -14,14 +14,14 @@ def initialize(tags=nil, descs=nil)
@tags = Array(tags)
descs = Array(descs)
@sfilter = MatchFilter.new(nil, *descs) unless descs.empty?
@tfilter = nil
end

def ===(string)
@sfilter === string or @tfilter === string
end

def load
@tfilter = nil
return if @tags.empty?

desc = MSpec.read_tags(@tags).map { |t| t.description }
2 changes: 2 additions & 0 deletions spec/mspec/lib/mspec/runner/mspec.rb
Original file line number Diff line number Diff line change
@@ -16,7 +16,9 @@ module MSpec
@leave = nil
@load = nil
@unload = nil
@tagged = nil
@current = nil
@example = nil
@modes = []
@shared = {}
@guarded = []
14 changes: 10 additions & 4 deletions spec/mspec/lib/mspec/runner/tag.rb
Original file line number Diff line number Diff line change
@@ -13,13 +13,19 @@ def parse(string)

def unescape(str)
return unless str
str = str[1..-2] if str[0] == ?" and str[-1] == ?"
str.gsub(/\\n/, "\n")
if str[0] == ?" and str[-1] == ?"
str[1..-2].gsub('\n', "\n")
else
str
end
end

def escape(str)
str = %["#{str.gsub(/\n/, '\n')}"] if /\n/ =~ str
str
if str.include? "\n"
%["#{str.gsub("\n", '\n')}"]
else
str
end
end

def to_s
1 change: 1 addition & 0 deletions spec/mspec/spec/helpers/io_spec.rb
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@
describe Object, "#new_fd" do
before :each do
@name = tmp("io_specs")
@io = nil
end

after :each do
5 changes: 5 additions & 0 deletions spec/mspec/spec/runner/exception_spec.rb
Original file line number Diff line number Diff line change
@@ -87,6 +87,10 @@
end

describe ExceptionState, "#message" do
before :each do
@state = ExampleState.new ContextState.new("C#m"), "works"
end

it "returns <No message> if the exception message is empty" do
exc = ExceptionState.new @state, "", Exception.new("")
exc.message.should == "<No message>"
@@ -111,6 +115,7 @@

describe ExceptionState, "#backtrace" do
before :each do
@state = ExampleState.new ContextState.new("C#m"), "works"
begin
raise Exception
rescue Exception => @exception
4 changes: 2 additions & 2 deletions spec/mspec/spec/runner/formatters/method_spec.rb
Original file line number Diff line number Diff line change
@@ -120,8 +120,8 @@
@formatter.before state

exc = SpecExpectationNotMetError.new "failed"
@formatter.exception ExceptionState.new(@state, nil, exc)
@formatter.exception ExceptionState.new(@state, nil, exc)
@formatter.exception ExceptionState.new(state, nil, exc)
@formatter.exception ExceptionState.new(state, nil, exc)

@formatter.after state
h = @formatter.methods["Some#method"]
1 change: 0 additions & 1 deletion spec/mspec/spec/runner/mspec_spec.rb
Original file line number Diff line number Diff line change
@@ -95,7 +95,6 @@
before :each do
MSpec.clear_current
@cs = ContextState.new "C#m"
@cs.stub(:state).and_return(@es)
@cs.parent = MSpec.current

@es = ExampleState.new @cs, "runs"
12 changes: 12 additions & 0 deletions spec/mspec/spec/runner/tag_spec.rb
Original file line number Diff line number Diff line change
@@ -109,3 +109,15 @@
[one].==([two]).should == true
end
end

describe SpecTag, "#unescape" do
it "replaces \\n by LF when the description is quoted" do
tag = SpecTag.new 'tag:"desc with\nnew line"'
tag.description.should == "desc with\nnew line"
end

it "does not replaces \\n by LF when the description is not quoted " do
tag = SpecTag.new 'tag:desc with\nnew line'
tag.description.should == "desc with\\nnew line"
end
end
20 changes: 8 additions & 12 deletions spec/ruby/command_line/dash_s_spec.rb
Original file line number Diff line number Diff line change
@@ -3,27 +3,23 @@
describe "The -s command line option" do
describe "when using -- to stop parsing" do
it "sets the value to true without an explicit value" do
ruby_exe("p $n", escape: true,
options: "-s",
args: "-- -n").chomp.should == "true"
ruby_exe(nil, options: "-s -e 'p $n'",
args: "-- -n").chomp.should == "true"
end

it "parses single letter args into globals" do
ruby_exe("puts $n", escape: true,
options: "-s",
args: "-- -n=blah").chomp.should == "blah"
ruby_exe(nil, options: "-s -e 'puts $n'",
args: "-- -n=blah").chomp.should == "blah"
end

it "parses long args into globals" do
ruby_exe("puts $_name", escape: true,
options: "-s",
args: "-- --name=blah").chomp.should == "blah"
ruby_exe(nil, options: "-s -e 'puts $_name'",
args: "-- --name=blah").chomp.should == "blah"
end

it "converts extra dashes into underscores" do
ruby_exe("puts $___name__test__", escape: true,
options: "-s",
args: "-- ----name--test--=blah").chomp.should == "blah"
ruby_exe(nil, options: "-s -e 'puts $___name__test__'",
args: "-- ----name--test--=blah").chomp.should == "blah"
end
end

14 changes: 7 additions & 7 deletions spec/ruby/core/array/any_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require File.expand_path('../../../spec_helper', __FILE__)

describe "Array#any?" do
describe 'with no block given (a default block of { |x| x } is implicit)' do
it "is false if the array is empty" do
describe 'with no block given (a default block of { |x| x } is implicit)' do
it "is false if the array is empty" do
empty_array = []
empty_array.any?.should == false
end

it "is false if the array is not empty, but all the members of the array are falsy" do
it "is false if the array is not empty, but all the members of the array are falsy" do
falsy_array = [false, nil, false]
falsy_array.any?.should == false
end
@@ -18,18 +18,18 @@
end
end

describe 'with a block given' do
it 'is false if the array is empty' do
describe 'with a block given' do
it 'is false if the array is empty' do
empty_array = []
empty_array.any? {|v| 1 == 1 }.should == false
end

it 'is true if the block returns true for any member of the array' do
it 'is true if the block returns true for any member of the array' do
array_with_members = [false, false, true, false]
array_with_members.any? {|v| v == true }.should == true
end

it 'is false if the block returns false for all members of the array' do
it 'is false if the block returns false for all members of the array' do
array_with_members = [false, false, true, false]
array_with_members.any? {|v| v == 42 }.should == false
end
3 changes: 3 additions & 0 deletions spec/ruby/core/basicobject/__send___spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../shared/basicobject/send', __FILE__)

describe "BasicObject#__send__" do
it "is a public instance method" do
BasicObject.should have_public_instance_method(:__send__)
end

it_behaves_like(:basicobject_send, :__send__)
end
26 changes: 25 additions & 1 deletion spec/ruby/core/basicobject/method_missing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../../shared/kernel/method_missing', __FILE__)
require File.expand_path('../../../shared/basicobject/method_missing', __FILE__)

describe "BasicObject#method_missing" do
it "is a private method" do
@@ -13,3 +13,27 @@
describe "BasicObject#method_missing" do
it_behaves_like :method_missing_instance, nil, BasicObject
end

describe "BasicObject#method_missing" do
it_behaves_like :method_missing_defined_module, nil, KernelSpecs::ModuleMM
end

describe "BasicObject#method_missing" do
it_behaves_like :method_missing_module, nil, KernelSpecs::ModuleNoMM
end

describe "BasicObject#method_missing" do
it_behaves_like :method_missing_defined_class, nil, KernelSpecs::ClassMM
end

describe "BasicObject#method_missing" do
it_behaves_like :method_missing_class, nil, KernelSpecs::ClassNoMM
end

describe "BasicObject#method_missing" do
it_behaves_like :method_missing_defined_instance, nil, KernelSpecs::ClassMM
end

describe "BasicObject#method_missing" do
it_behaves_like :method_missing_instance, nil, KernelSpecs::ClassNoMM
end
Loading