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: 7bbbb0718e78
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b38ba18ad323
Choose a head ref
  • 2 commits
  • 191 files changed
  • 1 contributor

Commits on Mar 28, 2016

  1. Squashed 'spec/ruby/' changes from 8d632d3..f5d943e

    f5d943e A few cosmetic fixes in Thread#backtrace spec
    38cc7ef Basic tests of Thread#backtrace
    c062803 Test where class variables are defined and updated
    9f94d6c Add a spec for adding two invalid strings together that results in a valid one
    86ddccf Fixed Symbol.all_symbols spec.
    a98b62d Wait for a thread status change rather than a random amount of time in rb_thread_blocking_region
    3dba3bf Merge pull request #219 from donv/basic_coverage_specs
    2e7722e adapt realpath specs to run on Windows
    6f1fbd4 syslog is POSIX-only
    d9b2e19 adapt realdirpath specs to run on Windows
    e80ca16 Process.daemon is not implemented on Windows
    801850b Guard unicode path spec not working on Windows
    b6c738b Dir.home with an argument is not working on Windows
    aa55259 Update for changes in mspec's home_directory helper
    25e443c Removing problematic path in dir specs for Windows
    8f3e280 Show remaining files if delete_mock_dirs fails
    83a11ee Merge pull request #216 from ruby/vais/windows
    53b800f Skip all specs that rely on fork on Windows
    76811e1 Wrap a few remaining fork-using specs in with_feature :fork block
    937be98 Use explicit receiver for the helper method
    afbcef4 Change namespace odule to CoverageSpecs to avoid clashing with stdlib
    0ecdf4d Guarded specs for peek_result for Ruby 2.3 Used raise_error helper instead of customer begin...rescue
    da7b44b Added specs for peek_result Pulled helper method to separate SpecHelper module
    607e7ea Filter old results from result hash
    3f65bbd Added specs for multiple runs
    c3e050f Added a basic spec for counts
    490cc2d Merge pull request #217 from donv/try_add_coverage_spec
    dbaf24f Started adding spec for coverage
    0f2743d Merge pull request #218 from donv/test_mri_2.3
    86f19a1 Start testing MRI 2.3.x
    07ea93b Fix indent
    7e241f7 Fix typo
    1a2d168 Reasonable precision in Bignum#* spec
    342f9ae Merge pull request #215 from ruby/vais/windows
    854cd89 Run AppVeyor only on master and try* branches
    fe5acba Passing all WIN32OLE specs
    e36ff82 Merge pull request #214 from ruby/vais/windows
    4575e16 Skip the entire ARGF.read_nonblock spec on Windows
    f580a29 Merge pull request #212 from wied03/master
    323d258 Cover another alias/super case
    504eea0 Revert "Clean up the entire spec temp dir when finished with mock dirs."
    8d75627 AppVeyor: use an inclusion filter
    182a683 AppVeyor: fix last commit
    4f24a03 AppVeyor: exclude C-API specs for now
    40411ed AppVeyor: use the file formatter
    ea7d4ba Remove branch filter in appveyor.yml
    bfa4a13 Make sure the Signalizer is not run on Windows since it hangs
    3bbc6ae Try to run the LeakChecker under AppVeyor
    a9c496a Add setup for AppVeyor
    06e8a89 Merge pull request #210 from odaira/myContribution
    9c17cb6 Merge pull request #211 from ruby/vais/windows
    8b5c3eb Pass ENV specs on Windows
    2307c18 Remove extra File.join in DirSpecs.nonexistent
    eaaf635 Module#{include,prepend} are public since 2.1
    b144eac Remove 'ruby_version_is ""..."2.1" do' guards since 2.1 is now the lowest version
    32c5020 Remove 'ruby_version_is "2.1" do' guards since this is now the lowest version
    c0b7368 Modify a test that succeeds or fails depending on today's date in a year. Time#gmtoff values match only when both or neither of the Time objects are in summer time
    2458625 Drop support for 2.0.0 as it is no longer supported
    6d4e6f4 Merge pull request #208 from ruby/vais/argf
    52eff83 Pass ARGF.binmode on Windows
    e8c46eb Fix leak in Kernel#open
    5080525 Choose a more appropriate error class in C-API thread specs
    c55e620 Fix 2 thread leaks in C-API specs
    0c65308 Terminate the WEBrick timeout thread when supported
    6d0be63 Fix thread leak in Thread#name spec
    ddf7d41 Show leaked subprocess pid
    c7a99a6 Revert "Remove now useless Process.waitall"
    9676480 Fix subprocess leaks in ObjectSpace.define_finalizer specs
    3229895 Do not leak a Dir in Marshal#load specs
    4ff6dd5 Fix fd leak in Dir#fileno setup
    32c48c7 Remove now useless Process.waitall
    4d73980 Wait for subprocess to die in Process specs
    b513748 Close the pipe reading-side in the parent as well to avoid leaking a fd
    a277946 Unshare Process.times since there is only one usage
    c67efe7 Merge pull request #205 from unak/patch-4
    ff2c878 get rid of blocking on Windows
    5a1ea16 Merge pull request #204 from unak/patch-3
    7a2f6b0 Should not assume to exist outer commands.
    3b52dae Merge pull request #203 from unak/patch-2
    87898e6 Wrong assumption
    adbe6d5 Make STDIN non-EOF
    add86e1 Revert "Remove problematic specs"
    8b5cb71 Remove problematic specs
    265cc4c fixup! remove unguaranteed behavior
    d8aadfb remove unguaranteed behavior
    56d2e70 remove rb_class_inherited spec
    4056f12 Remove unreliable spec
    01bad6a Do not spec Unicode changing behavior
    2258d1d Add missing 2.1 version guards.
    3a80eb8 Add missing 2.3 version guards
    8825b5f Add a spec for autoloading a constant that was already loaded by another thread
    9be9a58 ObjectSpace._id2ref raises for invalid ID values
    9d7f072 Move String#@{+,-} specs to the right files
    a579440 Added String#-@ and String#+@
    974a254 Remove redundant specs
    6a44638 Added NameError#receiver spec
    e976989 Add specs for rb_time_timespec_new
    1b4d6a2 Add specs for rb_define_class_id_under
    d61a24c Add a spec for rb_define_class_under when given a mismatched superclass
    4e64448 add example which specs behavior of Proc#for_define_method when procs @ruby_method is set
    cba082b Added local variable methods to Binding
    3c5e63d Use the argf helper in ARGF.read_nonblock
    0938149 Added specs for ARGF.read_nonblock
    b960ebe Spec Enumerable#sort_by when #map does not return an array
    51b21d0 Use describe, rephrase spec description
    523f780 Fix count when enumerable yields multiple values
    62c1c8c Reword spec description
    309fda6 Add a spec covering Array#product returning self when given a block
    d9bbeb1 Add another failing specs for zsuper with keyword arguments
    89e8773 Fix Kernel#rand when given a Float exclusive range.
    08dd725 Added failing specs for zsuper with rest kwargs
    a828e0d Add failing specs for slice_* when iterator method is changed
    7bb5997 Add specs for IO#{read,write}_nonblock accepting exception option
    51fe64d Add specs for ARGF.readpartial
    f5b730c Add a spec covering clearing output buffer of ARGF.read
    214cf9e add failing spec for String.new with optional encoding argument
    48fd956 Move Hash comparison specs to the right files
    7ed5840 Avoid the new_hash helper
    9c43b34 Add specs for Hash comparison operators
    4f7eaa5 Fixed some 64bit assumptions in specs.
    1e84f38 Fix a typo in Enumerator::Lazy specs
    48060b6 Add specs for File.mkfifo
    1e971da Add specs for #dig with no arguments
    59b2043 Add specs for Enumerator::Lazy#grep_v
    38801cd Add specs for Hash#to_proc
    93c40ee Add a spec for setting thread's group in rb_thread_create
    668056f Add a spec covering rb_rescue returning the break value when the passed function yields to a block with a break
    34bf4b5 Added 2.3 specs for #positive? and #negative?
    3988aac multiple calls of close, close_read, and close_write should no longer raise IOError
    065e422 Add specs for #dig implmenetation for Hash, Array and Struct classes
    0be9395 puts: Make it more compatible to MRI
    e3c3858 spec 2.2 behavior where limit 0 raises ArgumentError
    d4f49e6 puts: Check if argument responds to :to_ary, instead of checking its type being Array
    cc7a472 Add spec for Enumerable#first with multiple yield parameters
    7ca9596 Automatically run Travis on try* branches
    ba0bd69 Merge pull request #202 from wied03/master
    f6ed69a NoMethodError should not require a name (because underlying NameError class does not)
    81977c9 sprintf: test infinite and nan float values
    37d0d3c Merge pull request #201 from nobu/no-new_ostruct_member
    c800735 Do not test method for internal use
    
    git-subtree-dir: spec/ruby
    git-subtree-split: f5d943e19e980264de972b6d1b49c927e527053b
    eregon committed Mar 28, 2016
    Copy the full SHA
    6240e31 View commit details
  2. Copy the full SHA
    b38ba18 View commit details
