Skip to content

Commit 9a25458

Browse files
committed
Adding tests for assert!, write!, and writeln!
1 parent 0f561a1 commit 9a25458

File tree

2 files changed

+115
-2
lines changed

2 files changed

+115
-2
lines changed

tests/source/macros.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,17 @@ fn special_case_macros() {
266266
warn!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
267267
warn!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
268268

269-
// assert!
269+
assert!(result, "Ahoy there, {}!", target);
270270
assert!(result, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
271+
assert!(result, "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
272+
273+
write!(&mut s, "Ahoy there, {}!", target);
274+
write!(&mut s, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
275+
write!(&mut s, "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
276+
277+
writeln!(&mut s, "Ahoy there, {}!", target);
278+
writeln!(&mut s, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
279+
writeln!(&mut s, "{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
271280
}
272281

273282
// #1209

tests/target/macros.rs

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,12 +691,116 @@ fn special_case_macros() {
691691
26
692692
);
693693

694-
// assert!
694+
assert!(result, "Ahoy there, {}!", target);
695695
assert!(
696696
result,
697697
"Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
698698
result, input, expected
699699
);
700+
assert!(
701+
result,
702+
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
703+
1,
704+
2,
705+
3,
706+
4,
707+
5,
708+
6,
709+
7,
710+
8,
711+
9,
712+
10,
713+
11,
714+
12,
715+
13,
716+
14,
717+
15,
718+
16,
719+
17,
720+
18,
721+
19,
722+
20,
723+
21,
724+
22,
725+
23,
726+
24,
727+
25,
728+
26
729+
);
730+
731+
write!(&mut s, "Ahoy there, {}!", target);
732+
write!(
733+
&mut s,
734+
"Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
735+
result, input, expected
736+
);
737+
write!(
738+
&mut s,
739+
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
740+
1,
741+
2,
742+
3,
743+
4,
744+
5,
745+
6,
746+
7,
747+
8,
748+
9,
749+
10,
750+
11,
751+
12,
752+
13,
753+
14,
754+
15,
755+
16,
756+
17,
757+
18,
758+
19,
759+
20,
760+
21,
761+
22,
762+
23,
763+
24,
764+
25,
765+
26
766+
);
767+
768+
writeln!(&mut s, "Ahoy there, {}!", target);
769+
writeln!(
770+
&mut s,
771+
"Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')",
772+
result, input, expected
773+
);
774+
writeln!(
775+
&mut s,
776+
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
777+
1,
778+
2,
779+
3,
780+
4,
781+
5,
782+
6,
783+
7,
784+
8,
785+
9,
786+
10,
787+
11,
788+
12,
789+
13,
790+
14,
791+
15,
792+
16,
793+
17,
794+
18,
795+
19,
796+
20,
797+
21,
798+
22,
799+
23,
800+
24,
801+
25,
802+
26
803+
);
700804
}
701805

702806
// #1209

0 commit comments

Comments
 (0)