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

Commits on Mar 27, 2017

  1. Squashed 'spec/mspec/' changes from b6a6877..815ee35

    815ee35 Automatically get the numbers of processors for major OS
    c0cc7d5 Drop rbx/jruby on Travis as they use ancient versions
    1fa5f7d Update MRI versions on Travis
    614fd74 Let MSpec.process print the RUBY_DESCRIPTION
    80b4f17 Improve logic when a worker dies or sends unexpected output
    dc77e8e Base MultiFormatter on SpinnerFormatter
    f2920d9 Distribute workload between subprocess by communicating with the master
    0d4d1b3 Add MSpecOptions#all to help extracting spec patterns
    498130e options.parse returns [] if on_extra is overwritten
    7fa8cbd Extract logic to get spec files from patterns
    a6e1707 Let sub-processes decide which files to run when using -j
    35ff1bc Remove the pack_int helper
    dc8dcc8 Remove reference to unknown DTracer constant
    2917348 Remove the internal const_lookup helper
    658bb7c Drop 1.9 support in MSpec
    22eb68d Fold condition that checks for Ruby < 1.9
    7b6d455 Remove obsolete StringSymbolAdapter
    052cb90 Remove a few checks in MSpec for Ruby < 1.9
    38d6e50 Deprecate #stasy
    e4544c8 Deprecate enumerator_class
    296cf05 Share and simplify logic to add the target command to argv
    afddcea Move more logic to MultiFormatter
    02f4e50 Extract files to run to a variable
    88a14c0 Move the formatting code for -j in MultiFormatter
    e0dac7f Fix mspec -j (parallel run) and use Process.spawn
    3168514 Remove the -A valgrind options
    
    git-subtree-dir: spec/mspec
    git-subtree-split: 815ee35c745d08cf8d6ae90ad6520054a3ac64f8
    eregon committed Mar 27, 2017
    Copy the full SHA
    da55d50 View commit details
  2. Copy the full SHA
    8acc564 View commit details
  3. Squashed 'spec/ruby/' changes from 0fe99d2..2e2057a

    2e2057a Test for utc_offset rather than the zone name
    5cc5c33 rb_absint_size returns size_t
    558f9e3 NIL_P is the standard macro name for a nil test
    af2bd9f Fix typo
    f4352b9 Fix spec description
    a6638c5 Add core Module#initialize_copy spec
    e8e7618 Add rescue splat example to language rescue specs
    db172f6 Add Time#zone spec
    04ea19d Add 2 specs for dumping and loading a File with YAML
    c235991 Add spec that objects with singleton methods cannot be dumped
    77abc93 Add spec for already-required/provided features
    04ec257 Fix typo in require specs
    00a2a51 Spec that Kernel#dup and Kernel#clone do not call #allocate
    2e268f4 Add spec for YAML dumping and loading an OpenStruct
    582d1ed Spec that Class#new does not call #allocate
    02b2346 Add a spec to ensure the Encoding::Converter replacement value is actually used.
    4b5abb4 Fix spec descriptions
    be25e93 Add proper spec checks for rb_big_pack.
    cef7444 Fix spec for platforms where fixnum is a full 64 bit int.
    d220cd2 Fix rb_hash_aref
    4c6477e Add branch for non Range objects in rb_range_values
    d2e0b9f Typo in spec method being tested in rb_io_check_closed
    d552d16 Use a more formal array for the spec for rb_mem_clear
    f3009d4 Add spec for Thread#priority with too small or large priority
    c937513 Pass pointers to integers rather than casting them to integers in thread spec
    f2a3ca3 Move Symbol specs under symbol_spec.rb
    0126547 Fix numerics specs to call correct conversion functions.
    ae299e9 Add rb_any_to_s (works for an Object only)
    d92f458 Rename a Cext spec
    d64fc7c Include the exception for a more useful failing output
    5ac37a9 Add a few expectations for $? in Kernel$system specs
    c5984f7 Use #spawn + the :pgroup option over fork in Process#wait specs
    fff5523 Avoid using #fork in Process#wait specs
    c8348a2 Remove extra should_not raise_error
    94cfae2 Add spec for #4328
    23946be Add spec for passing nil proc to Marshal.load
    9bffb07 Add spec which shows ArgumentError if missing repeated key
    0c5f15c Lengthen out for lack of determinism in this fixture
    d0d3a7b Change spec to catch uninitialized argf
    e47bf97 Add a spec for rb_struct_size
    5fa019f Float#next_float, prev_float: Add test for +/-INFINITY
    08f3f92 Float#next_float, prev_float: Be a bit more specific about assertion
    5a643b3 Float#next_float, prev_float: Be explicit about {next|previous}_float returning same values for +/-0.0
    45160c0 Float#prev_float: Simplify test.
    491e5a4 Float#next_float: Simplify test.
    455f34e Merge pull request #390 from nobu/bug/deprecated-enumerator_class
    7c62925 Use Enumerator
    a095a40 Enumerable#slice_when: Add spec for 0 or 1 element
    6baf83f Add specs for Comparable#clamp (Ruby 2.4.0)
    4c0fd74 Start the -R2 run earlier so it starts in the first 5 jobs
    d5fa0b7 Start Travis OS X first as it is the slowest
    bb5c574 Run Travis on OS X as well
    3f05029 Make "single % characters" singular in messages
    566dcf6 Split single % cases
    19c84be Add new expectation from #388 so Time.now.zone is also tested
    9ac9550 Use fixed times to avoid DST changes
    2e4c441 Fix condition and just use ctime of the current file
    79d2d32 fix typo
    c7008bc Allow leading 0 while parsing decimal digits with Integer
    4d18863 Detect whether the filesystem supports sub-seconds file times
    d675590 Improve `File.atime` and `.mtime` specs with microseconds
    c5de600 Fix spec descriptions to always start with a lowercase letter
    495d072 Add microseconds specs for File.mtime, .atime and .ctime
    b0de2aa Use America/New_York through the whole Time#zone spec
    
    git-subtree-dir: spec/ruby
    git-subtree-split: 2e2057afb70d2e63ea25d34156c354dc298cf693
    eregon committed Mar 27, 2017
    Copy the full SHA
    5d256ba View commit details
  4. Copy the full SHA
    a394925 View commit details
