Module: Hash::Etest

Defined in:
lib/vex/base/system.rb,
lib/vex/base/hash/inspect.rb

Instance Method Summary collapse

Instance Method Details

#test_inspectObject



13
14
15
16
# File 'lib/vex/base/hash/inspect.rb', line 13

def test_inspect
  h = {"b" => 2, :a => 2}
  assert_equal('{:a => 2, "b" => 2}', h.inspect)
end

#test_systemObject



58
59
60
61
62
# File 'lib/vex/base/system.rb', line 58

def test_system
  assert_equal true, System.sys("true")
  assert_equal false, System.sys("false")
  assert_equal false, System.sys("command_not_existing")
end

#test_system!Object



64
65
66
67
68
# File 'lib/vex/base/system.rb', line 64

def test_system!
  assert_nothing_raised { System.sys!("true") }
  assert_raise(System::ProcessFailed) { System.sys!("false") }
  assert_raise(System::ProcessFailed) { System.sys!("command_not_existing") }
end

#test_whichObject



70
71
72
73
# File 'lib/vex/base/system.rb', line 70

def test_which
  assert_equal "/bin/ls", System.which("ls")
  assert_equal nil, System.which("lslslslslslslslslslslslslslsls")
end

#test_which!Object



75
76
77
78
79
80
# File 'lib/vex/base/system.rb', line 75

def test_which!
  assert_equal "/bin/ls", System.which!("ls")
  assert_raise(SystemExit) {  
    System.which!("lslslslslslslslslslslslslslsls")
  }
end