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

Commits on Mar 17, 2015

  1. [RubySpec] Remove our copy of spec/ruby, it will be replaced by a git…

    … submodule.
    
    * Encourages contributions upstream.
    * Easier to stay up-to-date.
    * Changes in the copy have been integrated in ruby/rubyspec.
    eregon committed Mar 17, 2015

    Verified

    This commit was signed with the committer’s verified signature.
    headius Charles Oliver Nutter
    Copy the full SHA
    218e1ba View commit details
  2. Copy the full SHA
    2e8fa85 View commit details
  3. Squashed 'spec/mspec/' content from commit 48dbdc3

    git-subtree-dir: spec/mspec
    git-subtree-split: 48dbdc3df676588459386b9fa5933fb3d3572b01
    eregon committed Mar 17, 2015
    Copy the full SHA
    815450e View commit details
  4. Copy the full SHA
    b584cce View commit details
  5. Squashed 'spec/ruby/' content from commit 0c3c64b

    git-subtree-dir: spec/ruby
    git-subtree-split: 0c3c64b3380d71806d6642d4ab3989c6c10a8d8f
    eregon committed Mar 17, 2015
    Copy the full SHA
    7a851ad View commit details
  6. Copy the full SHA
    247bba3 View commit details
Showing 2,375 changed files with 56,637 additions and 3,645 deletions.
26 changes: 26 additions & 0 deletions spec/mspec/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pkg
*.rbc
*.iml
*.iws
*.ipr
*.sw?

.rbx

# ctags dir
/tags

*.gem
.bundle
.config
.yardoc
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
20 changes: 20 additions & 0 deletions spec/mspec/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: ruby
script:
- bundle exec rspec
jdk:
- openjdk7
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1.5
- 2.2.1
- ruby-head
- rbx-2
- jruby-1.7
- jruby-head
matrix:
allow_failures:
- rvm: rbx-2
- rvm: jruby-1.7
- rvm: jruby-head
27 changes: 27 additions & 0 deletions spec/mspec/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
PATH
remote: .
specs:
mspec (1.8.0)

GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.5)
rake (10.4.2)
rspec (2.99.0)
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.99.3)

PLATFORMS
java
ruby