Showing with 3,571 additions and 2,523 deletions.
  1. +2 −1 spec/ruby/.travis.yml
  2. +15 −0 spec/ruby/appveyor.yml
  3. +2 −2 spec/ruby/core/argf/fixtures/bin_file.txt
  4. +68 −0 spec/ruby/core/argf/read_nonblock_spec.rb
  5. +3 −41 spec/ruby/core/argf/read_spec.rb
  6. +77 −0 spec/ruby/core/argf/readpartial_spec.rb
  7. +58 −0 spec/ruby/core/argf/shared/read.rb
  8. +18 −1 spec/ruby/core/array/dig_spec.rb
  9. +0 −8 spec/ruby/core/array/pack/p_spec.rb
  10. +6 −0 spec/ruby/core/array/product_spec.rb
  11. +26 −28 spec/ruby/core/array/to_h_spec.rb
  12. +12 −14 spec/ruby/core/bignum/bit_length_spec.rb
  13. +2 −2 spec/ruby/core/bignum/multiply_spec.rb
  14. +11 −13 spec/ruby/core/bignum/size_spec.rb
  15. +46 −0 spec/ruby/core/binding/local_variable_defined_spec.rb
  16. +34 −21 spec/ruby/core/binding/local_variable_get_spec.rb
  17. +54 −10 spec/ruby/core/binding/local_variable_set_spec.rb
  18. +3 −1 spec/ruby/core/dir/entries_spec.rb
  19. +4 −1 spec/ruby/core/dir/fileno_spec.rb
  20. +9 −4 spec/ruby/core/dir/fixtures/common.rb
  21. +4 −2 spec/ruby/core/dir/home_spec.rb
  22. +8 −6 spec/ruby/core/dir/pwd_spec.rb
  23. +4 −2 spec/ruby/core/dir/shared/glob.rb
  24. +1 −1 spec/ruby/core/dir/shared/pwd.rb
  25. +10 −3 spec/ruby/core/enumerable/count_spec.rb
  26. +5 −0 spec/ruby/core/enumerable/first_spec.rb
  27. +29 −0 spec/ruby/core/enumerable/fixtures/classes.rb
  28. +8 −0 spec/ruby/core/enumerable/slice_after_spec.rb
  29. +8 −0 spec/ruby/core/enumerable/slice_before_spec.rb
  30. +9 −0 spec/ruby/core/enumerable/slice_when_spec.rb
  31. +5 −0 spec/ruby/core/enumerable/sort_by_spec.rb
  32. +34 −36 spec/ruby/core/enumerable/to_h_spec.rb
  33. +5 −7 spec/ruby/core/enumerator/generator/initialize_spec.rb
  34. +5 −7 spec/ruby/core/enumerator/initialize_spec.rb
  35. +2 −2 spec/ruby/core/enumerator/lazy/drop_while_spec.rb
  36. +4 −0 spec/ruby/core/enumerator/lazy/fixtures/classes.rb
  37. +2 −2 spec/ruby/core/enumerator/lazy/grep_spec.rb
  38. +86 −0 spec/ruby/core/enumerator/lazy/grep_v_spec.rb
  39. +2 −2 spec/ruby/core/enumerator/lazy/initialize_spec.rb
  40. +2 −2 spec/ruby/core/enumerator/lazy/reject_spec.rb
  41. +2 −2 spec/ruby/core/enumerator/lazy/shared/collect_concat.rb
  42. +2 −2 spec/ruby/core/enumerator/lazy/shared/select.rb
  43. +1 −1 spec/ruby/core/enumerator/lazy/shared/to_enum.rb
  44. +2 −2 spec/ruby/core/enumerator/lazy/take_while_spec.rb
  45. +4 −6 spec/ruby/core/enumerator/size_spec.rb
  46. +7 −0 spec/ruby/core/env/element_reference_spec.rb
  47. +0 −7 spec/ruby/core/env/shared/value.rb
  48. +5 −7 spec/ruby/core/exception/errno_spec.rb
  49. +4 −0 spec/ruby/core/exception/no_method_error_spec.rb
  50. +7 −9 spec/ruby/core/exception/system_call_error_spec.rb
  51. +1 −3 spec/ruby/core/file/expand_path_spec.rb
  52. +53 −0 spec/ruby/core/file/mkfifo_spec.rb
  53. +76 −57 spec/ruby/core/file/realdirpath_spec.rb
  54. +58 −47 spec/ruby/core/file/realpath_spec.rb
  55. +20 −22 spec/ruby/core/fixnum/bit_length_spec.rb
  56. +12 −3 spec/ruby/core/hash/dig_spec.rb
  57. +12 −0 spec/ruby/core/hash/gt_spec.rb
  58. +12 −0 spec/ruby/core/hash/gte_spec.rb
  59. +12 −0 spec/ruby/core/hash/lt_spec.rb
  60. +12 −0 spec/ruby/core/hash/lte_spec.rb
  61. +15 −0 spec/ruby/core/hash/shared/comparison.rb
  62. +23 −0 spec/ruby/core/hash/shared/greater_than.rb
  63. +23 −0 spec/ruby/core/hash/shared/less_than.rb
  64. +4 −0 spec/ruby/core/hash/to_proc_spec.rb
  65. +4 −4 spec/ruby/core/io/close_read_spec.rb
  66. +8 −7 spec/ruby/core/io/close_spec.rb
  67. +4 −4 spec/ruby/core/io/close_write_spec.rb
  68. +11 −9 spec/ruby/core/io/foreach_spec.rb
  69. +29 −1 spec/ruby/core/io/puts_spec.rb
  70. +29 −3 spec/ruby/core/io/read_nonblock_spec.rb
  71. +13 −13 spec/ruby/core/io/read_spec.rb
  72. +11 −9 spec/ruby/core/io/readlines_spec.rb
  73. +9 −0 spec/ruby/core/io/shared/each.rb
  74. +29 −31 spec/ruby/core/io/shared/new.rb
  75. +13 −5 spec/ruby/core/io/write_nonblock_spec.rb
  76. +3 −13 spec/ruby/core/kernel/freeze_spec.rb
  77. +2 −4 spec/ruby/core/kernel/frozen_spec.rb
  78. +5 −1 spec/ruby/core/kernel/open_spec.rb
  79. +66 −2 spec/ruby/core/kernel/rand_spec.rb
  80. +0 −8 spec/ruby/core/kernel/taint_spec.rb
  81. +2 −4 spec/ruby/core/main/define_method_spec.rb
  82. +8 −11 spec/ruby/core/marshal/shared/load.rb
  83. +62 −68 spec/ruby/core/method/arity_spec.rb
  84. +4 −0 spec/ruby/core/module/alias_method_spec.rb
  85. +13 −15 spec/ruby/core/module/ancestors_spec.rb
  86. +6 −0 spec/ruby/core/module/autoload_spec.rb
  87. +23 −34 spec/ruby/core/module/const_defined_spec.rb
  88. +35 −32 spec/ruby/core/module/define_method_spec.rb
  89. +11 −0 spec/ruby/core/module/fixtures/autoload_abc.rb
  90. +1 −0 spec/ruby/core/module/fixtures/autoload_empty.rb
  91. +30 −0 spec/ruby/core/module/fixtures/classes.rb
  92. +7 −9 spec/ruby/core/module/include_spec.rb
  93. +6 −20 spec/ruby/core/module/module_function_spec.rb
  94. +1 −1 spec/ruby/core/module/prepend_features_spec.rb
  95. +10 −12 spec/ruby/core/module/prepend_spec.rb
  96. +9 −11 spec/ruby/core/module/shared/set_visibility.rb
  97. +18 −20 spec/ruby/core/module/singleton_class_spec.rb
  98. +17 −0 spec/ruby/core/numeric/negative_spec.rb
  99. +17 −0 spec/ruby/core/numeric/positive_spec.rb
  100. +20 −35 spec/ruby/core/numeric/quo_spec.rb
  101. +7 −9 spec/ruby/core/numeric/step_spec.rb
  102. +4 −0 spec/ruby/core/objectspace/_id2ref_spec.rb
  103. +18 −18 spec/ruby/core/objectspace/define_finalizer_spec.rb
  104. +0 −8 spec/ruby/core/objectspace/each_object_spec.rb
  105. +0 −8 spec/ruby/core/objectspace/fixtures/classes.rb
  106. +127 −139 spec/ruby/core/proc/arity_spec.rb
  107. +2 −4 spec/ruby/core/proc/parameters_spec.rb
  108. +91 −79 spec/ruby/core/process/daemon_spec.rb
  109. +3 −0 spec/ruby/core/process/fixtures/common.rb
  110. +2 −2 spec/ruby/core/process/fixtures/kill.rb
  111. +12 −14 spec/ruby/core/process/set_proctitle_spec.rb
  112. +9 −6 spec/ruby/core/process/setpgid_spec.rb
  113. +7 −4 spec/ruby/core/process/setpgrp_spec.rb
  114. +2 −0 spec/ruby/core/process/setsid_spec.rb
  115. +23 −2 spec/ruby/core/process/times_spec.rb
  116. +2 −1 spec/ruby/core/process/wait2_spec.rb
  117. +3 −1 spec/ruby/core/process/wait_spec.rb
  118. +5 −1 spec/ruby/core/process/waitpid_spec.rb
  119. +7 −0 spec/ruby/core/string/new_spec.rb
  120. +60 −62 spec/ruby/core/string/scrub_spec.rb
  121. +3 −5 spec/ruby/core/string/shared/encode.rb
  122. +21 −0 spec/ruby/core/string/uminus_spec.rb
  123. +20 −0 spec/ruby/core/string/uplus_spec.rb
  124. +7 −0 spec/ruby/core/string/valid_encoding_spec.rb
  125. +44 −0 spec/ruby/core/struct/dig_spec.rb
  126. +6 −7 spec/ruby/core/symbol/all_symbols_spec.rb
  127. +2 −5 spec/ruby/core/thread/backtrace_spec.rb
  128. +8 −0 spec/ruby/core/thread/name_spec.rb
  129. +62 −68 spec/ruby/core/unboundmethod/arity_spec.rb
  130. +3 −1 spec/ruby/default.mspec
  131. +17 −19 spec/ruby/language/block_spec.rb
  132. +7 −25 spec/ruby/language/break_spec.rb
  133. +3 −12 spec/ruby/language/def_spec.rb
  134. +16 −0 spec/ruby/language/fixtures/super.rb
  135. +92 −104 spec/ruby/language/lambda_spec.rb
  136. +98 −112 spec/ruby/language/method_spec.rb
  137. +48 −50 spec/ruby/language/numbers_spec.rb
  138. +0 −12 spec/ruby/language/regexp/character_classes_spec.rb
  139. +24 −0 spec/ruby/language/super_spec.rb
  140. +5 −0 spec/ruby/library/coverage/fixtures/second_class.rb
  141. +16 −0 spec/ruby/library/coverage/fixtures/some_class.rb
  142. +7 −0 spec/ruby/library/coverage/fixtures/spec_helper.rb
  143. +3 −0 spec/ruby/library/coverage/fixtures/start_coverage.rb
  144. +67 −0 spec/ruby/library/coverage/peek_result_spec.rb
  145. +87 −0 spec/ruby/library/coverage/result_spec.rb
  146. +6 −0 spec/ruby/library/coverage/start_spec.rb
  147. +2 −0 spec/ruby/library/net/http/http/fixtures/http_server.rb
  148. +10 −29 spec/ruby/library/openstruct/frozen_spec.rb
  149. +3 −12 spec/ruby/library/openstruct/method_missing_spec.rb
  150. +0 −37 spec/ruby/library/openstruct/new_ostruct_member_spec.rb
  151. +14 −32 spec/ruby/library/stringscanner/element_reference_spec.rb
  152. +7 −5 spec/ruby/library/syslog/alert_spec.rb
  153. +54 −52 spec/ruby/library/syslog/close_spec.rb
  154. +33 −32 spec/ruby/library/syslog/constants_spec.rb
  155. +7 −5 spec/ruby/library/syslog/crit_spec.rb
  156. +7 −5 spec/ruby/library/syslog/debug_spec.rb
  157. +12 −10 spec/ruby/library/syslog/emerg_spec.rb
  158. +7 −5 spec/ruby/library/syslog/err_spec.rb
  159. +44 −42 spec/ruby/library/syslog/facility_spec.rb
  160. +25 −23 spec/ruby/library/syslog/ident_spec.rb
  161. +7 −5 spec/ruby/library/syslog/info_spec.rb
  162. +29 −27 spec/ruby/library/syslog/inspect_spec.rb
  163. +8 −6 spec/ruby/library/syslog/instance_spec.rb
  164. +43 −41 spec/ruby/library/syslog/log_spec.rb
  165. +81 −79 spec/ruby/library/syslog/mask_spec.rb
  166. +7 −5 spec/ruby/library/syslog/notice_spec.rb
  167. +68 −66 spec/ruby/library/syslog/open_spec.rb
  168. +28 −26 spec/ruby/library/syslog/opened_spec.rb
  169. +44 −42 spec/ruby/library/syslog/options_spec.rb
  170. +7 −5 spec/ruby/library/syslog/reopen_spec.rb
  171. +7 −5 spec/ruby/library/syslog/warning_spec.rb
  172. +3 −15 spec/ruby/library/thread/sizedqueue/max_spec.rb
  173. +3 −15 spec/ruby/library/thread/sizedqueue/new_spec.rb
  174. +1 −0 spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb
  175. +7 −11 spec/ruby/optional/capi/array_spec.rb
  176. +38 −23 spec/ruby/optional/capi/class_spec.rb
  177. +7 −32 spec/ruby/optional/capi/encoding_spec.rb
  178. +5 −0 spec/ruby/optional/capi/ext/class_id_under_autoload_spec.c
  179. +12 −14 spec/ruby/optional/capi/ext/class_spec.c
  180. +1 −1 spec/ruby/optional/capi/ext/class_under_autoload_spec.c
  181. +8 −1 spec/ruby/optional/capi/ext/rubyspec.h
  182. +14 −0 spec/ruby/optional/capi/ext/time_spec.c
  183. +180 −182 spec/ruby/optional/capi/integer_spec.rb
  184. +10 −1 spec/ruby/optional/capi/kernel_spec.rb
  185. +1 −1 spec/ruby/optional/capi/module_spec.rb
  186. +4 −8 spec/ruby/optional/capi/numeric_spec.rb
  187. +15 −3 spec/ruby/optional/capi/thread_spec.rb
  188. +33 −0 spec/ruby/optional/capi/time_spec.rb
  189. +21 −43 spec/ruby/optional/capi/util_spec.rb
  190. +12 −0 spec/ruby/shared/basicobject/method_missing.rb
  191. +0 −26 spec/ruby/shared/process/times.rb
