# # Rsubox - Rust single unix utilities in one executable. # Copyright (C) 2022 Ɓukasz Szpakowski # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # start_test date "date prints date" "../$RSUBOX" date -T 041015262010.37 > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content_pattern 2 '^Sat Apr 10 15:26:37 [A-Z][A-Z]* 2010' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints date without century for 1970 year" "../$RSUBOX" date -T 0209142570.36 > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content_pattern 2 '^Mon Feb 9 14:25:36 [A-Z][A-Z]* 1970' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints date without century for 2000 year" "../$RSUBOX" date -T 0209142500.36 > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content_pattern 2 '^Wed Feb 9 14:25:36 [A-Z][A-Z]* 2000' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints date without seconds" "../$RSUBOX" date -T 041015262010 > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content_pattern 2 '^Sat Apr 10 15:26:00 [A-Z][A-Z]* 2010' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints date for utc option" "../$RSUBOX" date -u -T 041015262010.37 > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Sat Apr 10 15:26:37 UTC 2010' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints hour for format" "../$RSUBOX" date -T 041015262010.37 '+%H:%M:%S' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '15:26:37' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints percent for format" "../$RSUBOX" date -T 041015262010.37 '+%%' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '%' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %a conversion" "../$RSUBOX" date -T 041015262010.37 '+%a' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Sat' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %a conversion and other date" "../$RSUBOX" date -T 040615262010.37 '+%a' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Tue' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %A conversion" "../$RSUBOX" date -T 041015262010.37 '+%A' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Saturday' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %A conversion and other date" "../$RSUBOX" date -T 040615262010.37 '+%A' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Tuesday' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %b conversion" "../$RSUBOX" date -T 041015262010.37 '+%b' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Apr' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %b conversion and other date" "../$RSUBOX" date -T 061015262010.37 '+%b' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Jun' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %B conversion" "../$RSUBOX" date -T 041015262010.37 '+%B' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'April' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %B conversion and other date" "../$RSUBOX" date -T 061015262010.37 '+%B' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'June' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %c conversion" "../$RSUBOX" date -T 041015262010.37 '+%c' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Sat Apr 10 15:26:37 2010' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %C conversion" "../$RSUBOX" date -T 041015262010.37 '+%C' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '20' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %d conversion" "../$RSUBOX" date -T 041015262010.37 '+%d' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '10' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %D conversion" "../$RSUBOX" date -T 041015262010.37 '+%D' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '04/10/10' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %D conversion and other date" "../$RSUBOX" date -T 041015262011.37 '+%D' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '04/10/11' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %e conversion" "../$RSUBOX" date -T 041015262010.37 '+%e' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '10' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %h conversion" "../$RSUBOX" date -T 041015262010.37 '+%h' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Apr' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %h conversion and other date" "../$RSUBOX" date -T 061015262010.37 '+%h' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Jun' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %H conversion" "../$RSUBOX" date -T 041015262010.37 '+%H' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '15' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %I conversion" "../$RSUBOX" date -T 041015262010.37 '+%I' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '03' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %I conversion for second date" "../$RSUBOX" date -T 041009262010.37 '+%I' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '09' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %I conversion for third date" "../$RSUBOX" date -T 041000262010.37 '+%I' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '12' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %I conversion for fourth date" "../$RSUBOX" date -T 041012262010.37 '+%I' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '12' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %j conversion" "../$RSUBOX" date -T 041015262010.37 '+%j' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '100' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %m conversion" "../$RSUBOX" date -T 041015262010.37 '+%m' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '04' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %M conversion" "../$RSUBOX" date -T 041015262010.37 '+%M' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '26' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for conversions with %n conversion" echo 15 > ../test_tmp/expected.txt echo 26 >> ../test_tmp/expected.txt "../$RSUBOX" date -T 041015262010.37 '+%H%n%M' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_compare_files 2 ../test_tmp/expected.txt ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %p conversion" "../$RSUBOX" date -T 041015262010.37 '+%p' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'PM' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %p conversion for second date" "../$RSUBOX" date -T 041009262010.37 '+%p' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'AM' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %p conversion for third date" "../$RSUBOX" date -T 041000262010.37 '+%p' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'AM' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %p conversion for fourth date" "../$RSUBOX" date -T 041012262010.37 '+%p' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'PM' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %r conversion" "../$RSUBOX" date -T 041015262010.37 '+%r' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '03:26:37 PM' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %r conversion for second date" "../$RSUBOX" date -T 041009262010.37 '+%r' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '09:26:37 AM' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %r conversion for third date" "../$RSUBOX" date -T 041000262010.37 '+%r' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '12:26:37 AM' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %r conversion for fourth date" "../$RSUBOX" date -T 041012262010.37 '+%r' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '12:26:37 PM' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %S conversion" "../$RSUBOX" date -T 041015262010.37 '+%S' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '37' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for conversions with %t conversion" printf '15\t26\n' > ../test_tmp/expected.txt "../$RSUBOX" date -T 041015262010.37 '+%H%t%M' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_compare_files 2 ../test_tmp/expected.txt ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %T conversion" "../$RSUBOX" date -T 041015262010.37 '+%T' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '15:26:37' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %u conversion" "../$RSUBOX" date -T 041015262010.37 '+%u' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '6' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %U conversion" "../$RSUBOX" date -T 041015262010.37 '+%U' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '14' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %V conversion" "../$RSUBOX" date -T 041015262010.37 '+%V' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '14' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %w conversion" "../$RSUBOX" date -T 041015262010.37 '+%w' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '6' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %W conversion" "../$RSUBOX" date -T 041015262010.37 '+%W' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '14' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %x conversion" "../$RSUBOX" date -T 041015262010.37 '+%x' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '04/10/10' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %x conversion and other date" "../$RSUBOX" date -T 041015262011.37 '+%x' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '04/10/11' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %X conversion" "../$RSUBOX" date -T 041015262010.37 '+%X' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '15:26:37' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %y conversion" "../$RSUBOX" date -T 041015262010.37 '+%y' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '10' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Y conversion" "../$RSUBOX" date -T 041015262010.37 '+%Y' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '2010' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Z conversion" "../$RSUBOX" date -T 041015262010.37 '+%Z' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content_pattern 2 '^[A-Z][A-Z]*' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Ec conversion" "../$RSUBOX" date -T 041015262010.37 '+%Ec' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 'Sat Apr 10 15:26:37 2010' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %EC conversion" "../$RSUBOX" date -T 041015262010.37 '+%EC' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '20' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Ex conversion" "../$RSUBOX" date -T 041015262010.37 '+%Ex' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '04/10/10' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %EX conversion" "../$RSUBOX" date -T 041015262010.37 '+%EX' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '15:26:37' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Ey conversion" "../$RSUBOX" date -T 041015262010.37 '+%Ey' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '10' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %EY conversion" "../$RSUBOX" date -T 041015262010.37 '+%EY' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '2010' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Od conversion" "../$RSUBOX" date -T 041015262010.37 '+%Od' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '10' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Oe conversion" "../$RSUBOX" date -T 041015262010.37 '+%Oe' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '10' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %OH conversion" "../$RSUBOX" date -T 041015262010.37 '+%OH' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '15' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %OI conversion" "../$RSUBOX" date -T 041015262010.37 '+%OI' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '03' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Om conversion" "../$RSUBOX" date -T 041015262010.37 '+%Om' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '04' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %OM conversion" "../$RSUBOX" date -T 041015262010.37 '+%OM' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '26' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %OS conversion" "../$RSUBOX" date -T 041015262010.37 '+%OS' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '37' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Ou conversion" "../$RSUBOX" date -T 041015262010.37 '+%Ou' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '6' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %OU conversion" "../$RSUBOX" date -T 041015262010.37 '+%OU' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '14' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %OV conversion" "../$RSUBOX" date -T 041015262010.37 '+%OV' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '14' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Ow conversion" "../$RSUBOX" date -T 041015262010.37 '+%Ow' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '6' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %OW conversion" "../$RSUBOX" date -T 041015262010.37 '+%OW' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '14' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date prints string for %Oy conversion" "../$RSUBOX" date -T 041015262010.37 '+%Oy' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 = "$?" ] && assert_file_content 2 '10' ../test_tmp/stdout.txt && assert_file_size 3 0 ../test_tmp/stderr.txt end_test start_test date "date complains on too many arguments" "../$RSUBOX" date -T 041015262010.37 '+%H' xxx > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 != "$?" ] && assert_file_size 2 0 ../test_tmp/stdout.txt && assert_file_content 3 "Too many arguments" ../test_tmp/stderr.txt end_test start_test date "date complains on invalid format character" "../$RSUBOX" date -T 041015262010.37 '+%f' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 != "$?" ] && assert_file_content 2 "Invalid format character" ../test_tmp/stderr.txt end_test start_test date "date complains on no format character" "../$RSUBOX" date -T 041015262010.37 '+%' > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 != "$?" ] && assert_file_content 2 "No format character" ../test_tmp/stderr.txt end_test start_test date "date complains on invalid date length" "../$RSUBOX" date -T 04101526210 > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 != "$?" ] && assert_file_content 2 "Invalid date" ../test_tmp/stderr.txt end_test start_test date "date complains on non-digit characters of date" "../$RSUBOX" date -T xx1015262010 > ../test_tmp/stdout.txt 2> ../test_tmp/stderr.txt assert 1 [ 0 != "$?" ] && assert_file_content 2 "Invalid date" ../test_tmp/stderr.txt end_test