DEPENDENCIES
mspec!
rake (~> 10.0)
rspec (~> 2.8)
35 changes: 23 additions & 12 deletions spec/mspec/README → spec/mspec/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
1. Overview
[![Build Status](https://travis-ci.org/ruby/mspec.svg?branch=master)](https://travis-ci.org/ruby/mspec)

## Overview

MSpec is a specialized framework that is syntax-compatible with RSpec for
basic things like 'describe', 'it' blocks and 'before', 'after' actions. MSpec
@@ -32,46 +34,55 @@ specs in a manner compatible with multiple Ruby implementations.
overrides.


2. Bundler
## Bundler

A Gemfile is provided. Use Bundler to install gem dependencies. To install
Bundler, run the following:

$ gem install bundler
```bash
gem install bundler
```

To install the gem dependencies with Bundler, run the following:

$ RUBYLIB=lib ruby -S bundle install

```bash
ruby -S bundle install
```

3. Running Specs
## Running Specs

Use RSpec to run the MSpec specs. There are no plans currently to make the
MSpec specs runnable by MSpec.

After installing the gem dependencies, the specs can be run as follows:

$ ruby -S rspec
```bash
ruby -S bundle exec rspec
```

Or

$ ruby -S rake
```bash
ruby -S rake
```

To run an individual spec file, use the following example:

$ ruby -S rspec spec/helpers/ruby_exe_spec.rb
```bash
ruby -S bundle exec rspec spec/helpers/ruby_exe_spec.rb
```


4. Documentation
## Documentation

See http://rubyspec.org


5. Source Code
## Source Code

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


6. License
## License

See the LICENSE in the source code.
2 changes: 0 additions & 2 deletions spec/mspec/lib/mspec/commands/mspec-ci.rb
Original file line number Diff line number Diff line change
@@ -64,8 +64,6 @@ def options(argv=ARGV)
end

def run
MSpec.register_mode :no_ruby_bug

MSpec.register_tags_patterns config[:tags_patterns]
MSpec.register_files @files

2 changes: 0 additions & 2 deletions spec/mspec/lib/mspec/commands/mspec-run.rb
Original file line number Diff line number Diff line change
@@ -86,8 +86,6 @@ def options(argv=ARGV)
end

def run
MSpec.register_mode :no_ruby_bug

MSpec.register_tags_patterns config[:tags_patterns]
MSpec.register_files @files

2 changes: 0 additions & 2 deletions spec/mspec/lib/mspec/commands/mspec-tag.rb
Original file line number Diff line number Diff line change
@@ -121,8 +121,6 @@ def register
end

def run
MSpec.register_mode :no_ruby_bug

MSpec.register_tags_patterns config[:tags_patterns]
MSpec.register_files @files

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

options.targets

options.on("-D", "--gdb", "Run under gdb") do
config[:use_gdb] = true
end

options.on("-A", "--valgrind", "Run under valgrind") do
config[:use_valgrind] = true
end
@@ -162,12 +158,8 @@ def run
else
if config[:use_valgrind]
more = ["--child-silent-after-fork=yes",
"--db-attach=#{config[:use_gdb] ? 'yes' : 'no'}",
config[:target]] + argv
exec "valgrind", *more
elsif config[:use_gdb]
more = ["--args", config[:target]] + argv
exec "gdb", *more
else
cmd, *rest = config[:target].split(/\s+/)
argv = rest + argv unless rest.empty?
2 changes: 1 addition & 1 deletion spec/mspec/lib/mspec/guards/block_device.rb
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

class BlockDeviceGuard < SpecGuard
def match?
platform_is_not :freebsd, :windows do
platform_is_not :freebsd, :windows, :opal do
block = `find /dev /devices -type b 2> /dev/null`
return !(block.nil? || block.empty?)
end
4 changes: 4 additions & 0 deletions spec/mspec/lib/mspec/guards/platform.rb
Original file line number Diff line number Diff line change
@@ -5,6 +5,10 @@ def self.windows?
PlatformGuard.new(:os => :windows).match?
end

def self.opal?
PlatformGuard.new(:opal)
end

def initialize(*args)
if args.last.is_a?(Hash)
@options, @platforms = args.last, args[0..-2]
23 changes: 23 additions & 0 deletions spec/mspec/lib/mspec/helpers/datetime.rb
Original file line number Diff line number Diff line change
@@ -25,4 +25,27 @@ def new_datetime(opts={})
DateTime.new value[:year], value[:month], value[:day], value[:hour],
value[:minute], value[:second], value[:offset], value[:sg]
end

def with_timezone(name, offset = nil, daylight_saving_zone = "")
zone = name.dup

if offset
# TZ convention is backwards
offset = -offset

zone += offset.to_s
zone += ":00:00"
end
zone += daylight_saving_zone

old = ENV["TZ"]
ENV["TZ"] = zone

begin
yield
ensure
ENV["TZ"] = old
end
end

end
25 changes: 15 additions & 10 deletions spec/mspec/lib/mspec/helpers/environment.rb
Original file line number Diff line number Diff line change
@@ -2,27 +2,29 @@

class Object
def env
env = ""
if PlatformGuard.windows?
env = Hash[*`cmd.exe /C set`.split("\n").map { |e| e.split("=", 2) }.flatten]
Hash[*`cmd.exe /C set`.split("\n").map { |e| e.split("=", 2) }.flatten]
elsif PlatformGuard.opal?
{}
else
env = Hash[*`env`.split("\n").map { |e| e.split("=", 2) }.flatten]
Hash[*`env`.split("\n").map { |e| e.split("=", 2) }.flatten]
end
env
end

def windows_env_echo(var)
`cmd.exe /C ECHO %#{var}%`.strip
platform_is_not :opal do
`cmd.exe /C ECHO %#{var}%`.strip
end
end

def username
user = ""
if PlatformGuard.windows?
user = windows_env_echo('USERNAME')
windows_env_echo('USERNAME')
elsif PlatformGuard.opal?
""
else
user = `whoami`.strip
`whoami`.strip
end
user
end

def home_directory
@@ -41,7 +43,10 @@ def dev_null
def hostname
commands = ['hostname', 'uname -n']
commands.each do |command|
name = `#{command}`
name = ''
platform_is_not :opal do
name = `#{command}`
end
return name.strip if $?.success?
end
raise Exception, "hostname: unable to find a working command"
37 changes: 36 additions & 1 deletion spec/mspec/lib/mspec/helpers/io.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
require 'mspec/guards/feature'

class IOStub < String
class IOStub
def initialize
@buffer = []
@output = ''
end

def write(*str)
self << str.join
end

def << str
@buffer << str
self
end

def print(*str)
write(str.join + $\.to_s)
end

def method_missing(name, *args, &block)
to_s.send(name, *args, &block)
end

def == other
to_s == other
end

def =~ other
to_s =~ other
end

def puts(*str)
if str.empty?
write "\n"
@@ -22,8 +44,21 @@ def printf(format, *args)
end

def flush
@output += @buffer.join('')
@buffer.clear
self
end

def to_s
flush
@output
end

alias_method :to_str, :to_s

def inspect
to_s.inspect
end
end

class Object
3 changes: 2 additions & 1 deletion spec/mspec/lib/mspec/helpers/mock_to_path.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Object
def mock_to_path(path)
obj = mock('path')
# Cannot use our Object#mock here since it conflicts with RSpec
obj = MockObject.new('path')
obj.should_receive(:to_path).and_return(path)
obj
end
2 changes: 1 addition & 1 deletion spec/mspec/lib/mspec/helpers/numeric.rb
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ def bignum_value(plus=0)
# values.
guard = SpecGuard.new

if guard.standard? or guard.implementation? :topaz
if guard.standard? or guard.implementation? :topaz or guard.implementation? :opal
if guard.wordsize? 32
def fixnum_max()
(2**30) - 1
Loading