3 changes: 2 additions & 1 deletion spec/ruby/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
sudo: false
language: ruby
rvm:
- 2.0.0-p648
- 2.1.8
- 2.2.4
- 2.3.0
- ruby-head
install:
- git clone https://github.com/ruby/mspec.git ../mspec
@@ -12,3 +12,4 @@ script:
branches:
only:
- master
- /^try/
15 changes: 15 additions & 0 deletions spec/ruby/appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
version: "{build}"
clone_depth: 5
install:
- SET PATH=C:\Ruby22\bin;%PATH%
- ruby --version
- git clone https://github.com/ruby/mspec.git ../mspec
build: off
test_script:
- SET CHECK_LEAKS=true
- ../mspec/bin/mspec -ff command_line language core library
branches:
only:
- master
- /^try/
4 changes: 2 additions & 2 deletions spec/ruby/core/argf/fixtures/bin_file.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test
test
test
test
68 changes: 68 additions & 0 deletions spec/ruby/core/argf/read_nonblock_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/read', __FILE__)

platform_is_not :windows do
describe 'ARGF.read_nonblock' do
it_behaves_like :argf_read, :read_nonblock

before do
@file1_name = fixture(__FILE__, 'file1.txt')
@file2_name = fixture(__FILE__, 'file2.txt')