Showing with 1,082 additions and 897 deletions.
  1. +4 −9 spec/mspec/.travis.yml
  2. +1 −16 spec/mspec/lib/mspec/commands/mspec-run.rb
  3. +57 −65 spec/mspec/lib/mspec/commands/mspec.rb
  4. +0 −2 spec/mspec/lib/mspec/helpers.rb
  5. +0 −15 spec/mspec/lib/mspec/helpers/const_lookup.rb
  6. +2 −5 spec/mspec/lib/mspec/helpers/enumerator_class.rb
  7. +0 −3 spec/mspec/lib/mspec/helpers/pack.rb
  8. +3 −5 spec/mspec/lib/mspec/helpers/stasy.rb
  9. +1 −5 spec/mspec/lib/mspec/matchers/method.rb
  10. +0 −8 spec/mspec/lib/mspec/matchers/stringsymboladapter.rb
  11. +2 −6 spec/mspec/lib/mspec/matchers/variable.rb
  12. +1 −4 spec/mspec/lib/mspec/mocks/mock.rb
  13. +36 −0 spec/mspec/lib/mspec/runner/formatters/multi.rb
  14. +3 −3 spec/mspec/lib/mspec/runner/formatters/spinner.rb
  15. +19 −4 spec/mspec/lib/mspec/runner/mspec.rb
  16. +1 −4 spec/mspec/lib/mspec/utils/name_map.rb
  17. +23 −0 spec/mspec/lib/mspec/utils/options.rb
  18. +34 −0 spec/mspec/lib/mspec/utils/script.rb
  19. +1 −0 spec/mspec/spec/commands/mspec_run_spec.rb
  20. +7 −199 spec/mspec/spec/commands/mspec_spec.rb
  21. +0 −49 spec/mspec/spec/helpers/const_lookup_spec.rb
  22. +3 −12 spec/mspec/spec/helpers/enumerator_class_spec.rb
  23. +3 −37 spec/mspec/spec/helpers/stasy_spec.rb
  24. +0 −13 spec/mspec/spec/matchers/have_class_variable_spec.rb
  25. +0 −14 spec/mspec/spec/matchers/have_instance_variable_spec.rb
  26. +0 −38 spec/mspec/spec/matchers/stringsymboladapter_spec.rb
  27. +68 −0 spec/mspec/spec/runner/formatters/multi_spec.rb
  28. +6 −0 spec/mspec/spec/runner/mspec_spec.rb
  29. +0 −1 spec/mspec/spec/utils/name_map_spec.rb
  30. +15 −7 spec/ruby/.travis.yml
  31. +2 −2 spec/ruby/core/argf/shared/each_byte.rb
  32. +2 −2 spec/ruby/core/argf/shared/each_char.rb
  33. +2 −2 spec/ruby/core/argf/shared/each_codepoint.rb
  34. +1 −1 spec/ruby/core/argf/shared/each_line.rb
  35. +1 −1 spec/ruby/core/array/bsearch_index_spec.rb
  36. +1 −1 spec/ruby/core/array/bsearch_spec.rb
  37. +1 −1 spec/ruby/core/array/combination_spec.rb
  38. +2 −2 spec/ruby/core/array/delete_if_spec.rb
  39. +2 −2 spec/ruby/core/array/permutation_spec.rb
  40. +1 −1 spec/ruby/core/array/reject_spec.rb
  41. +1 −1 spec/ruby/core/array/repeated_combination_spec.rb
  42. +1 −1 spec/ruby/core/array/repeated_permutation_spec.rb
  43. +1 −1 spec/ruby/core/array/rindex_spec.rb
  44. +2 −2 spec/ruby/core/array/shared/collect.rb
  45. +1 −1 spec/ruby/core/array/shared/enumeratorize.rb
  46. +1 −1 spec/ruby/core/array/shared/index.rb
  47. +2 −2 spec/ruby/core/array/shared/keep_if.rb
  48. +1 −1 spec/ruby/core/array/sort_by_spec.rb
  49. +12 −0 spec/ruby/core/class/new_spec.rb
  50. +50 −0 spec/ruby/core/comparable/clamp_spec.rb
  51. +5 −3 spec/ruby/core/comparable/fixtures/classes.rb
  52. +1 −1 spec/ruby/core/dir/each_spec.rb
  53. +2 −2 spec/ruby/core/dir/foreach_spec.rb
  54. +10 −0 spec/ruby/core/encoding/converter/replacement_spec.rb
  55. +2 −2 spec/ruby/core/enumerable/chunk_spec.rb
  56. +1 −1 spec/ruby/core/enumerable/chunk_while_spec.rb
  57. +1 −1 spec/ruby/core/enumerable/drop_while_spec.rb
  58. +1 −1 spec/ruby/core/enumerable/each_cons_spec.rb
  59. +1 −1 spec/ruby/core/enumerable/each_entry_spec.rb
  60. +2 −2 spec/ruby/core/enumerable/each_slice_spec.rb
  61. +1 −1 spec/ruby/core/enumerable/each_with_index_spec.rb
  62. +1 −1 spec/ruby/core/enumerable/find_index_spec.rb
  63. +1 −1 spec/ruby/core/enumerable/group_by_spec.rb
  64. +2 −2 spec/ruby/core/enumerable/max_by_spec.rb
  65. +2 −2 spec/ruby/core/enumerable/min_by_spec.rb
  66. +1 −1 spec/ruby/core/enumerable/minmax_by_spec.rb
  67. +1 −1 spec/ruby/core/enumerable/partition_spec.rb
  68. +1 −1 spec/ruby/core/enumerable/reject_spec.rb
  69. +1 −1 spec/ruby/core/enumerable/reverse_each_spec.rb
  70. +1 −1 spec/ruby/core/enumerable/shared/collect.rb
  71. +1 −1 spec/ruby/core/enumerable/shared/collect_concat.rb
  72. +1 −1 spec/ruby/core/enumerable/shared/find.rb
  73. +1 −1 spec/ruby/core/enumerable/shared/find_all.rb
  74. +2 −2 spec/ruby/core/enumerable/slice_after_spec.rb
  75. +3 −3 spec/ruby/core/enumerable/slice_before_spec.rb
  76. +10 −1 spec/ruby/core/enumerable/slice_when_spec.rb
  77. +1 −1 spec/ruby/core/enumerable/sort_by_spec.rb
  78. +1 −1 spec/ruby/core/enumerable/take_while_spec.rb
  79. +1 −1 spec/ruby/core/enumerator/each_with_index_spec.rb
  80. +2 −2 spec/ruby/core/enumerator/generator/each_spec.rb
  81. +1 −1 spec/ruby/core/enumerator/generator/initialize_spec.rb
  82. +3 −3 spec/ruby/core/enumerator/initialize_spec.rb
  83. +5 −5 spec/ruby/core/enumerator/lazy/drop_spec.rb
  84. +3 −3 spec/ruby/core/enumerator/lazy/drop_while_spec.rb
  85. +7 −7 spec/ruby/core/enumerator/lazy/grep_spec.rb
  86. +7 −7 spec/ruby/core/enumerator/lazy/grep_v_spec.rb
  87. +2 −2 spec/ruby/core/enumerator/lazy/initialize_spec.rb
  88. +1 −1 spec/ruby/core/enumerator/lazy/lazy_spec.rb
  89. +3 −3 spec/ruby/core/enumerator/lazy/reject_spec.rb
  90. +3 −3 spec/ruby/core/enumerator/lazy/shared/collect.rb
  91. +3 −3 spec/ruby/core/enumerator/lazy/shared/collect_concat.rb
  92. +3 −3 spec/ruby/core/enumerator/lazy/shared/select.rb
  93. +6 −6 spec/ruby/core/enumerator/lazy/shared/to_enum.rb
  94. +5 −5 spec/ruby/core/enumerator/lazy/take_spec.rb
  95. +3 −3 spec/ruby/core/enumerator/lazy/take_while_spec.rb
  96. +4 −4 spec/ruby/core/enumerator/lazy/zip_spec.rb
  97. +2 −2 spec/ruby/core/enumerator/rewind_spec.rb
  98. +1 −1 spec/ruby/core/enumerator/with_index_spec.rb
  99. +5 −5 spec/ruby/core/enumerator/yielder/append_spec.rb
  100. +1 −1 spec/ruby/core/enumerator/yielder/initialize_spec.rb
  101. +1 −1 spec/ruby/core/env/delete_if_spec.rb
  102. +1 −1 spec/ruby/core/env/each_key_spec.rb
  103. +1 −1 spec/ruby/core/env/each_value_spec.rb
  104. +1 −1 spec/ruby/core/env/keep_if_spec.rb
  105. +2 −2 spec/ruby/core/env/reject_spec.rb
  106. +2 −2 spec/ruby/core/env/select_spec.rb
  107. +1 −1 spec/ruby/core/env/shared/each.rb
  108. +1 −1 spec/ruby/core/exception/name_error_spec.rb
  109. +14 −0 spec/ruby/core/file/atime_spec.rb
  110. +13 −2 spec/ruby/core/file/ctime_spec.rb
  111. +13 −0 spec/ruby/core/file/mtime_spec.rb
  112. +10 −5 spec/ruby/core/float/next_float_spec.rb
  113. +9 −4 spec/ruby/core/float/prev_float_spec.rb
  114. +2 −2 spec/ruby/core/hash/select_spec.rb
  115. +3 −3 spec/ruby/core/hash/shared/iteration.rb
  116. +3 −3 spec/ruby/core/hash/transform_values_spec.rb
  117. +1 −1 spec/ruby/core/io/bytes_spec.rb
  118. +1 −1 spec/ruby/core/io/each_byte_spec.rb
  119. +1 −1 spec/ruby/core/io/foreach_spec.rb
  120. +2 −2 spec/ruby/core/io/lines_spec.rb
  121. +2 −2 spec/ruby/core/io/shared/chars.rb
  122. +1 −1 spec/ruby/core/io/shared/codepoints.rb
  123. +1 −1 spec/ruby/core/io/shared/each.rb
  124. +12 −0 spec/ruby/core/kernel/clone_spec.rb
  125. +12 −0 spec/ruby/core/kernel/dup_spec.rb
  126. +1 −1 spec/ruby/core/kernel/loop_spec.rb
  127. +29 −1 spec/ruby/core/kernel/shared/require.rb
  128. +15 −0 spec/ruby/core/kernel/system_spec.rb
  129. +14 −0 spec/ruby/core/marshal/dump_spec.rb
  130. +2 −4 spec/ruby/core/marshal/shared/load.rb
  131. +10 −0 spec/ruby/core/module/initialize_copy_spec.rb
  132. +6 −6 spec/ruby/core/numeric/shared/step.rb
  133. +2 −2 spec/ruby/core/numeric/step_spec.rb
  134. +1 −1 spec/ruby/core/objectspace/each_object_spec.rb
  135. +10 −41 spec/ruby/core/process/wait_spec.rb
  136. +1 −1 spec/ruby/core/range/bsearch_spec.rb
  137. +1 −1 spec/ruby/core/range/each_spec.rb
  138. +1 −1 spec/ruby/core/range/step_spec.rb
  139. +1 −1 spec/ruby/core/string/each_byte_spec.rb
  140. +2 −2 spec/ruby/core/string/gsub_spec.rb
  141. +8 −2 spec/ruby/core/string/modulo_spec.rb
  142. +1 −1 spec/ruby/core/string/shared/each_char_without_block.rb
  143. +2 −2 spec/ruby/core/string/shared/each_codepoint_without_block.rb
  144. +1 −1 spec/ruby/core/string/shared/each_line_without_block.rb
  145. +1 −1 spec/ruby/core/string/upto_spec.rb
  146. +1 −1 spec/ruby/core/struct/each_pair_spec.rb
  147. +1 −1 spec/ruby/core/struct/each_spec.rb
  148. +1 −1 spec/ruby/core/struct/select_spec.rb
  149. +2 −2 spec/ruby/core/thread/abort_on_exception_spec.rb
  150. +7 −0 spec/ruby/core/thread/priority_spec.rb
  151. +13 −3 spec/ruby/core/time/zone_spec.rb
  152. +1 −1 spec/ruby/core/unboundmethod/bind_spec.rb
  153. +1 −2 spec/ruby/language/numbers_spec.rb
  154. +8 −0 spec/ruby/language/rescue_spec.rb
  155. +1 −1 spec/ruby/library/bigdecimal/divmod_spec.rb
  156. +1 −1 spec/ruby/library/bigdecimal/new_spec.rb
  157. +1 −1 spec/ruby/library/bigdecimal/shared/eql.rb
  158. +1 −1 spec/ruby/library/bigdecimal/sign_spec.rb
  159. +6 −6 spec/ruby/library/bigdecimal/split_spec.rb
  160. +1 −1 spec/ruby/library/bigdecimal/to_f_spec.rb
  161. +2 −2 spec/ruby/library/date/shared/commercial.rb
  162. +1 −1 spec/ruby/library/find/find_spec.rb
  163. +1 −1 spec/ruby/library/mathn/integer/from_prime_division_spec.rb
  164. +2 −2 spec/ruby/library/mathn/integer/prime_division_spec.rb
  165. +1 −1 spec/ruby/library/matrix/build_spec.rb
  166. +1 −1 spec/ruby/library/matrix/each_spec.rb
  167. +1 −1 spec/ruby/library/matrix/each_with_index_spec.rb
  168. +2 −2 spec/ruby/library/matrix/find_index_spec.rb
  169. +1 −1 spec/ruby/library/matrix/shared/collect.rb
  170. +1 −1 spec/ruby/library/matrix/vector/each2_spec.rb
  171. +1 −1 spec/ruby/library/net/http/httpheader/each_capitalized_name_spec.rb
  172. +1 −1 spec/ruby/library/net/http/httpheader/each_value_spec.rb
  173. +1 −1 spec/ruby/library/net/http/httpheader/shared/each_capitalized.rb
  174. +1 −1 spec/ruby/library/net/http/httpheader/shared/each_header.rb
  175. +1 −1 spec/ruby/library/net/http/httpheader/shared/each_name.rb
  176. +1 −1 spec/ruby/library/set/classify_spec.rb
  177. +1 −1 spec/ruby/library/set/delete_if_spec.rb
  178. +1 −1 spec/ruby/library/set/keep_if_spec.rb
  179. +1 −1 spec/ruby/library/set/reject_spec.rb
  180. +1 −1 spec/ruby/library/set/select_spec.rb
  181. +1 −1 spec/ruby/library/set/sortedset/classify_spec.rb
  182. +1 −1 spec/ruby/library/set/sortedset/delete_if_spec.rb
  183. +1 −1 spec/ruby/library/set/sortedset/keep_if_spec.rb
  184. +1 −1 spec/ruby/library/set/sortedset/reject_spec.rb
  185. +1 −1 spec/ruby/library/set/sortedset/select_spec.rb
  186. +1 −1 spec/ruby/library/stringio/shared/codepoints.rb
  187. +1 −1 spec/ruby/library/stringio/shared/each.rb
  188. +1 −1 spec/ruby/library/stringio/shared/each_byte.rb
  189. +1 −1 spec/ruby/library/stringio/shared/each_char.rb
  190. +2 −2 spec/ruby/library/stringscanner/shared/eos.rb
  191. +1 −1 spec/ruby/library/stringscanner/shared/rest_size.rb
  192. +11 −0 spec/ruby/library/yaml/dump_spec.rb
  193. +14 −0 spec/ruby/library/yaml/load_spec.rb
  194. +94 −16 spec/ruby/optional/capi/bignum_spec.rb
  195. +0 −25 spec/ruby/optional/capi/encoding_spec.rb
  196. +4 −5 spec/ruby/optional/capi/ext/array_spec.c
  197. +48 −0 spec/ruby/optional/capi/ext/bignum_spec.c
  198. +1 −1 spec/ruby/optional/capi/ext/hash_spec.c
  199. +9 −0 spec/ruby/optional/capi/ext/rubyspec.h
  200. +11 −0 spec/ruby/optional/capi/ext/struct_spec.c
  201. +4 −4 spec/ruby/optional/capi/ext/thread_spec.c
  202. +1 −1 spec/ruby/optional/capi/hash_spec.rb
  203. +1 −1 spec/ruby/optional/capi/io_spec.rb
  204. +1 −1 spec/ruby/optional/capi/numeric_spec.rb
  205. +7 −1 spec/ruby/optional/capi/object_spec.rb
  206. +21 −0 spec/ruby/optional/capi/range_spec.rb
  207. +8 −0 spec/ruby/optional/capi/struct_spec.rb
  208. +20 −0 spec/ruby/optional/capi/symbol_spec.rb
  209. +8 −8 spec/ruby/shared/enumerator/each.rb
  210. +1 −1 spec/ruby/shared/enumerator/enum_cons.rb
  211. +1 −1 spec/ruby/shared/enumerator/enum_for.rb
  212. +7 −7 spec/ruby/shared/enumerator/new.rb
  213. +1 −1 spec/ruby/shared/enumerator/next.rb
  214. +1 −1 spec/ruby/shared/enumerator/rewind.rb
  215. +1 −1 spec/ruby/shared/enumerator/with_index.rb
  216. +1 −1 spec/ruby/shared/enumerator/with_object.rb
