Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@e27aee156d42e38ff8a4c2fc97b125c4087cbcc7
uses: ruby/setup-ruby@a2b2637a7c796d83d566fc82853156d4372b0f60
with:
ruby-version: 2.6.6
ruby-version: 3.0.2
bundler-cache: true

- name: Install gems
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:

# Setup Ruby - this needs to match the version in the Gemfile
- name: Set up Ruby
uses: ruby/setup-ruby@e27aee156d42e38ff8a4c2fc97b125c4087cbcc7
uses: ruby/setup-ruby@a2b2637a7c796d83d566fc82853156d4372b0f60
with:
ruby-version: 2.6.6
ruby-version: 3.0.2
bundler-cache: true

# Setup code climate
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.6.6
ruby-3.0.2
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.5-alpine
FROM ruby:3.0.2-alpine

RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh && \
Expand All @@ -10,7 +10,7 @@ RUN wget -P /usr/local/bin https://github.com/exercism/tooling-webserver/release
WORKDIR /opt/test-runner

COPY Gemfile Gemfile.lock ./
RUN gem install bundler:2.1.4 && \
RUN gem install bundler:2.2.29 && \
bundle config set without 'development test' && \
bundle install

Expand Down
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ git_source(:github) do |repo_name|
"https://github.com/#{repo_name}.git"
end

gem 'mandate'
ruby '3.0.2'

gem "mandate", "~> 1.0.0"
gem 'rake'
gem 'json'
gem 'json', '~> 2.6.1'
gem 'minitest', '~> 5.11.3'

gem 'parser'
Expand Down
17 changes: 10 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.4.1)
ast (2.4.2)
coderay (1.1.3)
docile (1.3.2)
json (2.2.0)
mandate (0.3.0)
json (2.6.1)
mandate (1.0.0)
method_source (1.0.0)
minitest (5.11.3)
mocha (1.11.2)
parallel (1.19.2)
parser (2.7.1.4)
parser (3.0.2.0)
ast (~> 2.4.1)
pry (0.13.1)
coderay (~> 1.1)
Expand Down Expand Up @@ -46,8 +46,8 @@ PLATFORMS
ruby

DEPENDENCIES
json
mandate
json (~> 2.6.1)
mandate (~> 1.0.0)
minitest (~> 5.11.3)
mocha
parser
Expand All @@ -59,5 +59,8 @@ DEPENDENCIES
rubocop-performance
simplecov (~> 0.17.0)

RUBY VERSION
ruby 3.0.2p107

BUNDLED WITH
2.1.4
2.2.29
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ For example:
Before running the tests, first install the dependencies:

```bash
bundle config set --local with 'test'
bundle install
```

Then, run the following command to run the tests:
Then, in [test/test_helper.rb](test/test_helper.rb),
comment the "Production command" `system(…)` out
and uncomment either of the "Testing commands".

Lastly, run the following command to run the tests:

```bash
bundle exec rake test
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/pass_ruby_3_syntax/input/ruby_3_syntax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See section "Other Notable New Features"
# in https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/
class Ruby3Syntax
def self.rightward_assign
'is fun' => exercism
return exercism
end

def self.endless_methods = 'are fun'
end
14 changes: 14 additions & 0 deletions test/fixtures/pass_ruby_3_syntax/input/ruby_3_syntax_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'minitest/autorun'
require_relative 'ruby_3_syntax'

# minimal set of:
# Common test data version: 1.6.0 42b9d45
class Ruby3SyntaxTest < Minitest::Test
def test_rightward_assign
assert_equal Ruby3Syntax.rightward_assign, 'is fun'
end

def test_endless_method_def
assert_equal Ruby3Syntax.endless_methods, 'are fun'
end
end
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def run_test_runner(input_dir, output_dir)
# exec("bin/run.sh two_fer #{input_dir} #{output_dir}")
# system("bin/run.sh two_fer #{input_dir} #{output_dir}")

# Main command
# Production command
system("bin/run.sh two_fer #{input_dir} #{output_dir}", out: "/dev/null", err: "/dev/null")
end
end
27 changes: 25 additions & 2 deletions test/test_runner_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,29 @@ def test_pass
)
end

def test_pass_ruby_3
assert_fixture(
:pass_ruby_3_syntax,
{
version: 2,
status: :pass,
message: nil,
tests: [
{
name: "Rightward assign",
status: :pass,
test_code: %(assert_equal Ruby3Syntax.rightward_assign, 'is fun')
},
{
name: "Endless method def",
status: :pass,
test_code: %(assert_equal Ruby3Syntax.endless_methods, 'are fun')
}
]
}
)
end

def test_fail
assert_fixture(
:fail, {
Expand Down Expand Up @@ -108,7 +131,7 @@ def test_syntax_errors_in_tests
,'This is meant to be a syntax...
^
SYNTAX_ERRORS
assert_equal expected.strip, actual['message']
assert_equal expected, actual['message']

assert_test_run_exited_cleanly
end
Expand All @@ -124,7 +147,7 @@ def test_syntax_errors_in_code
end,A stray comma
^
SYNTAX_ERRORS
assert_equal expected.strip, actual['message']
assert_equal expected, actual['message']

assert_test_run_exited_cleanly
end
Expand Down