From 810b9c344a40802d7736282d86e51d48e8b336a4 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sun, 17 Apr 2022 21:53:43 -0700 Subject: Resolve several markedown warnings - Spaces before and after blocks. - Single spaces after sentences everywhere Signed-off-by: Tim Smith --- spec/README.md | 12 +++++++++++- spec/ruby/CONTRIBUTING.md | 14 ++++++++------ spec/ruby/README.md | 2 ++ 3 files changed, 21 insertions(+), 7 deletions(-) (limited to 'spec') diff --git a/spec/README.md b/spec/README.md index 413b9154c9..6b82f8f06a 100644 --- a/spec/README.md +++ b/spec/README.md @@ -5,6 +5,7 @@ spec/bundler is rspec examples for bundler library (`lib/bundler.rb`, `lib/bundl ## Running spec/bundler To run rspec for bundler: + ```bash make test-bundler ``` @@ -37,6 +38,7 @@ which change behavior or are removed. This is necessary for other Ruby implement to still be able to run the specs and contribute new specs. For example, change: + ```ruby describe "Some spec" do it "some example" do @@ -44,7 +46,9 @@ describe "Some spec" do end end ``` + to: + ```ruby describe "Some spec" do ruby_version_is ""..."2.7" do @@ -64,7 +68,8 @@ end See `spec/ruby/CONTRIBUTING.md` for more documentation about guards. To verify specs are compatible with older Ruby versions: -``` + +```bash cd spec/ruby $RUBY_MANAGER use 2.4.9 ../mspec/bin/mspec -j @@ -73,28 +78,33 @@ $RUBY_MANAGER use 2.4.9 ## Running ruby/spec To run all specs: + ```bash make test-spec ``` Extra arguments can be added via `MSPECOPT`. For instance, to show the help: + ```bash make test-spec MSPECOPT=-h ``` You can also run the specs in parallel, which is currently experimental. It takes around 10s instead of 60s on a quad-core laptop. + ```bash make test-spec MSPECOPT=-j ``` To run a specific test, add its path to the command: + ```bash make test-spec MSPECOPT=spec/ruby/language/for_spec.rb ``` If ruby trunk is your current `ruby` in `$PATH`, you can also run `mspec` directly: + ```bash # change ruby to trunk ruby -v # => trunk diff --git a/spec/ruby/CONTRIBUTING.md b/spec/ruby/CONTRIBUTING.md index 30941677e0..de6fccbd7e 100644 --- a/spec/ruby/CONTRIBUTING.md +++ b/spec/ruby/CONTRIBUTING.md @@ -13,12 +13,14 @@ Spec are grouped in 5 separate top-level groups: * `optional/capi`: for functions available to the Ruby C-extension API The exact file for methods is decided by the `#owner` of a method, for instance for `#group_by`: + ```ruby > [].method(:group_by) => # > [].method(:group_by).owner => Enumerable ``` + Which should therefore be specified in `core/enumerable/group_by_spec.rb`. ### MkSpec - a tool to generate the spec structure @@ -220,7 +222,7 @@ If an implementation does not support some feature, simply tag the related specs ### Shared Specs Often throughout Ruby, identical functionality is used by different methods and modules. In order -to avoid duplication of specs, we have shared specs that are re-used in other specs. The use is a +to avoid duplication of specs, we have shared specs that are re-used in other specs. The use is a bit tricky however, so let's go over it. Commonly, if a shared spec is only reused within its own module, the shared spec will live within a @@ -232,7 +234,7 @@ An example of this is the `shared/file/socket.rb` which is used by `core/file/so `core/filetest/socket_spec.rb`, and `core/file/state/socket_spec.rb` and so it lives in the root `shared/`. Defining a shared spec involves adding a `shared: true` option to the top-level `describe` block. This -will signal not to run the specs directly by the runner. Shared specs have access to two instance +will signal not to run the specs directly by the runner. Shared specs have access to two instance variables from the implementor spec: `@method` and `@object`, which the implementor spec will pass in. Here's an example of a snippet of a shared spec and two specs which integrates it: @@ -257,12 +259,12 @@ end ``` In the example, the first `describe` defines the shared spec `:hash_key_p`, which defines a spec that -calls the `@method` method with an expectation. In the implementor spec, we use `it_behaves_like` to -integrate the shared spec. `it_behaves_like` takes 3 parameters: the key of the shared spec, a method, -and an object. These last two parameters are accessible via `@method` and `@object` in the shared spec. +calls the `@method` method with an expectation. In the implementor spec, we use `it_behaves_like` to +integrate the shared spec. `it_behaves_like` takes 3 parameters: the key of the shared spec, a method, +and an object. These last two parameters are accessible via `@method` and `@object` in the shared spec. Sometimes, shared specs require more context from the implementor class than a simple object. We can address -this by passing a lambda as the method, which will have the scope of the implementor. Here's an example of +this by passing a lambda as the method, which will have the scope of the implementor. Here's an example of how this is used currently: ```ruby diff --git a/spec/ruby/README.md b/spec/ruby/README.md index df98723c9b..6f6b75f6a7 100644 --- a/spec/ruby/README.md +++ b/spec/ruby/README.md @@ -24,6 +24,7 @@ The specs describe the [language syntax](language/), the [core library](core/), The language specs are grouped by keyword while the core and standard library specs are grouped by class and method. ruby/spec is known to be tested in these implementations for every commit: + * [MRI](https://rubyci.org/) on 30 platforms and 4 versions * [JRuby](https://github.com/jruby/jruby/tree/master/spec/ruby) for both 1.7 and 9.x * [TruffleRuby](https://github.com/oracle/truffleruby/tree/master/spec/ruby) @@ -53,6 +54,7 @@ $ ../mspec/bin/mspec ### Specs for old Ruby versions For older specs try these commits: + * Ruby 2.0.0-p647 - [Suite](https://github.com/ruby/spec/commit/245862558761d5abc676843ef74f86c9bcc8ea8d) using [MSpec](https://github.com/ruby/mspec/commit/f90efa068791064f955de7a843e96e2d7d3041c2) (may encounter 2 failures) * Ruby 2.1.9 - [Suite](https://github.com/ruby/spec/commit/f029e65241374386077ac500add557ae65069b55) using [MSpec](https://github.com/ruby/mspec/commit/55568ea3918c6380e64db8c567d732fa5781efed) * Ruby 2.2.10 - [Suite](https://github.com/ruby/spec/commit/cbaa0e412270c944df0c2532fc500c920dba0e92) using [MSpec](https://github.com/ruby/mspec/commit/d84d7668449e96856c5f6bac8cb1526b6d357ce3) -- cgit v1.2.3