13 changes: 4 additions & 9 deletions spec/mspec/.travis.yml
Original file line number Diff line number Diff line change
@@ -3,14 +3,9 @@ language: ruby
script:
- bundle exec rspec
rvm:
- 1.9.3
- 2.0.0
- 2.1.5
- 2.2.1
- 2.1.10
- 2.2.6
- 2.3.3
- 2.4.1
- ruby-head
- rubinius
- jruby
matrix:
allow_failures:
- rvm: rubinius
- rvm: jruby
17 changes: 1 addition & 16 deletions spec/mspec/lib/mspec/commands/mspec-run.rb
Original file line number Diff line number Diff line change
@@ -75,21 +75,7 @@ def options(argv=ARGV)
options.doc ""

patterns = options.parse argv

unless $0.end_with?("_spec.rb")
if patterns.empty?
patterns = config[:files]
end
if patterns.empty? and File.directory? "./spec"
patterns = ["spec/"]
end
if patterns.empty?
puts options
puts "No files specified."
exit 1
end
end
@files = files patterns
@files = files_from_patterns(patterns)
end

def run
@@ -100,4 +86,3 @@ def run
exit MSpec.exit_code
end
end

122 changes: 57 additions & 65 deletions spec/mspec/lib/mspec/commands/mspec.rb
Original file line number Diff line number Diff line change
@@ -35,10 +35,6 @@ def options(argv=ARGV)