@file1 = File.read(@file1_name)
@file2 = File.read(@file2_name)

@chunk1 = File.read(@file1_name, 4)
@chunk2 = File.read(@file2_name, 4)
end

it 'reads up to the given amount of bytes' do
argf [@file1_name] do
@argf.read_nonblock(4).should == @chunk1
end
end

describe 'when using multiple files' do
it 'reads up to the given amount of bytes from the first file' do
argf [@file1_name, @file2_name] do
@argf.read_nonblock(4).should == @chunk1
end
end

it 'returns an empty String when reading after having read the first file in its entirety' do
argf [@file1_name, @file2_name] do
@argf.read_nonblock(File.size(@file1_name)).should == @file1
@argf.read_nonblock(4).should == ''
end
end
end

it 'reads up to the given bytes from STDIN' do
stdin = ruby_exe('print ARGF.read_nonblock(4)', :args => "< #{@file1_name}")

stdin.should == @chunk1
end

it 'reads up to the given bytes from a file when a file and STDIN are present' do
stdin = ruby_exe("print ARGF.read_nonblock(4)", :args => "#{@file1_name} - < #{@file2_name}")

stdin.should == @chunk1
end

it 'raises IO::EAGAINWaitReadable when STDIN is empty' do
input = 'ARGF.read_nonblock(4) rescue print $!.class'
stdin = IO.popen([RUBY_EXE, '-e', input], "r+", &:read)

