Hello community,
here is the log from the commit of package rubygem-power_assert for
openSUSE:Factory checked in at 2016-05-29 03:11:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-power_assert (Old)
and /work/SRC/openSUSE:Factory/.rubygem-power_assert.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-power_assert"
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-power_assert/rubygem-power_assert.changes
2016-03-01 09:40:27.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.rubygem-power_assert.new/rubygem-power_assert.changes
2016-05-29 03:12:41.000000000 +0200
@@ -1,0 +2,6 @@
+Wed May 4 04:42:55 UTC 2016 - [email protected]
+
+- updated to version 0.3.0
+ no changelog found
+
+-------------------------------------------------------------------
Old:
----
power_assert-0.2.7.gem
New:
----
power_assert-0.3.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-power_assert.spec ++++++
--- /var/tmp/diff_new_pack.SHzlrb/_old 2016-05-29 03:12:42.000000000 +0200
+++ /var/tmp/diff_new_pack.SHzlrb/_new 2016-05-29 03:12:42.000000000 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-power_assert
-Version: 0.2.7
+Version: 0.3.0
Release: 0
%define mod_name power_assert
%define mod_full_name %{mod_name}-%{version}
++++++ power_assert-0.2.7.gem -> power_assert-0.3.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml 2016-01-09 03:25:22.000000000 +0100
+++ new/.travis.yml 2016-05-03 07:41:31.000000000 +0200
@@ -1,9 +1,9 @@
language: ruby
rvm:
- - 2.0.0
- - 2.1
- - 2.2
- - 2.3.0
+ - 2.0.0-p648
+ - 2.1.10
+ - 2.2.5
+ - 2.3.1
- ruby-head
matrix:
allow_failures:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/BSDL new/BSDL
--- old/BSDL 2016-01-09 03:25:22.000000000 +0100
+++ new/BSDL 2016-05-03 07:41:31.000000000 +0200
@@ -1,4 +1,4 @@
-Copyright (C) 2014-2015 Kazuki Tsujimoto, All rights reserved.
+Copyright (C) 2014-2016 Kazuki Tsujimoto, All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/COPYING new/COPYING
--- old/COPYING 2016-01-09 03:25:22.000000000 +0100
+++ new/COPYING 2016-05-03 07:41:31.000000000 +0200
@@ -1,4 +1,4 @@
-Copyright (C) 2014-2015 Kazuki Tsujimoto, All rights reserved.
+Copyright (C) 2014-2016 Kazuki Tsujimoto, All rights reserved.
You can redistribute it and/or modify it under either the terms of the
2-clause BSDL (see the file BSDL), or the conditions below:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile 2016-01-09 03:25:22.000000000 +0100
+++ new/Rakefile 2016-05-03 07:41:31.000000000 +0200
@@ -7,3 +7,10 @@
t.ruby_opts = ["-w", "-r./test/helper"]
t.test_files = FileList["test/test_*.rb"]
end
+
+desc "Run the benchmark suite"
+task('benchmark') do
+ Dir.glob('benchmarks/bm_*.rb').each do |f|
+ load(f)
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/benchmarks/bm_yhpg.rb new/benchmarks/bm_yhpg.rb
--- old/benchmarks/bm_yhpg.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/benchmarks/bm_yhpg.rb 2016-05-03 07:41:31.000000000 +0200
@@ -0,0 +1,59 @@
+# Yhpg
+# https://gist.github.com/yancya/37d79e02a91afcfdeed1
+#
+# Auhtor: yancya
+
+require_relative 'helper'
+
+class Yhpg
+ MAPPING = [*'0'..'9', *'A'..'Z', *'a'..'z']
+
+ def initialize(data)
+ @n, @list = data.split(":").tap { |n, list| break [n.to_i,
list.split(",").map { |str| Yhpg.decode(str) }] }
+ x_nominee = @list.map { |x, _| x }.map { |x| [x, x + 1] }.flatten.tap {
|a| a.push(*[0, 62])}.uniq
+ y_nominee = @list.map { |_, y| y }.map { |y| [y, y + 1] }.flatten.tap {
|a| a.push(*[0, 62])}.uniq
+ x_range_patterns = x_nominee.combination(2).map { |a| (a.min..a.max) }
+ y_range_patterns = y_nominee.combination(2).map { |a| (a.min..a.max) }
+ squares = x_range_patterns.product(y_range_patterns)
+ targets = squares.select { |xrange, yrange| @list.select { |p|
check(xrange, yrange, p) }.size == @n }
+ @areas = targets.map { |x, y| [(x.max - x.min) * (y.max - y.min), x, y] }
+ end
+
+ def debug
+ p [@areas.min_by(&:first), @areas.max_by(&:first)]
+ end
+
+ def Yhpg.decode(str)
+ str.chars.map { |w| MAPPING.index(w) }
+ end
+
+ def check(xrange, yrange, target)
+ x, y = target
+ (xrange.include?(x) && xrange.include?(x + 1)) &&
+ (yrange.include?(y) && yrange.include?(y + 1))
+ end
+
+ def output
+ case res = [@areas.map(&:first).min, @areas.map(&:first).max].join(',')
+ when ','
+ '-'
+ else
+ res
+ end
+ end
+end
+
+[
+ ["4:00,11,zz,yy,1y,y1", "3600,3721"], # /*05*/
+].each do |(actual, expect)|
+ Benchmark.bm(30) do |x|
+ x.report("expr") { Yhpg.new(actual).output == expect }
+ x.report("TracePoint.trace { expr }") { TracePoint.new(:return, :c_return)
{}.enable { Yhpg.new(actual).output == expect } }
+ x.report("assertion_message { expr }") {
+ assertion_message { Yhpg.new(actual).output == expect }
+ }
+ x.report("assertion_message { !expr }") {
+ assertion_message { not Yhpg.new(actual).output == expect }
+ }
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/benchmarks/helper.rb new/benchmarks/helper.rb
--- old/benchmarks/helper.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/benchmarks/helper.rb 2016-05-03 07:41:31.000000000 +0200
@@ -0,0 +1,8 @@
+require 'benchmark'
+require 'power_assert'
+
+def assertion_message(source = nil, source_binding = TOPLEVEL_BINDING, &blk)
+ ::PowerAssert.start(source || blk, assertion_method: __callee__,
source_binding: source_binding) do |pa|
+ pa.message unless pa.yield
+ end
+end
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/power_assert/version.rb
new/lib/power_assert/version.rb
--- old/lib/power_assert/version.rb 2016-01-09 03:25:22.000000000 +0100
+++ new/lib/power_assert/version.rb 2016-05-03 07:41:31.000000000 +0200
@@ -1,3 +1,3 @@
module PowerAssert
- VERSION = "0.2.7"
+ VERSION = "0.3.0"
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/power_assert.rb new/lib/power_assert.rb
--- old/lib/power_assert.rb 2016-01-09 03:25:22.000000000 +0100
+++ new/lib/power_assert.rb 2016-05-03 07:41:31.000000000 +0200
@@ -1,6 +1,6 @@
# power_assert.rb
#
-# Copyright (C) 2014-2015 Kazuki Tsujimoto, All rights reserved.
+# Copyright (C) 2014-2016 Kazuki Tsujimoto, All rights reserved.
begin
captured = false
@@ -22,7 +22,7 @@
module PowerAssert
class << self
def configuration
- @configuration ||= Configuration[false]
+ @configuration ||= Configuration[false, false]
end
def configure
@@ -45,7 +45,7 @@
end
end
- Configuration = Struct.new(:lazy_inspection)
+ Configuration = Struct.new(:lazy_inspection, :_trace_alias_method)
private_constant :Configuration
module Empty
@@ -90,7 +90,7 @@
Ident = Struct.new(:type, :name, :column)
TARGET_CALLER_DIFF = {return: 5, c_return: 4}
- TARGET_INDEX_OFFSET = {bmethod: 3, method: 2}
+ TARGET_INDEX_OFFSET = 2
attr_reader :message_proc
@@ -111,40 +111,54 @@
@base_caller_length = -1
@assertion_method_name = assertion_method.to_s
@message_proc = -> {
- return nil if @base_caller_length < 0
+ raise RuntimeError, 'call #yield at first' if @base_caller_length < 0
@message ||= build_assertion_message(@line || '', methods || [],
return_values, refs || [], @assertion_proc.binding).freeze
}
@proc_local_variables =
@assertion_proc.binding.eval('local_variables').map(&:to_s)
target_thread = Thread.current
+ @trace_call = TracePoint.new(:call, :c_call) do |tp|
+ next if @base_caller_length < 0
+ locs = caller_locations
+ if locs.length >= @base_caller_length+TARGET_INDEX_OFFSET and
Thread.current == target_thread
+ idx = -(@base_caller_length+TARGET_INDEX_OFFSET)
+ path = locs[idx].path
+ lineno = locs[idx].lineno
+ @line ||= open(path).each_line.drop(lineno - 1).first
+ idents = extract_idents(Ripper.sexp(@line))
+ methods, refs = idents.partition {|i| i.type == :method }
+ method_ids = methods.map(&:name).map(&:to_sym).each_with_object({})
{|i, h| h[i] = true }
+ @trace_call.disable
+ end
+ end
+ trace_alias_method = PowerAssert.configuration._trace_alias_method
@trace = TracePoint.new(:return, :c_return) do |tp|
- next if method_ids and ! method_ids.include?(tp.method_id)
+ method_id = (trace_alias_method &&
+ tp.event == :return &&
+ tp.binding.eval('::Kernel.__callee__')) || tp.method_id
+ next if method_ids and ! method_ids[method_id]
next unless tp.binding # workaround for ruby 2.2
+ if tp.event == :c_return
+ loc = tp.binding.eval('[__LINE__, __FILE__]')
+ next unless lineno == loc[0] and path == loc[1]
+ end
locs = tp.binding.eval('::Kernel.caller_locations')
current_diff = locs.length - @base_caller_length
- target_diff = TARGET_CALLER_DIFF[tp.event]
- is_target_bmethod = current_diff < target_diff
- if (is_target_bmethod or current_diff == target_diff) and
Thread.current == target_thread
- idx = target_diff - TARGET_INDEX_OFFSET[is_target_bmethod ? :bmethod
: :method]
- unless path
- path = locs[idx].path
- lineno = locs[idx].lineno
- @line ||= open(path).each_line.drop(lineno - 1).first
- idents = extract_idents(Ripper.sexp(@line))
- methods, refs = idents.partition {|i| i.type == :method }
- method_ids = methods.map(&:name).map(&:to_sym).uniq
- end
+ if current_diff <= TARGET_CALLER_DIFF[tp.event] and Thread.current ==
target_thread
+ idx = -(@base_caller_length+TARGET_INDEX_OFFSET)
if path == locs[idx].path and lineno == locs[idx].lineno
val = PowerAssert.configuration.lazy_inspection ?
tp.return_value :
InspectedValue.new(SafeInspectable.new(tp.return_value).inspect)
- return_values << Value[tp.method_id.to_s, val, nil]
+ return_values << Value[method_id.to_s, val, nil]
end
end
end
end
def yield
- do_yield(&@assertion_proc)
+ @trace_call.enable do
+ do_yield(&@assertion_proc)
+ end
end
def message
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2016-01-09 03:25:22.000000000 +0100
+++ new/metadata 2016-05-03 07:41:31.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: power_assert
version: !ruby/object:Gem::Version
- version: 0.2.7
+ version: 0.3.0
platform: ruby
authors:
- Kazuki Tsujimoto
autorequire:
bindir: bin
cert_chain: []
-date: 2016-01-09 00:00:00.000000000 Z
+date: 2016-05-03 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: test-unit
@@ -70,6 +70,8 @@
- LEGAL
- README.rdoc
- Rakefile
+- benchmarks/bm_yhpg.rb
+- benchmarks/helper.rb
- lib/power_assert.rb
- lib/power_assert/enable_tracepoint_events.rb
- lib/power_assert/version.rb
@@ -99,7 +101,7 @@
version: '0'
requirements: []
rubyforge_project:
-rubygems_version: 2.5.1
+rubygems_version: 2.6.4
signing_key:
specification_version: 4
summary: Power Assert for Ruby
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/test_power_assert.rb
new/test/test_power_assert.rb
--- old/test/test_power_assert.rb 2016-01-09 03:25:22.000000000 +0100
+++ new/test/test_power_assert.rb 2016-05-03 07:41:31.000000000 +0200
@@ -4,6 +4,13 @@
require 'set'
class TestPowerAssert < Test::Unit::TestCase
+ class << self
+ def t(msg='', &blk)
+ loc = caller_locations(1, 1)[0]
+ test("#{loc.path} --location #{loc.lineno} #{msg}", &blk)
+ end
+ end
+
EXTRACT_METHODS_TEST = [
[[[:method, "c", 4], [:method, "b", 2], [:method, "d", 8], [:method, "a",
0]],
'a(b(c), d)'],
@@ -148,194 +155,215 @@
false
end
- def test_lazy_inspection
- PowerAssert.configure do |c|
- assert !c.lazy_inspection
- end
- assert_equal <<END.chomp, assertion_message {
- 'a'.sub(/./, 'b').sub!(/./, 'c')
- | |
- | "c"
- "b"
-END
- 'a'.sub(/./, 'b').sub!(/./, 'c')
- }
-
- PowerAssert.configure do |c|
- c.lazy_inspection = true
- end
- begin
+ sub_test_case 'lazy_inspection' do
+ t do
+ PowerAssert.configure do |c|
+ assert !c.lazy_inspection
+ end
assert_equal <<END.chomp, assertion_message {
'a'.sub(/./, 'b').sub!(/./, 'c')
| |
| "c"
- "c"
+ "b"
END
'a'.sub(/./, 'b').sub!(/./, 'c')
}
- ensure
+ end
+
+ t do
PowerAssert.configure do |c|
- c.lazy_inspection = false
+ c.lazy_inspection = true
+ end
+ begin
+ assert_equal <<END.chomp, assertion_message {
+ 'a'.sub(/./, 'b').sub!(/./, 'c')
+ | |
+ | "c"
+ "c"
+END
+ 'a'.sub(/./, 'b').sub!(/./, 'c')
+ }
+ ensure
+ PowerAssert.configure do |c|
+ c.lazy_inspection = false
+ end
end
end
end
- def test_assertion_message
- a = 0
- @b = 1
- @@c = 2
- $d = 3
- assert_equal <<END.chomp, assertion_message {
- String(a) + String(@b) + String(@@c) + String($d)
- | | | | | | | | | | |
- | | | | | | | | | | 3
- | | | | | | | | | "3"
- | | | | | | | | "0123"
- | | | | | | | 2
- | | | | | | "2"
- | | | | | "012"
- | | | | 1
- | | | "1"
- | | "01"
- | 0
- "0"
-END
- String(a) + String(@b) + String(@@c) + String($d)
- }
-
-
- assert_equal <<END.chomp, assertion_message {
- "0".class == "3".to_i.times.map {|i| i + 1 }.class
- | | | | | |
- | | | | | Array
- | | | | [1, 2, 3]
- | | | #<Enumerator: 3:times>
- | | 3
- | false
- String
-END
- "0".class == "3".to_i.times.map {|i| i + 1 }.class
- }
-
-
- assert_equal '', assertion_message {
- false
- }
-
-
- assert_equal <<END.chomp,
- assertion_message { "0".class }
- |
- String
-END
- assertion_message { "0".class }
-
-
- assert_equal <<END.chomp,
- "0".class
- |
- String
-END
- Assertion {
- "0".class
- }
-
-
- assert_equal <<END.chomp,
- Assertion { "0".class }
- |
- String
-END
- Assertion { "0".class }
-
-
- assert_equal <<END.chomp, assertion_message {
- Set.new == Set.new([0])
- | | | | |
- | | | | #<Set: {0}>
- | | | Set
- | | false
- | #<Set: {}>
- Set
-END
- Set.new == Set.new([0])
- }
-
-
- var = [10,20]
- assert_equal <<END.chomp, assertion_message {
- var[0] == 0
- | | |
- | | false
- | 10
- [10, 20]
-END
- var[0] == 0
- }
-
- a = 1
- assert_equal <<END.chomp, assertion_message {
- ! a != (+a == -a)
- | | | || | ||
- | | | || | |1
- | | | || | -1
- | | | || false
- | | | |1
- | | | 1
- | | false
- | 1
- false
-END
- ! a != (+a == -a)
- }
-
- assert_equal <<END.chomp, assertion_message {
- bmethod
- |
- false
-END
- bmethod
- }
-
-
- a = :a
- assert_equal <<END.chomp, assertion_message {
- a == :b
- | |
- | false
- :a
-END
- a == :b
- }
-
-
- assert_equal <<END.chomp, assertion_message {
- ! Object
- | |
- | Object
- false
+ sub_test_case 'assertion_message' do
+ t do
+ a = 0
+ @b = 1
+ @@c = 2
+ $d = 3
+ assert_equal <<END.chomp, assertion_message {
+ String(a) + String(@b) + String(@@c) + String($d)
+ | | | | | | | | | | |
+ | | | | | | | | | | 3
+ | | | | | | | | | "3"
+ | | | | | | | | "0123"
+ | | | | | | | 2
+ | | | | | | "2"
+ | | | | | "012"
+ | | | | 1
+ | | | "1"
+ | | "01"
+ | 0
+ "0"
END
- ! Object
- }
+ String(a) + String(@b) + String(@@c) + String($d)
+ }
+ end
+ t do
+ assert_equal <<END.chomp, assertion_message {
+ "0".class == "3".to_i.times.map {|i| i + 1 }.class
+ | | | | | |
+ | | | | | Array
+ | | | | [1, 2, 3]
+ | | | #<Enumerator: 3:times>
+ | | 3
+ | false
+ String
+END
+ "0".class == "3".to_i.times.map {|i| i + 1 }.class
+ }
+ end
- if PowerAssert.respond_to?(:clear_global_method_cache, true)
- 3.times do
- assert_equal <<END.chomp, assertion_message {
- String == Array
- | | |
- | | Array
- | false
- String
+ t do
+ assert_equal '', assertion_message {
+ false
+ }
+ end
+
+ t do
+ assert_equal <<END.chomp,
+ assertion_message { "0".class }
+ |
+ String
+END
+ assertion_message { "0".class }
+ end
+
+ t do
+ assert_equal <<END.chomp,
+ "0".class
+ |
+ String
END
- String == Array
- }
+ Assertion {
+ "0".class
+ }
+ end
+
+ t do
+ assert_equal <<END.chomp,
+ Assertion { "0".class }
+ |
+ String
+END
+ Assertion { "0".class }
+ end
+
+ t do
+ assert_equal <<END.chomp, assertion_message {
+ Set.new == Set.new([0])
+ | | | | |
+ | | | | #<Set: {0}>
+ | | | Set
+ | | false
+ | #<Set: {}>
+ Set
+END
+ Set.new == Set.new([0])
+ }
+ end
+
+ t do
+ var = [10,20]
+ assert_equal <<END.chomp, assertion_message {
+ var[0] == 0
+ | | |
+ | | false
+ | 10
+ [10, 20]
+END
+ var[0] == 0
+ }
+ end
+
+ t do
+ a = 1
+ assert_equal <<END.chomp, assertion_message {
+ ! a != (+a == -a)
+ | | | || | ||
+ | | | || | |1
+ | | | || | -1
+ | | | || false
+ | | | |1
+ | | | 1
+ | | false
+ | 1
+ false
+END
+ ! a != (+a == -a)
+ }
+ end
+
+ t do
+ assert_equal <<END.chomp, assertion_message {
+ bmethod
+ |
+ false
+END
+ bmethod
+ }
+ end
+
+ t do
+ a = :a
+ assert_equal <<END.chomp, assertion_message {
+ a == :b
+ | |
+ | false
+ :a
+END
+ a == :b
+ }
+ end
+
+ t do
+ assert_equal <<END.chomp, assertion_message {
+ ! Object
+ | |
+ | Object
+ false
+END
+ ! Object
+ }
+ end
+
+ if PowerAssert.respond_to?(:clear_global_method_cache, true)
+ t do
+ 3.times do
+ assert_equal <<END.chomp, assertion_message {
+ String == Array
+ | | |
+ | | Array
+ | false
+ String
+END
+ String == Array
+ }
+ end
end
end
end
- def test_inspection_failure
- assert_match Regexp.new(<<END.chomp.gsub('|', "\\|")),
+ sub_test_case 'inspection_failure' do
+ t do
+ assert_match Regexp.new(<<END.chomp.gsub('|', "\\|")),
assertion_message { BasicObjectSubclass.new.foo }
| | |
| | "foo"
@@ -343,52 +371,102 @@
TestPowerAssert::BasicObjectSubclass
END
assertion_message { BasicObjectSubclass.new.foo }
+ end
+ t do
+ o = Object.new
+ def o.inspect
+ raise
+ end
+ assert_equal <<END.chomp.b, assertion_message {
+ o.class
+ | |
+ | Object
+ InspectionFailure: RuntimeError:
+END
+ o.class
+ }
+ end
+ end
- o = Object.new
- def o.inspect
- raise
+ sub_test_case 'alias_method' do
+ def setup
+ begin
+ PowerAssert.configure do |c|
+ c._trace_alias_method = true
+ end
+ @o = Class.new do
+ def foo
+ :foo
+ end
+ alias alias_of_iseq foo
+ alias alias_of_cfunc to_s
+ end
+ yield
+ ensure
+ PowerAssert.configure do |c|
+ c._trace_alias_method = false
+ end
+ end
end
- assert_equal <<END.chomp.b, assertion_message {
- o.class
- | |
- | Object
- InspectionFailure: RuntimeError:
+
+ t do
+ assert_match Regexp.new(<<END.chomp.gsub('|', "\\|")),
+ assertion_message { @o.new.alias_of_iseq }
+ | | |
+ | | :foo
+ | #<#<Class:.*>:.*>
+ #<Class:.*>
+END
+ assertion_message { @o.new.alias_of_iseq }
+ end
+
+ t do
+ omit 'alias of cfunc is not supported yet'
+ assert_match Regexp.new(<<END.chomp.gsub('|', "\\|")),
+ assertion_message { @o.new.alias_of_cfunc }
+ | | |
+ | | #<#<Class:.*>:.*>
+ | #<#<Class:.*>:.*>
+ #<Class:.*>
END
- o.class
- }
+ assertion_message { @o.new.alias_of_cfunc }
+ end
end
- def test_assertion_message_with_incompatible_encodings
+ sub_test_case 'assertion_message_with_incompatible_encodings' do
if Encoding.default_external == Encoding::UTF_8
- a = "\u3042"
- def a.inspect
- super.encode('utf-16le')
- end
- assert_equal <<END.chomp, assertion_message {
- a + a
- | | |
- | | "\u3042"(UTF-16LE)
- | "\u3042\u3042"
- "\u3042"(UTF-16LE)
+ t do
+ a = "\u3042"
+ def a.inspect
+ super.encode('utf-16le')
+ end
+ assert_equal <<END.chomp, assertion_message {
+ a + a
+ | | |
+ | | "\u3042"(UTF-16LE)
+ | "\u3042\u3042"
+ "\u3042"(UTF-16LE)
END
- a + a
- }
+ a + a
+ }
+ end
end
-
- a = "\xFF"
- def a.inspect
- "\xFF".force_encoding('ascii-8bit')
- end
- assert_equal <<END.chomp.b, assertion_message {
- a.length
- | |
- | 1
- \xFF
+ t do
+ a = "\xFF"
+ def a.inspect
+ "\xFF".force_encoding('ascii-8bit')
+ end
+ assert_equal <<END.chomp.b, assertion_message {
+ a.length
+ | |
+ | 1
+ \xFF
END
- a.length
- }.b
+ a.length
+ }.b
+ end
end
def test_assertion_message_with_string