zeolite-lang-0.24.0.0: lib/util/test/testing.0rt
/* -----------------------------------------------------------------------------
Copyright 2023 Kevin P. Barry
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
----------------------------------------------------------------------------- */
// Author: Kevin P. Barry [ta0kira@gmail.com]
testcase "CheckErrorOr success" {
success TestChecker
}
unittest value {
\ ErrorOr:value(123) `Matches:with` CheckErrorOr:value(CheckValue:equals(123))
}
unittest error {
\ ErrorOr:error("something") `Matches:with` CheckErrorOr:error(CheckValue:equals("something"))
}
testcase "CheckErrorOr:value failure with value" {
failure TestChecker
require "456"
require "123"
}
unittest test {
\ ErrorOr:value(456) `Matches:with` CheckErrorOr:value(CheckValue:equals(123))
}
testcase "CheckErrorOr:value failure with error" {
failure TestChecker
require "something"
require "123"
}
unittest test {
\ ErrorOr:error("something") `Matches:with` CheckErrorOr:value(CheckValue:equals(123))
}
testcase "CheckErrorOr:value failure with empty" {
failure TestChecker
require "empty"
require "123"
}
unittest test {
\ empty `Matches:with` CheckErrorOr:value(CheckValue:equals(123))
}
testcase "CheckErrorOr:error failure with value" {
failure TestChecker
require "456"
require "something"
}
unittest test {
\ ErrorOr:value(456) `Matches:with` CheckErrorOr:error(CheckValue:equals("something"))
}
testcase "CheckErrorOr:error failure with error" {
failure TestChecker
require "message"
require "something"
}
unittest test {
\ ErrorOr:error("message") `Matches:with` CheckErrorOr:error(CheckValue:equals("something"))
}
testcase "CheckErrorOr:error failure with empty" {
failure TestChecker
require "empty"
require "something"
}
unittest test {
\ empty `Matches:with` CheckErrorOr:error(CheckValue:equals("something"))
}
testcase "CheckErrorOr:error failure with non-Formatted" {
failure TestChecker
require "CharBuffer"
require "something"
}
unittest test {
\ ErrorOr:value(CharBuffer.new(0)) `Matches:with` CheckErrorOr:error(CheckValue:equals("something"))
}