freebsd-skq/usr.bin/calendar/tests/calendar.cond
se b4f0bcce13 Add regression tests for conditions and comments
Fix one case where #else was not corerctly processed and simplify the
conditions logic.

Fix parsing of day and month names in the locale specified in the calendar
file. The previous version would expect those names to match the locale of
the user.

Mention that comments are now correctly processed and that // is supported
in addition to /* ... */.

MFC after:	3 days
2020-11-04 22:29:01 +00:00

83 lines
1.0 KiB
Plaintext

#define DEF1
1 1 jan 1 OK
#ifdef DEF1
1 2 jan 2 OK
#endif
1 3 jan 3 OK
#ifdef DEF2
1 4 jan 4 NOT OK
#else
1 5 jan 5 OK
#endif
#ifndef DEF2
1 6 jan 6 OK
#else
1 7 jan 7 NOT OK
#endif
#ifdef DEF1
#ifndef DEF2
1 8 jan 8 OK
#endif
#endif
#ifdef DEF1
#ifdef DEF2
1 9 jan 9 NOT OK
#else
1 10 jan 10 OK
#endif
#else
1 11 jan 11 NOT OK
#endif
#define DEF2
#ifndef DEF1 // skip = 1
#ifndef DEF2 // skip = 2
1 12 jan 12 NOT OK
#else // skip = 1 unskip = 0
1 13 jan 13 NOT OK
#endif // skip = 0 unskip = 0
#else // skip = 0 unskip = 1
1 14 jan 14 OK
#endif // skip = 0 unskip = 0
#undef DEF1
#ifdef DEF1 // OFF
#ifdef DEF2 // ON
#ifdef DEF3 // OFF
1 15 jan 15 NOT OK
#else
1 16 jan 16 NOT OK
#endif // DEF3
#else // DEF2
#ifdef DEF3
1 17 jan 17 NOT OK
#else
1 18 jan 18 NOT OK
#endif // DEF3
#endif // DEF2
#else // DEF1
#ifdef DEF2
#ifdef DEF3
1 19 jan 19 NOT OK
#else
1 20 jan 20 OK
#endif // DEF3
#else // DEF2
#ifdef DEF3
1 21 jan 21 NOT OK
#else
1 22 jan 22 NOT OK
#endif // DEF3
#endif // DEF2
#endif // DEF1
1 23 jan 23 OK