summaryrefslogtreecommitdiff
path: root/test/lib/test/unit/assertions.rb
AgeCommit message (Collapse)Author
2019-07-02Move to tool/lib from test/lib.Hiroshi SHIBATA
2019-07-01Return the result of the block given to assert_warning/assert_no_warningNobuyoshi Nakada
2019-06-22Show timed out threadsNobuyoshi Nakada
* test/lib/test/unit/assertions.rb (assert_join_threads): kill and show timed out threads.
2019-06-14Use Exception#full_message for tracebackNobuyoshi Nakada
2019-06-13test/lib/test/unit/assertions.rb (assert_cpu_usage_low): tweak the waitYusuke Endoh
It still fails randomly. https://rubyci.org/logs/rubyci.s3.amazonaws.com/amazon2/ruby-master/log/20190613T093003Z.fail.html.gz https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-master/log/20190613T051547Z.fail.html.gz
2019-06-11assert_cpu_usage_low with timeout scaleNobuyoshi Nakada
* test/lib/test/unit/assertions.rb (assert_cpu_usage_low): apply the timeout scale to measuring period. this assertion is very runtime environment dependent.
2019-06-11MIN_HZ and MIN_MEASURABLE constantsNobuyoshi Nakada
* test/lib/test/unit/assertions.rb (Test::Unit::Assertions): promoted MIN_HZ and MIN_MEASURABLE as constants, which should be constant through the process.
2019-06-11test/lib/test/unit/assertions.rb (assert_cpu_usage_low): Relax the limitYusuke Endoh
CPU usage 1% causes occesional test failure. Try to use 5%. https://rubyci.org/logs/rubyci.s3.amazonaws.com/gentoo/ruby-master/log/20190604T153002Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/gentoo/ruby-master/log/20190610T153002Z.fail.html.gz
2019-04-29Make only `mesg` can be assigned with default `fname`Nobuyoshi Nakada
2019-01-30Show the code in syntax assertionsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-27test/mkmf/test_flags.rb: try to suppress random CI failurek0kubun
on AIX ppc https://rubyci.org/logs/rubyci.s3.amazonaws.com/aix71_ppc/ruby-trunk/log/20181226T113305Z.fail.html.gz test/lib/test/unit/assertions.rb: ditto, for TestIO#test_copy_stream_no_busy_wait git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-26parse.y: remove "shadowing outer local variable" warningmame
You can now write the following without warning. user = User.all.find {|user| cond(user) } Fixes [Feature #12490]. A patch from Soutaro Matsumoto <matsumoto@soutaro.com>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-26Revert "parse.y: remove "shadowing outer local variable" warning"mame
I forgot to add the copyright of the patch... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-26parse.y: remove "shadowing outer local variable" warningmame
You can now write the following without warning. user = User.all.find {|user| cond(user) } Fixes [Feature #12490]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-23test/lib/test/unit/assertions.rb: skip memory leak checkk0kubun
for all test cases on MJIT. In addition to those 2 tests, TestAutoload#test_no_leak newly failed and most of assert_no_memory_leak usages are likely to randomly fail. Let me just skip all of them but let's revisit this to check it properly later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-31test/lib/test/unit/assertions.rb: explicit delegation of keyword argumentsmame
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-29test/lib/test/unit/assertions.rb (assert_in_out_err): disable gemsnormal
RubyGems loading is still a bottleneck at startup and this speeds up test/ruby/test_rubyoptions.rb test from 15s => 3.5s on the fastest machine I have access to. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-12assertions.rb: parenthesesnobu
* test/lib/test/unit/assertions.rb (assert_not_all): fix missing parentheses. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Capture the values of globals in EnvUtil to restore to the originaleregon
* Avoids the thread-safety issues mentioned in r61192, when thread concurrently modify default Encodings or $VERBOSE. Their state will always be the original one once the test finishes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Revert r61192 and r61193eregon
* More general fix coming. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Do not change Encoding.default_internal in assert_raise_with_messageeregon
* It is not thread-safe: if two threads call it concurrently, the default_internal Encoding might not be restored, which causes many problems. The same applies for $VERBOSE, which might also not be restored to its original value but to the new value instead. This happens because reading the original value might capture the value already changed by EnvUtil.with_default_internal in another Thread. One solution could be to capture the value of these globals before running the test. * Reverts part of r54522. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-02assertions.rb: fix return in assert_raisenobu
* test/lib/test/unit/assertions.rb (assert_raise): should fail if returned gently in the given block without any exceptions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-01assertions.rb: AllFailures#message encodingnobu
* test/lib/test/unit/assertions.rb (AllFailures#message): put indented messages back to the original encoding, to get rid of Encoding::CompatibilityError when key has non-ASCII characters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-16assertions.rb: frozen string buffernobu
* test/lib/test/unit/assertions.rb (assert_pattern_list): make frozen string literals modifiable as buffers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-08assertions.rb: syntax_check for other implnobu
* test/lib/test/unit/assertions.rb (syntax_check): use eval instead of RubyVM::InstructionSequence.compile so that other implementations can share the tests. [ruby-core:81935] [Bug #13723] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-22catch up frozen_string_literal: true.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-20Specify frozen_string_literal: true.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-03test: attempt to reduce failures in assert_cpu_usage_lownormal
Try to make this test less fragile by taking into account the worst case kernel timing resolution. [ruby-core:81540] * test/lib/test/unit/assertions.rb (assert_cpu_usage_low): clamp measurement to minimum measurable time and warn about tests being too short to measure * test/ruby/test_io.rb (test_copy_stream_no_busy_wait): remove pct kwarg and rely on assert_cpu_usage_low defaults git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-28tests: increase CPU percentage threshold for assert_cpu_usage_lownormal
When sleeping for the tick rate of 100ms (defined in thread_pthread.c) as we do in test/ruby/test_io.rb (test_copy_stream_no_busy_wait), it may not be possible to measure with <= 10ms resolution on 100HZ systems (CONFIG_HZ in the Linux kernel). So increase the threshold to 15ms (10ms + 5ms slack for slow systems). * test/lib/test/unit/assertions.rb (assert_cpu_usage_low): increase pct default value [ruby-core:81427] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-27test for IO.copy_stream CPU usage (r58534)normal
I'm likely to make similar mistakes in the future when working on Fiber auto-scheduling. Start adding assertions for existing code, first. * test/ruby/test_io.rb (test_copy_stream_no_busy_wait): added * test/lib/test/unit/assertions.rb (assert_cpu_usage_low): added git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-24assertions.rb: AllFailures#foreachnobu
* test/lib/test/unit/assertions.rb (AllFailures#foreach): shortcircuit for `each` and `AllFailures#for`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-23Add diagnostic reports section header [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-23assert_syntax_error returns the exception [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-07fix condition of assert_not_respond_tonobu
* test/lib/test/unit/assertions.rb (assert_not_respond_to): fix condition to assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-07assert_not_respond_to private methodnobu
* test/lib/test/unit/assertions.rb (assert_not_respond_to): allow private flag as well as assert_respond_to. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-07assert_respond_to non-private methodnobu
* test/lib/test/unit/assertions.rb (assert_respond_to): do not call super class assert_respond_to when false priv is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-20assertions.rb: ignore exit in childnobu
* test/lib/test/unit/assertions.rb (assert_separately): ignore SystemExit. unsuccessful exit still fails an assertion later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-20envutil.rb: diagnostic_reports for ruby-runnernobu
* test/lib/envutil.rb (EnvUtil.diagnostic_reports): ruby-runner execs "RUBY_INSTALL_NAME" file, so search by that name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-16Fix a typo [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-23assertions.rb: prepare_syntax_checknobu
* test/lib/test/unit/assertions.rb (prepare_syntax_check): extract common preparation of arguments from assert_valid_syntax and assert_syntax_error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-23assertions.rb: syntax check by iseqnobu
* test/lib/test/unit/assertions.rb (assert_valid_syntax): use RubyVM::InstructionSequence.compile to get rid of executing the code, instead of catch&throw. sample/trick2015/kinaba/entry.rb no longer raises an Invalid return. * test/lib/test/unit/assertions.rb (assert_syntax_error): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-07assertions.rb: defered message in FailDescnobu
* test/lib/test/unit/assertions.rb (FailDesc): allow to defer message generation, as well as other assertion methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-02assertions.rb: assert_all_assertionsnobu
* test/lib/test/unit/assertions.rb (assert_all_assertions): prefix assert to be filtered out. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-27assertions.rb: success optionnobu
* test/lib/test/unit/assertions.rb (assert_in_out_err): add success option to check the exit status. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-29assertions.rb: add an alias pend for skiprhe
* test/lib/test/unit/assertions.rb (pend): Add an alias 'pend' for 'skip'. This is required for test-unit compatibility. In particular, ext/openssl uses it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22-test-/integernobu
* ext/-test-/integer/core_ext.c: move testutil/integer.c. * test/lib/-test-/integer.rb: extract implementation details from test/unit/assertions.rb. [Bug #12408] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-19assertions.rb: leave timeout to invoke_rubynobu
* test/lib/test/unit/assertions.rb (assert_separately): leave timeout to invoke_ruby, which handles outputs and status of the target process since r51539. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17[Feature #12005] Unify Fixnum and Bignum into Integerakr
* [Feature #12005] Unify Fixnum and Bignum into Integer * include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums. * insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG. * vm_core.h: Ditto. * vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead of FIXNUM_REDEFINED_OP_FLAG. * vm.c (vm_redefinition_check_flag): Use rb_cInteger instead of rb_cFixnum and rb_cBignum. (C): Use Integer instead of Fixnum and Bignum. * numeric.c (fix_succ): Removed. (Init_Numeric): Define Fixnum as Integer. * bignum.c (bignew): Use rb_cInteger instead of Rb_cBignum. (rb_int_coerce): replaced from rb_big_coerce and return fixnums as-is. (Init_Bignum): Define Bignum as Integer. Don't define ===. * error.c (builtin_class_name): Return "Integer" for fixnums. * sprintf.c (ruby__sfvextra): Use rb_cInteger instead of rb_cFixnum. * ext/-test-/testutil: New directory to test. Currently it provides utilities for fixnum and bignum. * ext/json/generator/generator.c: Define mInteger_to_json. * lib/mathn.rb (Fixnum#/): Redefinition removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-01test/lib/test/unit/assertions.rb defines assert_fixnum and assert_bignum.akr
* test/lib/test/unit/assertions.rb (assert_fixnum): Defined. (assert_bignum): Defined. * test/ruby/test_bignum.rb: Use assert_bignum. * test/ruby/test_integer_comb.rb: Use assert_fixnum and assert_bignum. * test/ruby/test_optimization.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-20assertions.rb: return the exceptionnobu
* test/lib/test/unit/assertions.rb (assert_syntax_error): return the rescued exception object as well as assert_raise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e