Skip to content

Commit

Permalink
Add argument_exception unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Sep 24, 2024
1 parent bf78db5 commit f9f82c2
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,18 @@ namespace xtd::tests {
assert::are_equal("xtd::argument_exception : Test excpetion message.\n" + info.to_string(), e.to_string(), csf_);
assert::are_equal("Test excpetion message.", e.what(), csf_);
}

void test_method_(throw_if_empty) {
assert::throws<argument_exception>([]{argument_exception::throw_if_empty("");}, csf_);
assert::does_not_throw([]{argument_exception::throw_if_empty("a");}, csf_);
}

void test_method_(throw_if_empty_or_white_space) {
assert::throws<argument_exception>([]{argument_exception::throw_if_empty_or_white_space("");}, csf_);
assert::throws<argument_exception>([]{argument_exception::throw_if_empty_or_white_space(" ");}, csf_);
assert::throws<argument_exception>([]{argument_exception::throw_if_empty_or_white_space(" ");}, csf_);
assert::does_not_throw([]{argument_exception::throw_if_empty_or_white_space("a");}, csf_);
assert::does_not_throw([]{argument_exception::throw_if_empty_or_white_space(" a ");}, csf_);
}
};
}

0 comments on commit f9f82c2

Please sign in to comment.