class TestML::Library::Standard

Public Instance Methods

Catch(*args) click to toggle source
# File lib/testml/library/standard.rb, line 24
def Catch(*args)
  error = runtime.error \
    or fail "Catch called but no TestML error found"
  runtime.error = nil
  return str(error)
end
Count(list) click to toggle source
# File lib/testml/library/standard.rb, line 65
def Count(list)
  return num(list.list.value.size)
end
Get(key) click to toggle source
# File lib/testml/library/standard.rb, line 7
def Get(key)
  key = key.str.value
  return runtime.function.getvar(key)
end
GetLabel() click to toggle source

def Set(key, value)

return runtime.function.setvar(key, value)

end

# File lib/testml/library/standard.rb, line 16
def GetLabel
  return str(runtime.get_label)
end
Join(list, separator=nil) click to toggle source
# File lib/testml/library/standard.rb, line 51
def Join(list, separator=nil)
  separator = separator ? separator.value : ''
  return str(list.list.value.map {|e| e.value}.join(separator))
end
Lines(text) click to toggle source
# File lib/testml/library/standard.rb, line 69
def Lines(text)
  return list(text.value.split(/\n/).map {|l| str(l)})
end
List(*args) click to toggle source

def Bool(object)

return bool(object.bool.value)

end

# File lib/testml/library/standard.rb, line 47
def List(*args)
  return list(args)
end
Not(bool_) click to toggle source
# File lib/testml/library/standard.rb, line 56
def Not(bool_)
  return bool(bool_.bool.value ? false : true)
end
Reverse(list) click to toggle source
# File lib/testml/library/standard.rb, line 73
def Reverse(list)
  return list(list.list.value.reverse)
end
Sort(list) click to toggle source
# File lib/testml/library/standard.rb, line 77
def Sort(list)
  return list(list.list.value.sort {|a, b| a.value <=> b.value})
end
Str(object) click to toggle source
# File lib/testml/library/standard.rb, line 35
def Str(object)
  return str(object.str.value)
end
Strip(string, part) click to toggle source
# File lib/testml/library/standard.rb, line 81
def Strip(string, part)
  string = string.str.value
  part = part.str.value
  return str string.sub(part, '')
end
Text(lines) click to toggle source
# File lib/testml/library/standard.rb, line 60
def Text(lines)
  value = lines.list.value
  return str(((value.map {|l| l.value}) + ['']).join($/))
end
Throw(msg) click to toggle source
# File lib/testml/library/standard.rb, line 31
def Throw(msg)
  fail(msg.value)
end
Type(var) click to toggle source
# File lib/testml/library/standard.rb, line 20
def Type(var)
  return str(var.type)
end