Class: Yast::AssertClass Deprecated

Inherits:
Module
  • Object
show all
Defined in:
library/general/src/modules/Assert.rb

Overview

Deprecated.

use rspec tests instead

Provides assertions for old yast testsuite

Instance Method Summary collapse

Instance Method Details

#Equal(expected, actual) ⇒ Object

Returns whether test succeeds

Parameters:

  • expected (Object)

    expected value of test

  • actual (Object)

    actual value of test

Returns:

  • whether test succeeds



46
47
48
49
50
51
52
53
54
55
# File 'library/general/src/modules/Assert.rb', line 46

def Equal(expected, actual)
  expected = deep_copy(expected)
  actual = deep_copy(actual)
  fail_message = Builtins.sformat(
    "assertion failure, expected '%1', got '%2'",
    expected,
    actual
  )
  EqualMsg(expected, actual, fail_message)
end

#EqualMsg(expected, actual, fail_message) ⇒ Object

Returns whether test succeeds

Parameters:

  • expected (Object)

    expected value of test

  • actual (Object)

    actual value of test

  • fail_message (String)

    will be logged if test fails

Returns:

  • whether test succeeds



34
35
36
37
38
39
40
41
# File 'library/general/src/modules/Assert.rb', line 34

def EqualMsg(expected, actual, fail_message)
  expected = deep_copy(expected)
  actual = deep_copy(actual)
  return true if expected == actual

  Builtins.y2error("%1", fail_message)
  false
end