options.targets

options.on("-A", "--valgrind", "Run under valgrind") do
config[:use_valgrind] = true
end

options.on("--warnings", "Don't supress warnings") do
config[:flags] << '-w'
ENV['OUTPUT_WARNINGS'] = '1'
@@ -79,87 +75,83 @@ def options(argv=ARGV)
options.doc " example: $ mspec run -h\n"

options.on_extra { |o| config[:options] << o }
config[:options].concat options.parse(argv)
end

def register; end

def parallel
@parallel ||= !(Object.const_defined?(:JRUBY_VERSION) ||
/(mswin|mingw)/ =~ RUBY_PLATFORM)
end

def fork(&block)
parallel ? Kernel.fork(&block) : block.call
end

def report(files, timer)
require 'yaml'

exceptions = []
tally = Tally.new
options.parse(argv)

files.each do |file|
d = File.open(file, "r") { |f| YAML.load f }
File.delete file

exceptions += Array(d['exceptions'])
tally.files! d['files']
tally.examples! d['examples']
tally.expectations! d['expectations']
tally.errors! d['errors']
tally.failures! d['failures']
end

print "\n"
exceptions.each_with_index do |exc, index|
print "\n#{index+1})\n", exc, "\n"
if config[:multi]
options = MSpecOptions.new "mspec", 30, config
options.all
patterns = options.parse(config[:options])
@files = files_from_patterns(patterns)
end
print "\n#{timer.format}\n\n#{tally.format}\n"
end

