mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-16 02:15:01 +01:00
if
This commit is contained in:
parent
88a3a585e7
commit
4e30201be4
11 changed files with 222 additions and 20 deletions
53
tests/control_flow.rs
Normal file
53
tests/control_flow.rs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
mod common;
|
||||
use crate::common::_run_test;
|
||||
|
||||
run_test!(
|
||||
single_if,
|
||||
r#"
|
||||
if true {
|
||||
print "true!";
|
||||
}
|
||||
|
||||
if false {
|
||||
print "WRONG";
|
||||
}
|
||||
"#
|
||||
);
|
||||
|
||||
run_test!(
|
||||
if_else,
|
||||
r#"
|
||||
if true {
|
||||
print "true!";
|
||||
} else {
|
||||
print "WRONG";
|
||||
}
|
||||
|
||||
if false {
|
||||
print "WRONG";
|
||||
} else {
|
||||
print "true!";
|
||||
}
|
||||
"#
|
||||
);
|
||||
|
||||
run_test!(
|
||||
if_else_if,
|
||||
r#"
|
||||
if false {
|
||||
print "WRONG";
|
||||
} else if true {
|
||||
print "true!";
|
||||
} else {
|
||||
print "WRONG";
|
||||
}
|
||||
|
||||
if false {
|
||||
print "WRONG";
|
||||
} else if false {
|
||||
print "WRONG";
|
||||
} else {
|
||||
print "true!";
|
||||
}
|
||||
"#
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue