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

Commits on Apr 27, 2016

  1. Squashed 'spec/ruby/' changes from f5d943e..32e22d6

    32e22d6 Ruby 2.4 raises a TypeError for invalid step args
    8466e7c Fixed issues in Kernel#rand specs
    3e0334a Removed using BigDecimal in rand specs.
    9b8927d String#dup returns copy when no modification made.
    a722922 Adds Numeric#step keyword arguments specs.
    5114a66 Fixed edge case where small BigDecimal ranges were erroring
    ad9be02 Fix float ranges where diff of 0
    c0e852a Fixed rand() for degenerative empty range
    bf42261 Only run frozen string literals specs on Ruby >= 2.3
    faea24f Add two specs for new arrays with simple Fixnums
    bf9ad3a Ensure String#byteslice normalizes indices by byte length, not character length.
    b892ade BasicObject#instance_eval evaluates string with given filename and linenumber
    946967e yield uses captured block of a block used in define_method
    3e09f4e Spec that frozen string literals don't change what defined? returns, to protect against implementations that desugar the call away.
    3f436dc Where we're testing the freeze command line flag, we shouldn't call .freeze.
    47690be Where we're testing the freeze magic comment, we shouldn't call .freeze.
    3d062e3 Add a spec for string literal freeze magic comment, where there is the same literal but in a file without the comment.
    b9c349e Add command-line specs for --enable-frozen-string-literal.
    b6c95d1 Add a spec for string literal freeze magic comment, where the literals are in different files but have different encodings.
    db22ba5 Add a spec for string literal freeze magic comment, where the literals are in different files.
    f8bfdb1 Add a spec for string literal freeze magic comment with two literals but the same content.
    8a76900 Add a spec for string literal freeze magic comment with one literal.
    b70af78 Add a spec for the special String#freeze syntax.
    b3866cb New spec testing that compare_by_identity Hash do not call #hash.
    0ade4ee Wait for the main thread to be interrupted in Thread#abort_on_exception spec
    30cdf15 Remove bad rb_thread_call_without_gvl2 spec.
    75c8c21 Merge pull request #248 from odaira/myContribution
    99d20dc In AIX, when a pipe is readable, select(2) returns even the write side of the pipe as "readable"
    b60523a Merge pull request #247 from nobu/overridable-OBJDIR
    c5a98ec Make OBJDIR overridable
    68dd505 Show our build status on Windows
    d7a5a7b File.new/open changes permissions of existing files on MRI on Windows
    2077fec Try to write a more sensible spec for IO#write on Windows
    5dae610 Try to read in text mode for IO#write spec on Windows
    55cb889 Use local variables in Module#ancestors
    2b3bf9e Merge pull request #245 from wied03/ancestors
    8ad6780 Better test Module#ancestors cases
    e5765b1 Merge pull request #246 from wied03/class_to_s
    723e4c9 Merge pull request #244 from wied03/master
    7bf3a56 Test singleton class cases with `Class#to_s`
    2341203 Test a strange module case compare edge case
    4b6dd97 Merge pull request #243 from wied03/master
    9c14562 Fill spec change from e60792ca2fe08ff2bb2f00eff7c6d70547cfc42e crashes Opal, so don't execute on that platform
    ac7f701 Merge pull request #241 from wied03/master
    a274931 First cut of Pathname#relative_path_from
    4879393 Merge pull request #242 from znz/fix-typo
    1a34bb3 Fix a typo
    bc2614f Cleanup and reorganize a bit extensions spec_helper
    231f0ec Merge pull request #240 from nobu/no-capi-signatures
    1829feb Fix .gitignore file to only consider files at the root
    31252bd Move extension files to ext/RUBY_NAME/RUBY_VERSION
    4834b1a No CAPI signature files
    663c7a0 Add sentinel
    71d6bde Remove mri.h as MRI should have all C-API functions spec'd in ruby/spec
    d294c56 Remove rb_inspecting_p and rb_protect_inspect specs since it is not standard
    e60792c Remove deviates_on and use numeric helpers for Array#fill
    b85c5f2 Remove extended_on and give proper describe blocks to rb_thread_blocking_region and such
    0a9af62 Remove rb_str_ptr and rb_str_ptr_readonly since they are Rubinius-specific
    d6c3234 Remove extended_on for missing functionality
    28c64c8 rb_obj_frozen_p exists on other implementations as well
    1c00935 Merge pull request #239 from odaira/myContribution2
    e2065d8 Merge pull request #238 from odaira/myContribution
    7805965 AIX does not allow mkdir(2) to set a sticky bit
    c45706f Fix typo: 1755 intended to be 01755
    ebfaf9d Exempt AIX in core/file/lchmod_spec.rb because it does not support lchmod(2)
    260cdc3 Try a third way to pass the system spec and no issue console warnings
    7462137 adapt expectation for exit status after SIGKILL on Windows
    0bb8a49 Merge pull request #237 from iliabylich/add-tests-for-lbrace-arg-cases
    a3dc36f quarantine problematic name resolving spec
    ec8e369 SO_REUSEADDR seems to have a slightly different meaning in Windows
    7784171 A getaddrinfo spec is also unsupported on Windows
    bfc9162 resolv with localhost seems not working on Windows
    6d7ea9a Try to fix a system spec on Windows
    8c87aba IO.copy_stream with IO with offsets is not supported on Windows
    6c66468 File::Stat#nlink seems to be unreliable on Windows
    b73e686 Add tests for method calls that have a space between method name and parentheses.
    82f728c Merge pull request #236 from iliabylich/add-specs-for-arity/parameters-for-attr_reader/writer
    c54cc3a Added specs for Method#arity and Method#parameters for methods generated by attr_reader/attr_writer.
    9b45a0d Merge pull request #235 from wied03/master
    0a570d9 Add Pathname#join specs, enhance ::new
    d6a94f7 Shell variable expansion in Kernel#system is spec on Windows.
    64dba27 Remove libgmp from .travis.yml as ruby-head should not need it anymore.
    fa55c43 Merge pull request #234 from odaira/myContribution
    8b77012 Default error message returned by stderror(3) is "Error <errno> occurred" on AIX
    ec4c0d0 Allow both US_ASCII and ASCII_8BIT if fs encoding is unset (LANG=C)
    d9dd997 Simplify File::Stat#inspect and do not expect birthtime in the output on Windows.
    11544a8 Do not try to change the {a,m}time of an opened file in File::Stat#<=> specs
    b3ff895 Try to create files first in File::Stat#<=>.
    37df92f Try to simplify the File#new spec with permissions.
    a8363e9 chown is no-op on Windows
    bd23a74 Math.lgamma(-0.0) is only guaranteed on 2.4 for now.
    e2e203b Merge pull request #233 from nobu/feature/Math#lgamma-0.0
    a1e623f Math.lgamma returns [infinity, -1] on -0.0
    d5e21c8 Move the #include triggering #included outside fixtures.
    0e11702 Merge pull request #232 from wied03/super_again
    0683a53 Fix another super case
    bbe5d48 Merge pull request #231 from wied03/more_super
    a081c74 Test more super edge cases
    c18e55b Merge pull request #229 from wied03/super_stuff
    b04d2fe Merge pull request #228 from nobu/trailing-spaces
    bd89b79 Merge pull request #227 from wied03/master
    cd06cdd super enhancement
    9059448 remove trailing spaces
    a87ca8a Cover cases where the backslash itself is escaped
    932fa26 Update Coverage specs to not filter the result if Ruby >= 2.4.
    45935f3 Merge pull request #225 from nobu/bug/Dir.pwd-C
    6d5daba Merge pull request #226 from ruby/try_with_gmp
    7f04132 Fix Dir.pwd encoding
    f3a55e1 libgmp-devel apt package
    f90428f UNIX sockets only on UNIX
    dfdb6d0 Make clear that not.existing is not an extension
    b0bedcb Avoid warning by redirecting stderr on Windows
    2ceb3bd Avoid changing LC_ALL, which has also no effect on Windows
    26086ad Math.frexp returns an unspecified value for exp if value is NaN.
    6cf4f32 File.expand_path does not care about the external Encoding on Windows
    49701ab Try reading from the pipe to avoid warning on Windows
    8d6f12a Use platform-specific @RootDir in File.expand_path spec
    4e60d3d Avoid nonexistent pipe warning on Windows
    24c26f9 Fix Dir.pwd encoding spec: it is the filesystem encoding.
    e5406c1 Avoid newlines in File#open spec.
    d21886d Disable autoclose if File.new(fd) does not raise an error
    1f5ccb6 Fix namespace.
    d7c8746 Take in account imprecision of Math.gamma on Windows.
    ec58c97 Use a simpler way to know if Kernel has a private method with -n.
    4f8ed56 Etc.group is not available on Windows
    548e3c1 Avoid should_not raise_error.
    40265a4 UNIXServer is not available on Windows
    b0a70f1 Merge pull request #224 from ruby/vais/windows
    4c24384 Pass Dir.mktmpdir spec on Windows
    a0a0378 Adjust Socket constants and error classes for Windows
    0d7762f not_supported_on is only for ruby implementations
    9e87701 Adapt exception to Windows in recv_nonblock
    bf0e472 Refactor IO#{read,write}_nonblock_spec when there is no data available
    edaa5e7 Fix describe in Dir.mktmpdir spec
    e6f91c7 IO#expect and the exepct stdlib is not available on Windows
    3bb7369 Workaround the problem to test respond_to?(:fork) and being able to call it publicly.
    e69370a Changing the time zone with Continent/City is unsupported on Windows
    c81e224 Try to include private methods in the fork #respond_to? test
    096cb4c Revert "Process.respond_to?(:fork) seems to be true now on Windows"
    c6fcd2f Process.respond_to?(:fork) seems to be true now on Windows
    c31500a Process.maxgroups is not on implemented on Windows
    0a2ff59 Windows guards for symlinks
    b5c2ed6 Guard UNIX-specific Signal.trap specs
    d194a30 Windows guards in IO#write_nonblock
    1f701d9 More IO on Windows fixes
    774fb8f Only notify on status change for Travis
    b8a8d3a Some IO on Windows fixes
    c3c16bb More File on Windows fixes
    618fa06 Fix File specs on Windows.
    f5d45a0 Windows raises EISDIR for File.read(dir)
    dbe045a Open files with write mode for writing in File#open spec
    2ea1128 Add Windows guards in File.{new,open}
    cd048ee Fix shared stat specs.
    53b8dbc File.open with a directory is not supported on Windows.
    d1a895e Skip incompatible Process#kill specs on Windows
    6dd62b3 Separate Process#kill specs which can be supported on Windows
    3dae14d Deduplicate definition of native newline.
    130a11d Merge pull request #223 from ruby/vais/windows
    86a2514 Pass Kernel#spawn spec on Windows
    15b803c Pass Kernel#exec with a command array spec on Windows
    e10c091 Merge pull request #222 from ruby/elia/explicit-fcall-as-default-arg
    682e3c3 Use an ordinary Object instead of a String
    18b9172 More explicit specs for fcall as default argument
    f13db61 Merge pull request #221 from ruby/vais/windows
    c716825 Pass Kernel#exec spec on Windows
    80e5be3 Clearly separate non-compliant behavior on Windows using platform blocks
    15c6b74 Pass Kernel#system spec on Windows
    9049a75 Use a cross-platform alternative to system("false")
    6fa70d1 Use a cross-platform alternative to system("true")
    37677eb Pass IO.read spec on Windows
    62e4e19 Pass IO#readlines spec on Windows
    d84d68a Pass IO.foreach spec on Windows
    1b2cdcf Fix grouping of #slice_when spec.
    
    git-subtree-dir: spec/ruby
    git-subtree-split: 32e22d667b12f10655701487312926f394d1e2e9
    eregon committed Apr 27, 2016
    Copy the full SHA
    f2d228a View commit details
  2. Copy the full SHA
    9bf884f View commit details
Showing with 2,174 additions and 1,530 deletions.
  1. +5 −3 spec/ruby/.gitignore
  2. +4 −0 spec/ruby/.travis.yml
  3. +5 −5 spec/ruby/CONTRIBUTING.md
  4. +3 −2 spec/ruby/README.md
  5. +15 −13 spec/ruby/command_line/frozen_strings_spec.rb
  6. +5 −21 spec/ruby/core/array/fill_spec.rb
  7. +25 −0 spec/ruby/core/class/to_s_spec.rb
  8. +8 −16 spec/ruby/core/dir/shared/pwd.rb
  9. +1 −10 spec/ruby/core/encoding/default_external_spec.rb
  10. +6 −6 spec/ruby/core/enumerable/slice_when_spec.rb
  11. +6 −1 spec/ruby/core/exception/system_call_error_spec.rb
  12. +6 −4 spec/ruby/core/file/chown_spec.rb
  13. +10 −6 spec/ruby/core/file/expand_path_spec.rb
  14. +2 −2 spec/ruby/core/file/lchmod_spec.rb
  15. +26 −16 spec/ruby/core/file/new_spec.rb
  16. +26 −22 spec/ruby/core/file/open_spec.rb
  17. +1 −7 spec/ruby/core/file/shared/read.rb
  18. +3 −21 spec/ruby/core/file/shared/stat.rb
  19. +17 −15 spec/ruby/core/file/socket_spec.rb
  20. +4 −2 spec/ruby/core/file/split_spec.rb
  21. +13 −4 spec/ruby/core/file/stat/blksize_spec.rb
  22. +13 −4 spec/ruby/core/file/stat/blocks_spec.rb
  23. +33 −12 spec/ruby/core/file/stat/comparison_spec.rb
  24. +10 −2 spec/ruby/core/file/stat/dev_major_spec.rb
  25. +10 −2 spec/ruby/core/file/stat/dev_minor_spec.rb
  26. +22 −18 spec/ruby/core/file/stat/ftype_spec.rb
  27. +14 −4 spec/ruby/core/file/stat/ino_spec.rb
  28. +10 −21 spec/ruby/core/file/stat/inspect_spec.rb
  29. +2 −2 spec/ruby/core/file/stat/mode_spec.rb
  30. +6 −4 spec/ruby/core/file/stat/nlink_spec.rb
  31. +11 −2 spec/ruby/core/file/stat/rdev_major_spec.rb
  32. +11 −2 spec/ruby/core/file/stat/rdev_minor_spec.rb
  33. +25 −26 spec/ruby/core/file/stat_spec.rb
  34. +10 −8 spec/ruby/core/file/sticky_spec.rb
  35. +20 −12 spec/ruby/core/io/copy_stream_spec.rb
  36. +5 −1 spec/ruby/core/io/foreach_spec.rb
  37. +1 −1 spec/ruby/core/io/gets_spec.rb
  38. +4 −2 spec/ruby/core/io/ioctl_spec.rb
  39. +7 −2 spec/ruby/core/io/popen_spec.rb
  40. +8 −9 spec/ruby/core/io/read_nonblock_spec.rb
  41. +29 −7 spec/ruby/core/io/read_spec.rb
  42. +5 −1 spec/ruby/core/io/readlines_spec.rb
  43. +6 −3 spec/ruby/core/io/reopen_spec.rb
  44. +13 −4 spec/ruby/core/io/select_spec.rb
  45. +4 −2 spec/ruby/core/io/shared/new.rb
  46. +38 −40 spec/ruby/core/io/write_nonblock_spec.rb
  47. +3 −3 spec/ruby/core/io/write_spec.rb
  48. +2 −7 spec/ruby/core/kernel/fixtures/classes.rb
  49. +1 −0 spec/ruby/core/kernel/open_spec.rb
  50. +16 −0 spec/ruby/core/kernel/rand_spec.rb
  51. +17 −7 spec/ruby/core/kernel/system_spec.rb
  52. +10 −11 spec/ruby/core/kernel/test_spec.rb
  53. +0 −1 spec/ruby/core/math/frexp_spec.rb
  54. +6 −3 spec/ruby/core/math/gamma_spec.rb
  55. +6 −0 spec/ruby/core/math/lgamma_spec.rb
  56. +15 −0 spec/ruby/core/method/arity_spec.rb
  57. +3 −0 spec/ruby/core/method/fixtures/classes.rb
  58. +10 −0 spec/ruby/core/method/parameters_spec.rb
  59. +33 −5 spec/ruby/core/module/ancestors_spec.rb
  60. +4 −0 spec/ruby/core/module/case_compare_spec.rb
  61. +31 −0 spec/ruby/core/module/fixtures/classes.rb
  62. +5 −0 spec/ruby/core/module/included_spec.rb
  63. +409 −0 spec/ruby/core/numeric/shared/step.rb
  64. +91 −345 spec/ruby/core/numeric/step_spec.rb
  65. +102 −91 spec/ruby/core/process/kill_spec.rb
  66. +13 −15 spec/ruby/core/process/maxgroups_spec.rb
  67. +4 −0 spec/ruby/core/regexp/shared/new_ascii.rb
  68. +73 −72 spec/ruby/core/signal/trap_spec.rb
  69. +8 −0 spec/ruby/core/string/sub_spec.rb
  70. +7 −5 spec/ruby/core/time/getlocal_spec.rb
  71. +9 −7 spec/ruby/core/time/localtime_spec.rb
  72. +22 −20 spec/ruby/core/time/shared/gmt_offset.rb
  73. +18 −14 spec/ruby/core/time/shared/local.rb
  74. +6 −4 spec/ruby/core/time/to_a_spec.rb
  75. +12 −8 spec/ruby/core/time/zone_spec.rb
  76. +20 −12 spec/ruby/language/def_spec.rb
  77. +58 −0 spec/ruby/language/fixtures/super.rb
  78. +58 −0 spec/ruby/language/method_spec.rb
  79. +1 −1 spec/ruby/language/optional_assignments_spec.rb
  80. +1 −1 spec/ruby/language/predefined_spec.rb
  81. +18 −14 spec/ruby/language/string_spec.rb
  82. +24 −0 spec/ruby/language/super_spec.rb
  83. +5 −1 spec/ruby/library/coverage/fixtures/spec_helper.rb
  84. +2 −11 spec/ruby/library/coverage/result_spec.rb
  85. +0 −14 spec/ruby/library/erb/filename_spec.rb
  86. +8 −7 spec/ruby/library/etc/group_spec.rb
  87. +44 −42 spec/ruby/library/expect/expect_spec.rb
  88. +40 −0 spec/ruby/library/pathname/join_spec.rb
  89. +10 −1 spec/ruby/library/pathname/new_spec.rb
  90. +51 −0 spec/ruby/library/pathname/relative_path_from_spec.rb
  91. +8 −11 spec/ruby/library/resolv/get_address_spec.rb
  92. +7 −15 spec/ruby/library/resolv/get_addresses_spec.rb
  93. +7 −9 spec/ruby/library/resolv/get_name_spec.rb
  94. +7 −13 spec/ruby/library/resolv/get_names_spec.rb
  95. +1 −1 spec/ruby/library/socket/basicsocket/send_spec.rb
  96. +9 −3 spec/ruby/library/socket/constants/constants_spec.rb
  97. +1 −1 spec/ruby/library/socket/shared/pack_sockaddr.rb
  98. +14 −3 spec/ruby/library/socket/shared/recv_nonblock.rb
  99. +1 −1 spec/ruby/library/socket/shared/socketpair.rb
  100. +10 −5 spec/ruby/library/socket/socket/accept_nonblock_spec.rb
  101. +1 −1 spec/ruby/library/socket/socket/getaddrinfo_spec.rb
  102. +2 −2 spec/ruby/library/socket/socket/socket_spec.rb
  103. +5 −3 spec/ruby/library/socket/socket/unpack_sockaddr_in_spec.rb
  104. +3 −1 spec/ruby/library/socket/tcpserver/accept_nonblock_spec.rb
  105. +5 −3 spec/ruby/library/socket/tcpserver/new_spec.rb
  106. +6 −4 spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb
  107. +1 −1 spec/ruby/library/socket/udpsocket/send_spec.rb
  108. +15 −13 spec/ruby/library/socket/unixserver/for_fd_spec.rb
  109. +4 −3 spec/ruby/library/tmpdir/dir/mktmpdir_spec.rb
  110. +0 −17 spec/ruby/optional/capi/ext/array_spec.c
  111. +0 −3 spec/ruby/optional/capi/ext/jruby.h
  112. +0 −10 spec/ruby/optional/capi/ext/mri.h
  113. +1 −8 spec/ruby/optional/capi/ext/rubyspec.h
  114. +0 −95 spec/ruby/optional/capi/ext/string_spec.c
  115. +9 −11 spec/ruby/optional/capi/object_spec.rb
  116. +1 −1 spec/ruby/optional/capi/proc_spec.rb
  117. +10 −16 spec/ruby/optional/capi/spec_helper.rb
  118. +0 −42 spec/ruby/optional/capi/string_spec.rb
  119. +5 −7 spec/ruby/optional/capi/thread_spec.rb
  120. +5 −3 spec/ruby/shared/file/directory.rb
  121. +2 −2 spec/ruby/shared/file/sticky.rb
  122. +15 −14 spec/ruby/shared/file/world_readable.rb
  123. +30 −29 spec/ruby/shared/file/world_writable.rb
  124. +99 −40 spec/ruby/shared/process/exec.rb
  125. +4 −1 spec/ruby/shared/process/fork.rb
  126. +102 −49 spec/ruby/shared/process/spawn.rb
8 changes: 5 additions & 3 deletions spec/ruby/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Gemfile.lock
rubyspec_temp
spec/rubyspec/optional/capi/ext
/Gemfile.lock
/rubyspec_temp
/ext
/.ruby-version
/.ruby-gemset
4 changes: 4 additions & 0 deletions spec/ruby/.travis.yml
Original file line number Diff line number Diff line change
@@ -13,3 +13,7 @@ branches:
only:
- master
- /^try/
notifications:
email:
on_success: change
on_failure: change
10 changes: 5 additions & 5 deletions spec/ruby/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Contributions are much appreciated.
Please open a pull request or add an issue to discuss what you intend to work on.
Contributions are much appreciated.
Please open a pull request or add an issue to discuss what you intend to work on.
If the pull requests passes the CI and conforms to the existing style of specs, it will be merged.

### File organization
@@ -37,7 +37,7 @@ Specify `core` or `library` as the `base`.

#### Finding unspecified core methods

This is very easy, just run the command below in your `spec` directory.
This is very easy, just run the command below in your `spec` directory.
`ruby` must be a recent version of MRI.

$ ruby --disable-gem ../mspec/bin/mkspec
@@ -54,9 +54,9 @@ Different guards are available as defined by mspec.
In general, the usage of guards should be minimized as possible.

The following guards are deprecated and should not be used in new code:
* `not_compliant_on`: Simply tag the spec as failing instead.
* `not_compliant_on`: Simply tag the spec as failing instead.
If it makes sense to test part of the example, split it (an example should have only one or a few `should`).
* `compliant_on` / `deviates_on`: The Ruby Spec Suite defines common behavior and not implementation details.
* `compliant_on` / `deviates_on`: The Ruby Spec Suite defines common behavior and not implementation details.
Use the implementation test suite for these.

### Style
5 changes: 3 additions & 2 deletions spec/ruby/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# The Ruby Spec Suite

[![Build Status](https://travis-ci.org/ruby/spec.svg)](https://travis-ci.org/ruby/spec)
[![Build Status](https://ci.appveyor.com/api/projects/status/4hkpsv1570cb9y3r?svg=true)](https://ci.appveyor.com/project/eregon/spec)

The Ruby Spec Suite is a test suite for the behavior of the Ruby programming language.

@@ -42,7 +43,7 @@ This will execute all the specs using the executable named `ruby` on your curren

### Running Specs with a Specific Ruby Implementation

Use the `-t` option to specify the Ruby implementation with which to run the specs.
Use the `-t` option to specify the Ruby implementation with which to run the specs.
The argument may be a full path to the Ruby binary.

$ ../mspec/bin/mspec -t /path/to/some/bin/ruby
@@ -57,7 +58,7 @@ You can also pass a directory, in which case all specs in that directories will

$ ../mspec/bin/mspec core/kernel

Finally, you can also run them per group as defined in `default.mspec`.
Finally, you can also run them per group as defined in `default.mspec`.
The following command will run all language specs:

$ ../mspec/bin/mspec :language
28 changes: 15 additions & 13 deletions spec/ruby/command_line/frozen_strings_spec.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
require File.expand_path('../../spec_helper', __FILE__)

describe "The --enable-frozen-string-literal flag causes string literals to" do
ruby_version_is "2.3" do
describe "The --enable-frozen-string-literal flag causes string literals to" do

it "produce the same object each time" do
ruby_exe(fixture(__FILE__, "freeze_flag_one_literal.rb"), options: "--enable-frozen-string-literal").chomp.should == "true"
end
it "produce the same object each time" do
ruby_exe(fixture(__FILE__, "freeze_flag_one_literal.rb"), options: "--enable-frozen-string-literal").chomp.should == "true"
end

it "produce the same object for literals with the same content" do
ruby_exe(fixture(__FILE__, "freeze_flag_two_literals.rb"), options: "--enable-frozen-string-literal").chomp.should == "true"
end
it "produce the same object for literals with the same content" do
ruby_exe(fixture(__FILE__, "freeze_flag_two_literals.rb"), options: "--enable-frozen-string-literal").chomp.should == "true"
end

it "produce the same object for literals with the same content in different files" do
ruby_exe(fixture(__FILE__, "freeze_flag_across_files.rb"), options: "--enable-frozen-string-literal").chomp.should == "true"
end
it "produce the same object for literals with the same content in different files" do
ruby_exe(fixture(__FILE__, "freeze_flag_across_files.rb"), options: "--enable-frozen-string-literal").chomp.should == "true"
end

it "produce different objects for literals with the same content in different files if they have different encodings" do
ruby_exe(fixture(__FILE__, "freeze_flag_across_files_diff_enc.rb"), options: "--enable-frozen-string-literal").chomp.should == "true"
end
it "produce different objects for literals with the same content in different files if they have different encodings" do
ruby_exe(fixture(__FILE__, "freeze_flag_across_files_diff_enc.rb"), options: "--enable-frozen-string-literal").chomp.should == "true"
end

end
end
26 changes: 5 additions & 21 deletions spec/ruby/core/array/fill_spec.rb
Original file line number Diff line number Diff line change
@@ -205,27 +205,11 @@
lambda { [].fill('a', obj) }.should raise_error(TypeError)
end

not_compliant_on :rubinius do
platform_is wordsize: 32 do
it "raises an ArgumentError or RangeError for too-large sizes" do
arr = [1, 2, 3]
lambda { arr.fill(10, 1, 2**31 - 1) }.should raise_error(ArgumentError)
lambda { arr.fill(10, 1, 2**31) }.should raise_error(RangeError)
end
end

platform_is wordsize: 64 do
it "raises an ArgumentError or RangeError for too-large sizes" do
arr = [1, 2, 3]
lambda { arr.fill(10, 1, 2**63 - 1) }.should raise_error(ArgumentError)
lambda { arr.fill(10, 1, 2**63) }.should raise_error(RangeError)
end
end
end

deviates_on :rubinius do
it "raises an ArgumentError if the length is not a Fixnum" do
lambda { [1, 2].fill(10, 1, bignum_value) }.should raise_error(ArgumentError)
not_supported_on :opal do
it "raises an ArgumentError or RangeError for too-large sizes" do
arr = [1, 2, 3]
lambda { arr.fill(10, 1, fixnum_max) }.should raise_error(ArgumentError)
lambda { arr.fill(10, 1, bignum_value) }.should raise_error(RangeError)
end
end
end
25 changes: 25 additions & 0 deletions spec/ruby/core/class/to_s_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

describe "Class#to_s" do
it 'regular class returns same name as Module#to_s' do
String.to_s.should == 'String'
end

describe 'singleton class' do
it 'for modules includes module name' do
CoreClassSpecs.singleton_class.to_s.should == '#<Class:CoreClassSpecs>'
end

it 'for classes includes class name' do
CoreClassSpecs::Record.singleton_class.to_s.should == '#<Class:CoreClassSpecs::Record>'
end

it 'for objects includes class name and object ID' do
from_class = CoreClassSpecs::Record.singleton_class.to_s

obj = CoreClassSpecs::Record.new
obj.singleton_class.to_s.should =~ /#<Class:#<CoreClassSpecs::Record:0x[0-9a-f]+>>/
end
end
end
24 changes: 8 additions & 16 deletions spec/ruby/core/dir/shared/pwd.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
describe :dir_pwd, shared: true do
with_feature :encoding do
before :each do
@external = Encoding.default_external
@internal = Encoding.default_internal

Encoding.default_external = Encoding::IBM437
end

after :each do
Encoding.default_external = @external
Encoding.default_internal = @internal
@fs_encoding = Encoding.find('filesystem')
end
end

@@ -28,13 +20,13 @@
end

with_feature :encoding do
it "returns a String with Encoding.default_external encoding" do
Dir.send(@method).encoding.should equal(Encoding::IBM437)
end

it "does not transcode to Encoding.default_internal" do
Encoding.default_internal = Encoding::EUC_JP
Dir.send(@method).encoding.should equal(Encoding::IBM437)
it "returns a String with the filesystem encoding" do
enc = Dir.send(@method).encoding
if @fs_encoding == Encoding::US_ASCII
[Encoding::US_ASCII, Encoding::ASCII_8BIT].should include(enc)
else
enc.should equal(@fs_encoding)
end
end
end
end
11 changes: 1 addition & 10 deletions spec/ruby/core/encoding/default_external_spec.rb
Original file line number Diff line number Diff line change
@@ -20,18 +20,9 @@
end

describe "with command line options" do
before :each do
@lc_all = ENV["LC_ALL"]
ENV["LC_ALL"] = "C"
end

after :each do
ENV["LC_ALL"] = @lc_all
end

it "is not changed by the -U option" do
result = ruby_exe("print Encoding.default_external", options: '-U')
result.should == "US-ASCII"
result.should == Encoding.default_external.name
end

it "returns the encoding specified by '-E external'" do
12 changes: 6 additions & 6 deletions spec/ruby/core/enumerable/slice_when_spec.rb
Original file line number Diff line number Diff line change
@@ -34,14 +34,14 @@
lambda { @enum.slice_when }.should raise_error(ArgumentError)
end
end
end

describe "when an iterator method yields more than one value" do
it "processes all yielded values" do
def foo
yield 1, 2
describe "when an iterator method yields more than one value" do
it "processes all yielded values" do
def foo
yield 1, 2
end
to_enum(:foo).slice_when { true }.to_a.should == [[[1, 2]]]
end
to_enum(:foo).slice_when { true }.to_a.should == [[[1, 2]]]
end
end
end
7 changes: 6 additions & 1 deletion spec/ruby/core/exception/system_call_error_spec.rb
Original file line number Diff line number Diff line change
@@ -74,7 +74,12 @@ def initialize

describe "SystemCallError#message" do
it "returns the default message when no message is given" do
SystemCallError.new(2**28).message.should =~ /Unknown error/i
platform_is :aix do
SystemCallError.new(2**28).message.should =~ /Error .*occurred/i
end
platform_is_not :aix do
SystemCallError.new(2**28).message.should =~ /Unknown error/i
end
end

it "returns the message given as an argument to new" do
10 changes: 6 additions & 4 deletions spec/ruby/core/file/chown_spec.rb
Original file line number Diff line number Diff line change
@@ -64,10 +64,12 @@
File.chown(nil, nil, @fname, @fname).should == 2
end

it "raises an error for a non existent path" do
lambda {
File.chown(nil, nil, "#{@fname}.not.existing")
}.should raise_error(Errno::ENOENT)
platform_is_not :windows do
it "raises an error for a non existent path" do
lambda {
File.chown(nil, nil, "#{@fname}_not_existing")
}.should raise_error(Errno::ENOENT)
end
end

it "accepts an object that has a #to_path method" do
16 changes: 10 additions & 6 deletions spec/ruby/core/file/expand_path_spec.rb
Original file line number Diff line number Diff line change
@@ -181,18 +181,22 @@
File.expand_path(weird_path).encoding.should equal(Encoding::ASCII_8BIT)
end

it "expands a path when the default external encoding is ASCII-8BIT" do
Encoding.default_external = Encoding::ASCII_8BIT
File.expand_path("\xde\xad\xbe\xaf", "/").should == "/\xde\xad\xbe\xaf"
platform_is_not :windows do
it "expands a path when the default external encoding is ASCII-8BIT" do
Encoding.default_external = Encoding::ASCII_8BIT
File.expand_path("\xde\xad\xbe\xaf", @rootdir).should == "#{@rootdir}\xde\xad\xbe\xaf"
end
end

it "expands a path with multi-byte characters" do
File.expand_path("Ångström").should == "#{@base}/Ångström"
end

it "raises an Encoding::CompatibilityError if the external encoding is not compatible" do
Encoding.default_external = Encoding::UTF_16BE
lambda { File.expand_path("./a") }.should raise_error(Encoding::CompatibilityError)
platform_is_not :windows do
it "raises an Encoding::CompatibilityError if the external encoding is not compatible" do
Encoding.default_external = Encoding::UTF_16BE
lambda { File.expand_path("./a") }.should raise_error(Encoding::CompatibilityError)
end
end
end

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

describe "File.lchmod" do
platform_is_not os: [:linux, :windows, :openbsd, :solaris] do
platform_is_not os: [:linux, :windows, :openbsd, :solaris, :aix] do
before :each do
@fname = tmp('file_chmod_test')
@lname = @fname + '.lnk'
@@ -30,7 +30,7 @@
end
end

platform_is os: [:linux, :openbsd] do
platform_is os: [:linux, :openbsd, :aix] do
it "returns false from #respond_to?" do
File.respond_to?(:lchmod).should be_false
end
42 changes: 26 additions & 16 deletions spec/ruby/core/file/new_spec.rb
Original file line number Diff line number Diff line change
@@ -52,19 +52,22 @@
File.read(@file).should == "test\n"
end

it "opens the existing file, does not change permissions even when they are specified" do
File.chmod(0664, @file) # r-w perms
orig_perms = File.stat(@file).mode.to_s(8)
begin
f = File.new(@file, "w", 0444) # r-o perms, but they should be ignored
f.puts("test")
ensure
f.close
platform_is_not :windows do
it "opens the existing file, does not change permissions even when they are specified" do
File.chmod(0644, @file) # r-w perms
orig_perms = File.stat(@file).mode & 0777
begin
f = File.new(@file, "w", 0444) # r-o perms, but they should be ignored
f.puts("test")
ensure
f.close
end
perms = File.stat(@file).mode & 0777
perms.should == orig_perms

# it should be still possible to read from the file
File.read(@file).should == "test\n"
end
File.stat(@file).mode.to_s(8).should == orig_perms

# it should be still possible to read from the file
File.read(@file).should == "test\n"
end

it "returns a new File with modus fd" do
@@ -143,10 +146,17 @@
lambda { File.new(-1) }.should raise_error(Errno::EBADF)
end

it "can't alter mode or permissions when opening a file" do
@fh = File.new(@file)
lambda { File.new(@fh.fileno, @flags) }.should raise_error(Errno::EINVAL)
platform_is_not :windows do
it "can't alter mode or permissions when opening a file" do
@fh = File.new(@file)
lambda {
f = File.new(@fh.fileno, @flags)
f.autoclose = false
}.should raise_error(Errno::EINVAL)
end
end

it_behaves_like :open_directory, :new
platform_is_not :windows do
it_behaves_like :open_directory, :new
end
end
Loading