mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Create optional with ~ instead of ?. return io::EOF?; becomes return io::EOF~.
- Deprecated use of `?` to create optional.
This commit is contained in:
@@ -34,11 +34,11 @@ faultdef SOME_FAULT, ABC_FAULT;
|
||||
fn void test_try_catch()
|
||||
{
|
||||
int val;
|
||||
int? x = ABC_FAULT?;
|
||||
int? x = ABC_FAULT~;
|
||||
assert(@try_catch(val, x, ABC_FAULT)!!);
|
||||
assert(val == 0);
|
||||
assert(!@catch(@try_catch(val, x, ABC_FAULT)));
|
||||
x = SOME_FAULT?;
|
||||
x = SOME_FAULT~;
|
||||
assert(@catch(@try_catch(val, x, ABC_FAULT)) == SOME_FAULT);
|
||||
x = 3;
|
||||
assert(!@try_catch(val, x, ABC_FAULT)!!);
|
||||
|
||||
@@ -279,11 +279,11 @@ fn void test_error()
|
||||
{
|
||||
TestFailFn ffail_void = fn void?(bool to_fail)
|
||||
{
|
||||
if (to_fail) return io::FILE_NOT_FOUND?;
|
||||
if (to_fail) return io::FILE_NOT_FOUND~;
|
||||
};
|
||||
TestIntFn ffail_int = fn int?(int a, int b)
|
||||
{
|
||||
if (b == 0) return io::FILE_NOT_FOUND?;
|
||||
if (b == 0) return io::FILE_NOT_FOUND~;
|
||||
return a / b;
|
||||
};
|
||||
test::@setup(state.setup_fn, state.teardown_fn);
|
||||
@@ -295,7 +295,7 @@ fn void test_error()
|
||||
fn void test_error_not_raised()
|
||||
{
|
||||
TestIntFn ffail_int = fn int?(int a, int b) {
|
||||
if (b == 0) return io::FILE_NOT_FOUND?;
|
||||
if (b == 0) return io::FILE_NOT_FOUND~;
|
||||
return a / b;
|
||||
};
|
||||
test::@setup(state.setup_fn, state.teardown_fn);
|
||||
@@ -307,11 +307,11 @@ fn void test_error_nofault()
|
||||
{
|
||||
TestFailFn ffail_void = fn void?(bool to_fail)
|
||||
{
|
||||
if (to_fail) return io::FILE_NOT_FOUND?;
|
||||
if (to_fail) return io::FILE_NOT_FOUND~;
|
||||
};
|
||||
TestIntFn ffail_int = fn int?(int a, int b)
|
||||
{
|
||||
if (b == 0) return io::FILE_NOT_FOUND?;
|
||||
if (b == 0) return io::FILE_NOT_FOUND~;
|
||||
return a / b;
|
||||
};
|
||||
test::@setup(state.setup_fn, state.teardown_fn);
|
||||
@@ -323,7 +323,7 @@ fn void test_error_nofault()
|
||||
fn void test_error_nofault_not_raised()
|
||||
{
|
||||
TestIntFn ffail_int = fn int?(int a, int b) {
|
||||
if (b == 0) return io::FILE_NOT_FOUND?;
|
||||
if (b == 0) return io::FILE_NOT_FOUND~;
|
||||
return a / b;
|
||||
};
|
||||
test::@setup(state.setup_fn, state.teardown_fn);
|
||||
@@ -334,7 +334,7 @@ fn void test_error_nofault_not_raised()
|
||||
fn void test_error_wrong_error_expected()
|
||||
{
|
||||
TestIntFn ffail_int = fn int?(int a, int b) {
|
||||
if (b == 0) return io::BUSY?;
|
||||
if (b == 0) return io::BUSY~;
|
||||
return a / b;
|
||||
};
|
||||
test::@setup(state.setup_fn, state.teardown_fn);
|
||||
|
||||
@@ -34,7 +34,7 @@ fn void scanner()
|
||||
if (catch err = res)
|
||||
{
|
||||
if (err == NOT_FOUND) break;
|
||||
return err?!!;
|
||||
return err~!!;
|
||||
}
|
||||
String str = (String)res;
|
||||
results.push(str.tconcat(""));
|
||||
|
||||
Reference in New Issue
Block a user