def multi_exec(argv)
timer = TimerAction.new
timer.start

files = config[:ci_files].inject([]) do |list, item|
name = tmp "mspec-ci-multi-#{list.size}"

rest = argv + ["-o", name, item]
fork { system [config[:target], *rest].join(" ") }
def register; end

list << name
def multi_exec(argv)
MSpec.register_files @files

require 'mspec/runner/formatters/multi'
formatter = MultiFormatter.new

output_files = []
children = cores.times.map { |i|
name = tmp "mspec-multi-#{i}"
output_files << name

env = {
"SPEC_TEMP_DIR" => "rubyspec_temp_#{i}",
"MSPEC_MULTI" => i.to_s
}
command = argv + ["-o", name]
$stderr.puts "$ #{command.join(' ')}" if $MSPEC_DEBUG
IO.popen([env, *command], "rb+")
}

puts children.map { |child| child.gets }.uniq
formatter.start

until @files.empty?
IO.select(children)[0].each { |io|
reply = io.read(1)
case reply
when '.'
formatter.unload
when nil
raise "Worker died!"
else
while chunk = (io.read_nonblock(4096) rescue nil)
reply += chunk
end
raise reply
end
io.puts @files.shift unless @files.empty?
}
end

Process.waitall
timer.finish
report files, timer
children.each { |child|
child.puts "QUIT"
Process.wait(child.pid)
}

