Skip to content

Commit

Permalink
resolve conflicts after merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunk13 committed Apr 6, 2024
2 parents 4bfd0fb + 0696e50 commit ba9455f
Show file tree
Hide file tree
Showing 40 changed files with 97 additions and 51 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633

- name: Set up Ruby
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7
uses: ruby/setup-ruby@5f19ec79cedfadb78ab837f95b87734d0003c899
with:
ruby-version: .ruby-version
bundler-cache: true
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633

- name: Setup Ruby
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7
uses: ruby/setup-ruby@5f19ec79cedfadb78ab837f95b87734d0003c899
with:
ruby-version: .ruby-version
bundler-cache: true
Expand All @@ -35,15 +35,15 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20
with:
install: true

- name: Build Docker image and store in cache
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
context: .
push: false
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.2.2
ruby-3.3.0
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM ruby:3.2.2-alpine3.18 AS build
FROM ruby:3.3.0-alpine3.18 AS build

RUN apk update && apk upgrade && \
apk add --no-cache git openssh build-base gcc wget git

COPY Gemfile Gemfile.lock .

RUN gem install bundler:2.4.18 && \
RUN gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" && \
bundle config set without 'development test' && \
bundle install

FROM ruby:3.2.2-alpine3.18
FROM ruby:3.3.0-alpine3.18

RUN apk add --no-cache bash

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

ruby '3.2.2'
ruby '3.3.0'

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

Expand Down
50 changes: 27 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,55 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
base64 (0.1.1)
coderay (1.1.3)
docile (1.3.2)
json (2.6.1)
docile (1.4.0)
json (2.6.3)
language_server-protocol (3.17.0.3)
mandate (1.0.0)
method_source (1.0.0)
minitest (5.11.3)
mocha (1.11.2)
parallel (1.23.0)
parser (3.2.2.3)
mocha (2.1.0)
ruby2_keywords (>= 0.0.5)
mutex_m (0.2.0)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
pry (0.13.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.7.1)
racc (1.7.3)
rainbow (3.1.1)
rake (12.3.3)
regexp_parser (2.8.1)
rake (13.1.0)
regexp_parser (2.9.0)
rexml (3.2.6)
rubocop (1.56.0)
base64 (~> 0.1.1)
rubocop (1.61.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-minitest (0.10.1)
rubocop (>= 0.87)
rubocop-performance (1.8.0)
rubocop (>= 0.87.0)
rubocop-ast (1.31.1)
parser (>= 3.3.0.4)
rubocop-minitest (0.34.5)
rubocop (>= 1.39, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
unicode-display_width (2.4.2)
unicode-display_width (2.5.0)

PLATFORMS
ruby
Expand All @@ -57,6 +60,7 @@ DEPENDENCIES
mandate (~> 1.0.0)
minitest (~> 5.11.3)
mocha
mutex_m
parser
pry
rake
Expand All @@ -67,7 +71,7 @@ DEPENDENCIES
simplecov (~> 0.17.0)

RUBY VERSION
ruby 3.2.2p53
ruby 3.3.0p0

BUNDLED WITH
2.4.18
2.5.3
8 changes: 5 additions & 3 deletions lib/minitest_ext/exercism_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ def prerecord(*)
reset_user_output
end

def metadata=(metadata)
@metadata = metadata.each_with_object({}) do |md, hash|
def set_metadata(test_file, metadata)
@metadata[test_file] = metadata.each_with_object({}) do |md, hash|
hash[md[:test]] = md
end
end

def record(result)
tests << TestResult.new(result, user_output, metadata[result.name])
test_metadata = metadata[result.source_location.first][result.name]
tests << TestResult.new(result, user_output, test_metadata)
end

def report
Expand Down Expand Up @@ -64,6 +65,7 @@ def initialize(exercise, path)
@path = path
@tests = []
@report_written = false
@metadata = {}

reset_user_output
end
Expand Down
6 changes: 4 additions & 2 deletions lib/test_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ def run
Minitest::Test.use_order_dependent_tests!
Minitest::PrideIO.pride!

Dir.glob("#{input_path}/*_test.rb").sort.each do |test_file|
reporter.metadata = ExtractMetadata.(test_file)
Dir.glob(File.join(input_path, "*_test.rb")).sort.each do |test_file|
next if test_file.end_with?("_benchmark_test.rb")

reporter.set_metadata(test_file, ExtractMetadata.(test_file))

begin
require test_file
Expand Down
4 changes: 2 additions & 2 deletions test/test_runner_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_fail

def test_deep_exception
message = "
NoMethodError: undefined method `non_existant_method' for nil:NilClass
NoMethodError: undefined method `non_existant_method' for nil
Traceback (most recent call first):
Line 8:in `work_out_name'
Expand Down Expand Up @@ -124,7 +124,7 @@ def test_name_error_exception
actual = JSON.parse(File.read(output_dir / "results.json"))
assert_equal "error", actual["status"]

expected = "Line 3: undefined local variable or method `raise_an_error_because_i_am_a_random_method' for main:Object (NameError)"
expected = "Line 3: undefined local variable or method `raise_an_error_because_i_am_a_random_method' for main (NameError)"
assert_equal expected, actual['message']

assert_test_run_exited_cleanly
Expand Down
2 changes: 1 addition & 1 deletion tests/attack_large_output/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":3,"status":"pass","message":null,"tests":[]}
{"version":3,"status":"fail","message":null,"tests":[{"name":"No name given","test_code":"assert_equal \"One for you, one for me.\", TwoFer.two_fer","status":"fail","output":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n\n...Output was truncated. Please limit to 500 chars...","message":"Expected: \"One for you, one for me.\"\n Actual: false"}]}
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions tests/benchmarks/expected_results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":2,"status":"pass","message":null,"tests":[{"name":"No name given","test_code":"assert_equal \"One for you, one for me.\", TwoFer.two_fer","status":"pass"},{"name":"A name given","test_code":"assert_equal \"One for Alice, one for me.\", TwoFer.two_fer(\"Alice\")","status":"pass"},{"name":"Another name given","test_code":"assert_equal \"One for Bob, one for me.\", TwoFer.two_fer(\"Bob\")","status":"pass"}]}
File renamed without changes.
11 changes: 11 additions & 0 deletions tests/benchmarks/two_fer_benchmark_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'minitest/autorun'
require 'minitest/benchmark'
require_relative 'two_fer'

