oktest 1.3.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/init.rb ADDED
@@ -0,0 +1,44 @@
1
+ # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
3
+
4
+ ###
5
+ ### $Release: 1.5.0 $
6
+ ### $Copyright: copyright(c) 2011-2024 kuwata-lab.com all rights reserved $
7
+ ### $License: MIT License $
8
+ ###
9
+
10
+ File.class_eval do
11
+ $LOAD_PATH << join(dirname(dirname(expand_path(__FILE__))), 'lib')
12
+ end
13
+
14
+ require_relative './nanot'
15
+ require 'oktest'
16
+
17
+
18
+ module NanoTest
19
+ module_function
20
+
21
+ def test_when(desc, &b)
22
+ yield desc
23
+ end
24
+
25
+ def plain2colored(str)
26
+ str = str.gsub(/<R>(.*?)<\/R>/) { Oktest::Color.red($1) }
27
+ str = str.gsub(/<G>(.*?)<\/G>/) { Oktest::Color.green($1) }
28
+ str = str.gsub(/<B>(.*?)<\/B>/) { Oktest::Color.blue($1) }
29
+ str = str.gsub(/<C>(.*?)<\/C>/) { Oktest::Color.cyan($1) }
30
+ str = str.gsub(/<M>(.*?)<\/M>/) { Oktest::Color.magenta($1) }
31
+ str = str.gsub(/<Y>(.*?)<\/Y>/) { Oktest::Color.yellow($1) }
32
+ str = str.gsub(/<b>(.*?)<\/b>/) { Oktest::Color.bold($1) }
33
+ str = str.gsub(/<E>(.*?)<\/E>/) { Oktest::Color.red_b($1) }
34
+ return str
35
+ end
36
+
37
+ end
38
+
39
+
40
+ # for Ruby 2.4 or older
41
+ require 'set'
42
+ unless Set.instance_methods(false).include?(:===)
43
+ class Set; alias === include?; end
44
+ end