diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-08-28 20:26:00 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-08-28 20:26:00 +0200 |
commit | 3dd63108b0e7551aba76eba85a459b58ec971ccb (patch) | |
tree | 352ae69c78bef35fd250c280174b35e6b575f156 /spec/mspec | |
parent | 1c138327e0537bb55f7d0810f6fe7e1c7f63b6c5 (diff) | |
download | ruby-3dd63108b0e7551aba76eba85a459b58ec971ccb.tar.gz |
Update to ruby/mspec@53a6e3e
Diffstat (limited to 'spec/mspec')
-rw-r--r-- | spec/mspec/lib/mspec/runner/exception.rb | 11 | ||||
-rw-r--r-- | spec/mspec/lib/mspec/runner/mspec.rb | 4 | ||||
-rw-r--r-- | spec/mspec/lib/mspec/utils/version.rb | 2 | ||||
-rw-r--r-- | spec/mspec/spec/fixtures/config.mspec | 2 | ||||
-rw-r--r-- | spec/mspec/spec/integration/run_spec.rb | 2 | ||||
-rw-r--r-- | spec/mspec/spec/integration/tag_spec.rb | 2 |
6 files changed, 14 insertions, 9 deletions
diff --git a/spec/mspec/lib/mspec/runner/exception.rb b/spec/mspec/lib/mspec/runner/exception.rb index aea6610cd3..e07f02f684 100644 --- a/spec/mspec/lib/mspec/runner/exception.rb +++ b/spec/mspec/lib/mspec/runner/exception.rb @@ -40,6 +40,15 @@ class ExceptionState @backtrace_filter ||= MSpecScript.config[:backtrace_filter] || %r{(?:/bin/mspec|/lib/mspec/)} bt = @exception.backtrace || [] - bt.select { |line| $MSPEC_DEBUG or @backtrace_filter !~ line }.join("\n") + unless $MSPEC_DEBUG + # Exclude <internal: entries inside MSpec code, so only after the first ignored entry + first_excluded_line = bt.index { |line| @backtrace_filter =~ line } + if first_excluded_line + bt = bt[0...first_excluded_line] + bt[first_excluded_line..-1].reject { |line| + @backtrace_filter =~ line || /^<internal:/ =~ line + } + end + end + bt.join("\n") end end diff --git a/spec/mspec/lib/mspec/runner/mspec.rb b/spec/mspec/lib/mspec/runner/mspec.rb index 0e2496d3d7..8331086196 100644 --- a/spec/mspec/lib/mspec/runner/mspec.rb +++ b/spec/mspec/lib/mspec/runner/mspec.rb @@ -155,7 +155,9 @@ module MSpec # Stores the shared ContextState keyed by description. def self.register_shared(state) - @shared[state.to_s] = state + name = state.to_s + raise "duplicated shared #describe: #{name}" if @shared.key?(name) + @shared[name] = state end # Returns the shared ContextState matching description. diff --git a/spec/mspec/lib/mspec/utils/version.rb b/spec/mspec/lib/mspec/utils/version.rb index 787a76b053..9c1c58b8df 100644 --- a/spec/mspec/lib/mspec/utils/version.rb +++ b/spec/mspec/lib/mspec/utils/version.rb @@ -42,7 +42,7 @@ class SpecVersion def <=>(other) if other.respond_to? :to_int - other = Integer other + other = Integer(other.to_int) else other = SpecVersion.new(String(other)).to_i end diff --git a/spec/mspec/spec/fixtures/config.mspec b/spec/mspec/spec/fixtures/config.mspec index 4a069e2eb0..01654c5094 100644 --- a/spec/mspec/spec/fixtures/config.mspec +++ b/spec/mspec/spec/fixtures/config.mspec @@ -1,8 +1,6 @@ class MSpecScript set :target, 'ruby' - set :backtrace_filter, /lib\/mspec\// - set :tags_patterns, [ [%r(spec/fixtures/), 'spec/fixtures/tags/'], [/_spec.rb$/, '_tags.txt'] diff --git a/spec/mspec/spec/integration/run_spec.rb b/spec/mspec/spec/integration/run_spec.rb index df10f77094..99a5416cb0 100644 --- a/spec/mspec/spec/integration/run_spec.rb +++ b/spec/mspec/spec/integration/run_spec.rb @@ -9,14 +9,12 @@ Expected 1 == 2 to be truthy but was false CWD/spec/fixtures/a_spec.rb:8:in `block (2 levels) in <top (required)>' CWD/spec/fixtures/a_spec.rb:2:in `<top (required)>' -CWD/bin/mspec-run:7:in `<main>' 2) Foo#bar fails ERROR RuntimeError: failure CWD/spec/fixtures/a_spec.rb:12:in `block (2 levels) in <top (required)>' CWD/spec/fixtures/a_spec.rb:2:in `<top (required)>' -CWD/bin/mspec-run:7:in `<main>' Finished in D.DDDDDD seconds EOS diff --git a/spec/mspec/spec/integration/tag_spec.rb b/spec/mspec/spec/integration/tag_spec.rb index 1882d71e32..f4df2f0dc4 100644 --- a/spec/mspec/spec/integration/tag_spec.rb +++ b/spec/mspec/spec/integration/tag_spec.rb @@ -28,7 +28,6 @@ Expected 1 == 2 to be truthy but was false CWD/spec/fixtures/tagging_spec.rb:9:in `block (2 levels) in <top (required)>' CWD/spec/fixtures/tagging_spec.rb:3:in `<top (required)>' -CWD/bin/mspec-tag:7:in `<main>' 2) Tag#me érròrs in unicode FAILED @@ -36,7 +35,6 @@ Expected 1 == 2 to be truthy but was false CWD/spec/fixtures/tagging_spec.rb:13:in `block (2 levels) in <top (required)>' CWD/spec/fixtures/tagging_spec.rb:3:in `<top (required)>' -CWD/bin/mspec-tag:7:in `<main>' Finished in D.DDDDDD seconds |