Rewrite test script with awesome logging
This commit is contained in:
parent
311d0b23e2
commit
b931d7e685
2 changed files with 40 additions and 13 deletions
40
libimagruby/test/test_ruby.rb
Normal file
40
libimagruby/test/test_ruby.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'fiddle'
|
||||
|
||||
INIT_FN = 'imag_ruby_initialize'
|
||||
|
||||
for targ in %w(debug release)
|
||||
begin
|
||||
lib = Fiddle::dlopen "../target/#{targ}/liblibimagruby.so"
|
||||
Fiddle::Function::new(lib[INIT_FN], [], Fiddle::TYPE_VOIDP).call
|
||||
break;
|
||||
rescue Fiddle::DLError
|
||||
end
|
||||
end
|
||||
|
||||
color = true
|
||||
verbose = true
|
||||
debug = true
|
||||
|
||||
Imag.init_logger debug, verbose, color
|
||||
|
||||
Imag.trace "Trace-Hello from Ruby"
|
||||
Imag.dbg "Debug-Hello from Ruby"
|
||||
Imag.debug "Debug-Hello from Ruby"
|
||||
Imag.info "Info-Hello from Ruby"
|
||||
Imag.warn "Warn-Hello from Ruby"
|
||||
Imag.error "Error-Hello from Ruby"
|
||||
|
||||
def works name, b
|
||||
if b
|
||||
Imag.info "Works: #{name}"
|
||||
else
|
||||
Imag.error "Fails: #{name}"
|
||||
end
|
||||
end
|
||||
|
||||
puts "---"
|
||||
|
||||
works "RStoreId.new_baseless", (not RStoreId.new_baseless("test").nil?)
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'fiddle'
|
||||
|
||||
lib = Fiddle::dlopen '../target/debug/liblibimagruby.so'
|
||||
Fiddle::Function::new(lib['imag_ruby_initialize'], [], Fiddle::TYPE_VOIDP).call
|
||||
|
||||
works = (not RStoreId.new_baseless("test").nil?)
|
||||
Imag.init_logger true, true, true
|
||||
Imag.info "Hello from Ruby"
|
||||
|
||||
puts "Works: #{works}"
|
||||
|
Loading…
Reference in a new issue