formatter.aggregate_results(output_files)
formatter.finish
end

def run
argv = []
argv = config[:target].split(/\s+/)

argv.concat config[:launch]
argv.concat config[:flags]
argv.concat config[:includes]
argv.concat config[:requires]
argv << "-v"
argv << "#{MSPEC_HOME}/bin/mspec-#{ config[:command] || "run" }"
argv.concat config[:options]

if config[:multi] and config[:command] == "ci"
if config[:multi]
multi_exec argv
else
if config[:use_valgrind]
more = ["--child-silent-after-fork=yes",
config[:target]] + argv
exec "valgrind", *more
else
cmd, *rest = config[:target].split(/\s+/)
argv = rest + argv unless rest.empty?
$stderr.puts "$ #{cmd} #{argv.join(' ')}"
exec cmd, *argv
end
$stderr.puts "$ #{argv.join(' ')}"
exec *argv
end
end
end
2 changes: 0 additions & 2 deletions spec/mspec/lib/mspec/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'mspec/helpers/argf'
require 'mspec/helpers/argv'
require 'mspec/helpers/const_lookup'
require 'mspec/helpers/datetime'
require 'mspec/helpers/ducktype'
require 'mspec/helpers/encode'
@@ -13,7 +12,6 @@
require 'mspec/helpers/io'
require 'mspec/helpers/mock_to_path'
require 'mspec/helpers/numeric'
require 'mspec/helpers/pack'
require 'mspec/helpers/ruby_exe'
require 'mspec/helpers/scratch'
require 'mspec/helpers/stasy'
15 changes: 0 additions & 15 deletions spec/mspec/lib/mspec/helpers/const_lookup.rb

