module Regextest::Common
Common
part of regextest
Constants
- TstConstDebug
- TstConstRecursionMax
- TstConstRepeatMax
- TstConstRetryMax
environment variables
- TstConstRetryMaxSecond
- TstConstTimeout
- TstConstUnicodeCharSet
whole character set if unicode mode. specify as ‘ascii|kana’, ‘ascii|han|kana’, etc. where “_asciiprint is codepoints range 32..126
- TstFixnumMax
Public Instance Methods
TstLog(msg)
click to toggle source
Log
# File lib/regextest/common.rb, line 25 def TstLog(msg) # if(!defined? Rails) # not output debug message when rails env (even if development mode) if TstConstDebug warn msg end # end end
TstMdPrint(md)
click to toggle source
Pretty print of matched data object
# File lib/regextest/common.rb, line 56 def TstMdPrint(md) # coloring if tty && (!windows) if $stdout.tty? && !RUBY_PLATFORM.downcase.match(/mswin(?!ce)|mingw/) "#{md.pre_match.inspect[1..-2]}\e[36m#{md.to_a[0].inspect[1..-2]}\e[0m#{md.post_match.inspect[1..-2]}" else "#{md.pre_match.inspect[1..-2]} #{md.to_a[0].inspect[1..-2]} #{md.post_match.inspect[1..-2]}" end end
TstRand(num)
click to toggle source
Randomize
# File lib/regextest/common.rb, line 34 def TstRand(num) @@rand_called = true rand(num) end
TstShuffle(array)
click to toggle source
Shuffle
# File lib/regextest/common.rb, line 40 def TstShuffle(array) @@rand_called = true array.shuffle end
is_random?()
click to toggle source
is_random?
# File lib/regextest/common.rb, line 51 def is_random? @@rand_called end
reset_random_called()
click to toggle source
reset random_called
# File lib/regextest/common.rb, line 46 def reset_random_called @@rand_called = false end