stdin.should == 'IO::EAGAINWaitReadable'
end

ruby_version_is "2.3" do
it 'returns :wait_readable when the :exception is set to false' do
input = 'p ARGF.read_nonblock(4, nil, exception: false)'
stdin = IO.popen([RUBY_EXE, '-e', input], "r+", &:read)

stdin.strip.should == ':wait_readable'
end
end
end
end
44 changes: 3 additions & 41 deletions spec/ruby/core/argf/read_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/read', __FILE__)

describe "ARGF.read" do
it_behaves_like :argf_read, :read

before :each do
@file1_name = fixture __FILE__, "file1.txt"
@file2_name = fixture __FILE__, "file2.txt"
@@ -23,34 +26,6 @@
end
end

it "treats second nil argument as no output buffer" do
argf [@file1_name] do
@argf.read(nil, nil).should == @file1
end
end

it "treats second argument as an output buffer" do
argf [@file1_name] do
buffer = ""
@argf.read(nil, buffer)
buffer.should == @file1
end
end

it "reads a number of bytes from the first file" do
argf [@file1_name] do
@argf.read(5).should == @file1[0,5]
end
end

it "reads from a single file consecutively" do
argf [@file1_name] do
@argf.read(1).should == @file1[0,1]
@argf.read(2).should == @file1[1,2]
@argf.read(3).should == @file1[3,3]
end
end