This file was deleted.

7 changes: 2 additions & 5 deletions spec/mspec/lib/mspec/helpers/enumerator_class.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
class Object

# Returns the Enumerator class (either Enumerator or Enumerable::Enumerator)
# depending of the version.
#
def enumerator_class
SpecVersion.new(RUBY_VERSION) < "1.9" ? Enumerable::Enumerator : Enumerator
MSpec.deprecate "enumerator_class", "Enumerator"
Enumerator
end
end
3 changes: 0 additions & 3 deletions spec/mspec/lib/mspec/helpers/pack.rb

This file was deleted.

8 changes: 3 additions & 5 deletions spec/mspec/lib/mspec/helpers/stasy.rb
Original file line number Diff line number Diff line change
@@ -20,14 +20,12 @@ class Object
# stasy("nom") => :nom

def stasy(one, *rest)
era = SpecVersion.new(SpecGuard.ruby_version) < "1.9"
convert = era ? :to_s : :to_sym

one = one.send convert
MSpec.deprecate "stasy", "a Symbol literal"
one = one.send :to_sym
if rest.empty?
one
else
[one].concat rest.map { |x| x.send convert }
[one].concat rest.map { |x| x.send :to_sym }
end
end
end
6 changes: 1 addition & 5 deletions spec/mspec/lib/mspec/matchers/method.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
require 'mspec/matchers/stringsymboladapter'

