X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Flanguage%2Fcontrol%2Fdefine.at;h=9a13ea45cde5796062422467eb4b5aabda1c524d;hb=4861d99229da266945dc2dfcbda2acc9bd7b9b42;hp=c192beee0570ad464db7fefad20feabbeca40523;hpb=aaf08d6e2852ba7ff5a59baf4a31e36abc89203d;p=pspp diff --git a/tests/language/control/define.at b/tests/language/control/define.at index c192beee05..9a13ea45cd 100644 --- a/tests/language/control/define.at +++ b/tests/language/control/define.at @@ -391,6 +391,52 @@ xy. 1234. 123.]) +dnl Keep this test in sync with the examples for !HEAD in the manual. +PSPP_CHECK_MACRO_EXPANSION([!HEAD], + [DEFINE !h() +!HEAD('a b c'). +!HEAD('a'). +!HEAD(!NULL). +!HEAD(''). +!ENDDEFINE], + [!h.], + [a. +a. +. +.]) + +dnl Keep this test in sync with the examples for !TAIL in the manual. +PSPP_CHECK_MACRO_EXPANSION([!TAIL], + [DEFINE !t() +!TAIL('a b c'). +!TAIL('a'). +!TAIL(!NULL). +!TAIL(''). +!ENDDEFINE], + [!t.], + [b c. +. +. +.]) + +dnl Keep this test in sync with the examples for !INDEX in the manual. +PSPP_CHECK_MACRO_EXPANSION([!INDEX], + [DEFINE !i() +!INDEX(banana, an). +!INDEX(banana, nan). +!INDEX(banana, apple). +!INDEX("banana", nan). +!INDEX("banana", "nan"). +!INDEX(!UNQUOTE("banana"), !UNQUOTE("nan")). +!ENDDEFINE], + [!i.], + [2. +3. +0. +4. +0. +3.]) + dnl Keep this test in sync with the examples for !LENGTH in the manual. PSPP_CHECK_MACRO_EXPANSION([!LENGTH], [DEFINE !l() @@ -423,3 +469,25 @@ DEFINE !la(!positional !enclose('(',')')) 0. 5. 0.]) + +dnl Keep this test in sync with the examples for !SUBSTR in the manual. +PSPP_CHECK_MACRO_EXPANSION([!SUBSTR], + [DEFINE !s() +!SUBSTR(banana, 3). +!SUBSTR(banana, 3, 3). +!SUBSTR("banana", 3). +!SUBSTR("banana", 3, 3). +!SUBSTR(banana, 3, 0). +!SUBSTR(banana, 3, 10). +!SUBSTR(banana, 10, 3). +!ENDDEFINE.], + [!s.], + [nana. +nan. +anana". dnl" + +ana. +. +nana. +.]) +