it "reads the contents of two files" do
argf [@file1_name, @file2_name] do
@argf.read.should == @file1 + @file2
@@ -76,11 +51,6 @@
stdin.should == @stdin
end

it "reads a number of bytes from stdin" do
stdin = ruby_exe("print ARGF.read(10)", args: "< #{@stdin_name}")
stdin.should == @stdin[0,10]
end

it "reads the contents of one file and stdin" do
stdin = ruby_exe("print ARGF.read", args: "#{@file1_name} - < #{@stdin_name}")
stdin.should == @file1 + @stdin
@@ -92,14 +62,6 @@
end
end

platform_is_not :windows do
it "reads the contents of a special device file" do
argf ['/dev/zero'] do
@argf.read(100).should == "\000" * 100
end
end
end

with_feature :encoding do

before :each do
77 changes: 77 additions & 0 deletions spec/ruby/core/argf/readpartial_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/read', __FILE__)

describe "ARGF.readpartial" do
it_behaves_like :argf_read, :readpartial

before :each do
@file1_name = fixture __FILE__, "file1.txt"
@file2_name = fixture __FILE__, "file2.txt"
@stdin_name = fixture __FILE__, "stdin.txt"

@file1 = File.read @file1_name
@file2 = File.read @file2_name
@stdin = File.read @stdin_name
end