class TwoFerBenchmarkTest < Minitest::Benchmark
def bench_two_fer
assert_performance_linear 0.9999 do |n| # n is a range value
TwoFer.two_fer
end
end
end
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/deep_exception/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":3,"status":"pass","message":null,"tests":[]}
{"version":3,"status":"fail","message":null,"tests":[{"name":"No name given","test_code":"assert_equal \"One for you, one for me.\", TwoFer.two_fer","status":"error","message":"NoMethodError: undefined method `non_existant_method' for nil\n\nTraceback (most recent call first):\n Line 8:in `work_out_name'\n Line 3:in `two_fer'"}]}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/exception/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":3,"status":"pass","message":null,"tests":[]}
{"version":3,"status":"error","message":"Line 3: undefined local variable or method `raise_an_error_because_i_am_a_random_method' for main (NameError)","tests":null}
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/fail/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":3,"status":"pass","message":null,"tests":[]}
{"version":3,"status":"fail","message":null,"tests":[{"name":"No name given","test_code":"assert_equal \"One for you, one for me.\", TwoFer.two_fer","status":"fail","output":"The name is fred.\nHere's another line.\n","message":"Expected: \"One for you, one for me.\"\n Actual: \"One for fred, one for me.\""},{"name":"A name given","test_code":"assert_equal \"One for Alice, one for me.\", TwoFer.two_fer(\"Alice\")","status":"pass","output":"The name is Alice.\nHere's another line.\n"},{"name":"Another name given","test_code":"assert_equal \"One for Bob, one for me.\", TwoFer.two_fer(\"Bob\")","status":"pass","output":"The name is Bob.\nHere's another line.\n"}]}
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/metadata/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":3,"status":"pass","message":null,"tests":[]}
{"version":3,"status":"fail","message":null,"tests":[{"name":"Assert equal works properly","test_code":"some_result = TwoFer.two_fer\nassert_equal \"One for you, one for me.\", some_result","status":"error","message":"NameError: uninitialized constant SomeTest::TwoFer\n\nTraceback (most recent call first):\n Line 3:in `test_assert_equal_works_properly'"},{"name":"Skip works properly","test_code":"something = \"Something\"\nassert something.present?","status":"error","message":"NoMethodError: undefined method `present?' for an instance of String\n\nTraceback (most recent call first):\n Line 5:in `test_skip_works_properly'"},{"name":"Zebra","test_code":"some_result = TwoFer.two_fer(\"zebra\")\nassert_equal \"One for you, one for zebra.\", some_result","status":"error","message":"NameError: uninitialized constant SomeTest::TwoFer\n\nTraceback (most recent call first):\n Line 3:in `test_zebra'"},{"name":"Anaconda","test_code":"some_result = TwoFer.two_fer(\"anaconda\")\nassert_equal \"One for you, one for anaconda.\", some_result","status":"error","message":"NameError: uninitialized constant SomeTest::TwoFer\n\nTraceback (most recent call first):\n Line 8:in `test_anaconda'"},{"name":"Gorilla","test_code":"some_result = TwoFer.two_fer(\"gorilla\")\nassert_equal \"One for you, one for gorilla.\", some_result","status":"error","message":"NameError: uninitialized constant SomeTest::TwoFer\n\nTraceback (most recent call first):\n Line 13:in `test_gorilla'"},{"name":"Boa","test_code":"some_result = TwoFer.two_fer(\"boa\")\nassert_equal \"One for you, one for boa.\", some_result","status":"error","message":"NameError: uninitialized constant SomeTest::TwoFer\n\nTraceback (most recent call first):\n Line 18:in `test_boa'"}]}
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/pass/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":3,"status":"pass","message":null,"tests":[]}
{"version":3,"status":"pass","message":null,"tests":[{"name":"No name given","test_code":"assert_equal \"One for you, one for me.\", TwoFer.two_fer","status":"pass"},{"name":"A name given","test_code":"assert_equal \"One for Alice, one for me.\", TwoFer.two_fer(\"Alice\")","status":"pass"},{"name":"Another name given","test_code":"assert_equal \"One for Bob, one for me.\", TwoFer.two_fer(\"Bob\")","status":"pass"}]}
5 changes: 5 additions & 0 deletions tests/pass/two_fer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class TwoFer
def self.two_fer(name = "you")
"One for #{name}, one for me."
end
end
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/pass_ruby_3_syntax/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":3,"status":"pass","message":null,"tests":[]}
{"version":3,"status":"pass","message":null,"tests":[{"name":"Rightward assign","test_code":"assert_equal Ruby3Syntax.rightward_assign, 'is fun'","status":"pass"},{"name":"Endless method def","test_code":"assert_equal Ruby3Syntax.endless_methods, 'are fun'","status":"pass"}]}
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/syntax_error_in_code/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":3,"status":"pass","message":null,"tests":[]}
{"version":3,"status":"error","message":"Line 2: syntax error, unexpected ',', expecting end-of-input\nend,A stray comma\n ^\n","tests":null}
File renamed without changes.
20 changes: 20 additions & 0 deletions tests/syntax_error_in_code/two_fer_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'minitest/autorun'
require_relative 'two_fer'

# Common test data version: 1.2.0 4fc1acb
class TwoFerTest < Minitest::Test
def test_no_name_given
# skip
assert_equal "One for you, one for me.", TwoFer.two_fer
end

def test_a_name_given
skip
assert_equal "One for Alice, one for me.", TwoFer.two_fer("Alice")
end

def test_another_name_given
skip
assert_equal "One for Bob, one for me.", TwoFer.two_fer("Bob")
end
end
2 changes: 1 addition & 1 deletion tests/syntax_error_in_tests/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":3,"status":"pass","message":null,"tests":[]}
{"version":3,"status":"error","message":"Line 3: syntax error, unexpected ','\n,'This is meant to be a syntax...\n^\n","tests":null}
File renamed without changes.

0 comments on commit ba9455f

Please sign in to comment.