class MethodMatcher
include StringSymbolAdapter

def initialize(method, include_super=true)
@include_super = include_super
@method = convert_name method
@method = method.to_sym
end

def matches?(mod)
8 changes: 0 additions & 8 deletions spec/mspec/lib/mspec/matchers/stringsymboladapter.rb

This file was deleted.

8 changes: 2 additions & 6 deletions spec/mspec/lib/mspec/matchers/variable.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
require 'mspec/matchers/stringsymboladapter'

class VariableMatcher
include StringSymbolAdapter

class << self
attr_accessor :variables_method, :description
end

def initialize(variable)
@variable = convert_name(variable)
@variable = variable.to_sym
end

def matches?(object)
@@ -25,4 +21,4 @@ def negative_failure_message
["Expected #{@object} NOT to have #{self.class.description} '#{@variable}'",
"but it does"]
end
end
end
5 changes: 1 addition & 4 deletions spec/mspec/lib/mspec/mocks/mock.rb
Original file line number Diff line number Diff line change
@@ -118,10 +118,7 @@ def self.verify_count

def self.verify_call(obj, sym, *args, &block)
compare = *args
behaves_like_ruby_1_9 = *[]
if (behaves_like_ruby_1_9)
compare = compare.first if compare.length <= 1
end
compare = compare.first if compare.length <= 1

key = replaced_key obj, sym
[mocks, stubs].each do |proxies|
36 changes: 36 additions & 0 deletions spec/mspec/lib/mspec/runner/formatters/multi.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require 'mspec/runner/formatters/spinner'
require 'yaml'

class MultiFormatter < SpinnerFormatter
def initialize(out=nil)
super(out)
@counter = @tally = Tally.new
@timer = TimerAction.new
@timer.start
end

def aggregate_results(files)
@timer.finish
@exceptions = []

files.each do |file|
d = File.open(file, "r") { |f| YAML.load f }
File.delete file

@exceptions += Array(d['exceptions'])
@tally.files! d['files']
@tally.examples! d['examples']
@tally.expectations! d['expectations']
@tally.errors! d['errors']
@tally.failures! d['failures']
end
end

def print_exception(exc, count)
print "\n#{count})\n#{exc}\n"
end

def finish
super(false)
end
end
6 changes: 3 additions & 3 deletions spec/mspec/lib/mspec/runner/formatters/spinner.rb
Original file line number Diff line number Diff line change
@@ -109,9 +109,9 @@ def after(state)
print progress_line
end

def finish
def finish(printed_exceptions = true)
# We already printed the exceptions
@exceptions = []
super
@exceptions = [] if printed_exceptions
super()
end
end
Loading