it "raises an ArgumentError if called without a maximum read length" do
argf [@file1_name] do
lambda { @argf.readpartial }.should raise_error(ArgumentError)
end
end

it "reads maximum number of bytes from one file at a time" do
argf [@file1_name, @file2_name] do
len = @file1.size + @file2.size
@argf.readpartial(len).should == @file1
end
end

it "clears output buffer even if EOFError is raised because @argf is at end" do
begin
output = "to be cleared"

argf [@file1_name] do
@argf.read
@argf.readpartial(1, output)
end
rescue EOFError
output.should == ""
end
end

it "reads maximum number of bytes from one file at a time" do
argf [@file1_name, @file2_name] do
len = @file1.size + @file2.size
@argf.readpartial(len).should == @file1
end
end

it "returns an empty string if EOFError is raised while reading any but the last file" do
argf [@file1_name, @file2_name] do
@argf.readpartial(@file1.size)
@argf.readpartial(1).should == ""
end
end

ruby_version_is "2.3" do
it "raises an EOFError if the exception was raised while reading the last file" do
argf [@file1_name, @file2_name] do
@argf.readpartial(@file1.size)
@argf.readpartial(1)
@argf.readpartial(@file2.size)
lambda { @argf.readpartial(1) }.should raise_error(EOFError)
lambda { @argf.readpartial(1) }.should raise_error(EOFError)
end
end
end

it "raises an EOFError if the exception was raised while reading STDIN" do
ruby_str = <<-STR
print ARGF.readpartial(#{@stdin.size})
ARGF.readpartial(1) rescue print $!.class
STR
stdin = ruby_exe(ruby_str, args: "< #{@stdin_name}", escape: true)
stdin.should == @stdin + "EOFError"
end
end
58 changes: 58 additions & 0 deletions spec/ruby/core/argf/shared/read.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
describe :argf_read, shared: true do
before :each do
@file1_name = fixture __FILE__, "file1.txt"
@stdin_name = fixture __FILE__, "stdin.txt"

@file1 = File.read @file1_name
@stdin = File.read @stdin_name
end

it "treats second nil argument as no output buffer" do
argf [@file1_name] do
@argf.send(@method, @file1.size, nil).should == @file1
end
end

it "treats second argument as an output buffer" do
argf [@file1_name] do
buffer = ""
@argf.send(@method, @file1.size, buffer)
buffer.should == @file1
end
end

it "clears output buffer before appending to it" do
argf [@file1_name] do
buffer = "to be cleared"
@argf.send(@method, @file1.size, buffer)
buffer.should == @file1
end
end

it "reads a number of bytes from the first file" do
argf [@file1_name] do
@argf.send(@method, 5).should == @file1[0, 5]
end
end

it "reads from a single file consecutively" do
argf [@file1_name] do
@argf.send(@method, 1).should == @file1[0, 1]
@argf.send(@method, 2).should == @file1[1, 2]
@argf.send(@method, 3).should == @file1[3, 3]
end
end

it "reads a number of bytes from stdin" do
stdin = ruby_exe("print ARGF.#{@method}(10)", :args => "< #{@stdin_name}")
stdin.should == @stdin[0, 10]
end

platform_is_not :windows do
it "reads the contents of a special device file" do
argf ['/dev/zero'] do
@argf.send(@method, 100).should == "\000" * 100
end
end
end
end
19 changes: 18 additions & 1 deletion spec/ruby/core/array/dig_spec.rb
Original file line number Diff line number Diff line change
@@ -15,18 +15,35 @@
a.dig(0, -1, 0).should == 2
end

it "returns the nested value specified if the sequence includes a key" do
a = [42, { foo: :bar }]
a.dig(1, :foo).should == :bar
end

it "raises a TypeError for a non-numeric index" do
lambda {
['a'].dig(:first)
}.should raise_error(TypeError)
end

it "raises without any args" do
it "raises a TypeError if any intermediate step does not respond to #dig" do
a = [1, 2]
lambda {
a.dig(0, 1)
}.should raise_error(TypeError)
end

it "raises an ArgumentError if no arguments provided" do
lambda {
[10].dig()
}.should raise_error(ArgumentError)
end

it "returns nil if any intermediate step is nil" do
a = [[1, [2, 3]]]
a.dig(1, 2, 3).should == nil
end

it "calls #dig on the result of #at with the remaining arguments" do
h = [[nil, [nil, nil, 42]]]
h[0].should_receive(:dig).with(1, 2).and_return(42)
8 changes: 0 additions & 8 deletions spec/ruby/core/array/pack/p_spec.rb
Original file line number Diff line number Diff line change
@@ -4,16 +4,8 @@

describe "Array#pack with format 'P'" do
it_behaves_like :array_pack_basic_non_float, 'P'

it "returns a String whose size is the number of bytes in a machine word" do
[nil].pack("P").size.should == 1.size
end
end

describe "Array#pack with format 'p'" do
it_behaves_like :array_pack_basic_non_float, 'p'

it "returns a String whose size is the number of bytes in a machine word" do
[nil].pack("p").size.should == 1.size
end
end
6 changes: 6 additions & 0 deletions spec/ruby/core/array/product_spec.rb
Original file line number Diff line number Diff line change
@@ -41,6 +41,12 @@
acc.should be_empty
end

it "returns self" do
a = [1, 2, 3].freeze

a.product([1, 2]) { |p| p.first }.should == a
end

it "will ignore unreasonable numbers of products and yield anyway" do
a = (0..100).to_a
lambda do
Loading