summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/expected/hexdump/format-strings-1b_char41
-rw-r--r--tests/expected/hexdump/format-strings-1b_octal41
-rw-r--r--tests/expected/hexdump/format-strings-2b_dec41
-rw-r--r--tests/expected/hexdump/format-strings-2b_hex41
-rw-r--r--tests/expected/hexdump/format-strings-2b_octal41
-rw-r--r--tests/expected/hexdump/format-strings-canon41
-rw-r--r--tests/expected/hexdump/format-strings-empty-format (renamed from tests/expected/hexdump/empty-format)0
-rwxr-xr-xtests/ts/hexdump/empty-format26
-rw-r--r--tests/ts/hexdump/files/ascii.inbin0 -> 640 bytes
-rwxr-xr-xtests/ts/hexdump/format-strings60
10 files changed, 306 insertions, 26 deletions
diff --git a/tests/expected/hexdump/format-strings-1b_char b/tests/expected/hexdump/format-strings-1b_char
new file mode 100644
index 000000000..464f50aa6
--- /dev/null
+++ b/tests/expected/hexdump/format-strings-1b_char
@@ -0,0 +1,41 @@
+0000000 \0 001 002 003 004 005 006 \a
+0000010 \b \t \n \v \f \r 016 017
+0000020 020 021 022 023 024 025 026 027
+0000030 030 031 032 033 034 035 036 037
+0000040 ! " # $ % & '
+0000050 ( ) * + , - . /
+0000060 0 1 2 3 4 5 6 7
+0000070 8 9 : ; < = > ?
+0000080 @ A B C D E F G
+0000090 H I J K L M N O
+00000a0 P Q R S T U V W
+00000b0 X Y Z [ \ ] ^ _
+00000c0 ` a b c d e f g
+00000d0 h i j k l m n o
+00000e0 p q r s t u v w
+00000f0 x y z { | } ~ 177
+0000100 302 200 302 201 302 202 302 203 302 204 302
+0000110 205 302 206 302 207 302 210 302 211 302 212
+0000120 302 213 302 214 302 215 302 216 302 217
+0000130 302 220 302 221 302 222 302 223 302 224 302
+0000140 225 302 226 302 227 302 230 302 231 302 232
+0000150 302 233 302 234 302 235 302 236 302 237
+0000160 302 240 302 241 302 242 302 243 302 244 302
+0000170 245 302 246 302 247 302 250 302 251 302 252
+0000180 302 253 302 254 302 255 302 256 302 257
+0000190 302 260 302 261 302 262 302 263 302 264 302
+00001a0 265 302 266 302 267 302 270 302 271 302 272
+00001b0 302 273 302 274 302 275 302 276 302 277
+00001c0 303 200 303 201 303 202 303 203 303 204 303
+00001d0 205 303 206 303 207 303 210 303 211 303 212
+00001e0 303 213 303 214 303 215 303 216 303 217
+00001f0 303 220 303 221 303 222 303 223 303 224 303
+0000200 225 303 226 303 227 303 230 303 231 303 232
+0000210 303 233 303 234 303 235 303 236 303 237
+0000220 303 240 303 241 303 242 303 243 303 244 303
+0000230 245 303 246 303 247 303 250 303 251 303 252
+0000240 303 253 303 254 303 255 303 256 303 257
+0000250 303 260 303 261 303 262 303 263 303 264 303
+0000260 265 303 266 303 267 303 270 303 271 303 272
+0000270 303 273 303 274 303 275 303 276 303 277
+0000280
diff --git a/tests/expected/hexdump/format-strings-1b_octal b/tests/expected/hexdump/format-strings-1b_octal
new file mode 100644
index 000000000..519d07fde
--- /dev/null
+++ b/tests/expected/hexdump/format-strings-1b_octal
@@ -0,0 +1,41 @@
+0000000 000 040 001 040 002 040 003 040 004 040 005 040 006 040 007 040
+0000010 010 040 011 040 012 040 013 040 014 040 015 040 016 040 017 040
+0000020 020 040 021 040 022 040 023 040 024 040 025 040 026 040 027 040
+0000030 030 040 031 040 032 040 033 040 034 040 035 040 036 040 037 040
+0000040 040 040 041 040 042 040 043 040 044 040 045 040 046 040 047 040
+0000050 050 040 051 040 052 040 053 040 054 040 055 040 056 040 057 040
+0000060 060 040 061 040 062 040 063 040 064 040 065 040 066 040 067 040
+0000070 070 040 071 040 072 040 073 040 074 040 075 040 076 040 077 040
+0000080 100 040 101 040 102 040 103 040 104 040 105 040 106 040 107 040
+0000090 110 040 111 040 112 040 113 040 114 040 115 040 116 040 117 040
+00000a0 120 040 121 040 122 040 123 040 124 040 125 040 126 040 127 040
+00000b0 130 040 131 040 132 040 133 040 134 040 135 040 136 040 137 040
+00000c0 140 040 141 040 142 040 143 040 144 040 145 040 146 040 147 040
+00000d0 150 040 151 040 152 040 153 040 154 040 155 040 156 040 157 040
+00000e0 160 040 161 040 162 040 163 040 164 040 165 040 166 040 167 040
+00000f0 170 040 171 040 172 040 173 040 174 040 175 040 176 040 177 040
+0000100 302 200 040 302 201 040 302 202 040 302 203 040 302 204 040 302
+0000110 205 040 302 206 040 302 207 040 302 210 040 302 211 040 302 212
+0000120 040 302 213 040 302 214 040 302 215 040 302 216 040 302 217 040
+0000130 302 220 040 302 221 040 302 222 040 302 223 040 302 224 040 302
+0000140 225 040 302 226 040 302 227 040 302 230 040 302 231 040 302 232
+0000150 040 302 233 040 302 234 040 302 235 040 302 236 040 302 237 040
+0000160 302 240 040 302 241 040 302 242 040 302 243 040 302 244 040 302
+0000170 245 040 302 246 040 302 247 040 302 250 040 302 251 040 302 252
+0000180 040 302 253 040 302 254 040 302 255 040 302 256 040 302 257 040
+0000190 302 260 040 302 261 040 302 262 040 302 263 040 302 264 040 302
+00001a0 265 040 302 266 040 302 267 040 302 270 040 302 271 040 302 272
+00001b0 040 302 273 040 302 274 040 302 275 040 302 276 040 302 277 040
+00001c0 303 200 040 303 201 040 303 202 040 303 203 040 303 204 040 303
+00001d0 205 040 303 206 040 303 207 040 303 210 040 303 211 040 303 212
+00001e0 040 303 213 040 303 214 040 303 215 040 303 216 040 303 217 040
+00001f0 303 220 040 303 221 040 303 222 040 303 223 040 303 224 040 303
+0000200 225 040 303 226 040 303 227 040 303 230 040 303 231 040 303 232
+0000210 040 303 233 040 303 234 040 303 235 040 303 236 040 303 237 040
+0000220 303 240 040 303 241 040 303 242 040 303 243 040 303 244 040 303
+0000230 245 040 303 246 040 303 247 040 303 250 040 303 251 040 303 252
+0000240 040 303 253 040 303 254 040 303 255 040 303 256 040 303 257 040
+0000250 303 260 040 303 261 040 303 262 040 303 263 040 303 264 040 303
+0000260 265 040 303 266 040 303 267 040 303 270 040 303 271 040 303 272
+0000270 040 303 273 040 303 274 040 303 275 040 303 276 040 303 277 040
+0000280
diff --git a/tests/expected/hexdump/format-strings-2b_dec b/tests/expected/hexdump/format-strings-2b_dec
new file mode 100644
index 000000000..788e97f83
--- /dev/null
+++ b/tests/expected/hexdump/format-strings-2b_dec
@@ -0,0 +1,41 @@
+0000000 08192 08193 08194 08195 08196 08197 08198 08199
+0000010 08200 08201 08202 08203 08204 08205 08206 08207
+0000020 08208 08209 08210 08211 08212 08213 08214 08215
+0000030 08216 08217 08218 08219 08220 08221 08222 08223
+0000040 08224 08225 08226 08227 08228 08229 08230 08231
+0000050 08232 08233 08234 08235 08236 08237 08238 08239
+0000060 08240 08241 08242 08243 08244 08245 08246 08247
+0000070 08248 08249 08250 08251 08252 08253 08254 08255
+0000080 08256 08257 08258 08259 08260 08261 08262 08263
+0000090 08264 08265 08266 08267 08268 08269 08270 08271
+00000a0 08272 08273 08274 08275 08276 08277 08278 08279
+00000b0 08280 08281 08282 08283 08284 08285 08286 08287
+00000c0 08288 08289 08290 08291 08292 08293 08294 08295
+00000d0 08296 08297 08298 08299 08300 08301 08302 08303
+00000e0 08304 08305 08306 08307 08308 08309 08310 08311
+00000f0 08312 08313 08314 08315 08316 08317 08318 08319
+0000100 32962 49696 08321 33474 49696 08323 33986 49696
+0000110 08325 34498 49696 08327 35010 49696 08329 35522
+0000120 49696 08331 36034 49696 08333 36546 49696 08335
+0000130 37058 49696 08337 37570 49696 08339 38082 49696
+0000140 08341 38594 49696 08343 39106 49696 08345 39618
+0000150 49696 08347 40130 49696 08349 40642 49696 08351
+0000160 41154 49696 08353 41666 49696 08355 42178 49696
+0000170 08357 42690 49696 08359 43202 49696 08361 43714
+0000180 49696 08363 44226 49696 08365 44738 49696 08367
+0000190 45250 49696 08369 45762 49696 08371 46274 49696
+00001a0 08373 46786 49696 08375 47298 49696 08377 47810
+00001b0 49696 08379 48322 49696 08381 48834 49696 08383
+00001c0 32963 49952 08321 33475 49952 08323 33987 49952
+00001d0 08325 34499 49952 08327 35011 49952 08329 35523
+00001e0 49952 08331 36035 49952 08333 36547 49952 08335
+00001f0 37059 49952 08337 37571 49952 08339 38083 49952
+0000200 08341 38595 49952 08343 39107 49952 08345 39619
+0000210 49952 08347 40131 49952 08349 40643 49952 08351
+0000220 41155 49952 08353 41667 49952 08355 42179 49952
+0000230 08357 42691 49952 08359 43203 49952 08361 43715
+0000240 49952 08363 44227 49952 08365 44739 49952 08367
+0000250 45251 49952 08369 45763 49952 08371 46275 49952
+0000260 08373 46787 49952 08375 47299 49952 08377 47811
+0000270 49952 08379 48323 49952 08381 48835 49952 08383
+0000280
diff --git a/tests/expected/hexdump/format-strings-2b_hex b/tests/expected/hexdump/format-strings-2b_hex
new file mode 100644
index 000000000..5cd11d46a
--- /dev/null
+++ b/tests/expected/hexdump/format-strings-2b_hex
@@ -0,0 +1,41 @@
+0000000 2000 2001 2002 2003 2004 2005 2006 2007
+0000010 2008 2009 200a 200b 200c 200d 200e 200f
+0000020 2010 2011 2012 2013 2014 2015 2016 2017
+0000030 2018 2019 201a 201b 201c 201d 201e 201f
+0000040 2020 2021 2022 2023 2024 2025 2026 2027
+0000050 2028 2029 202a 202b 202c 202d 202e 202f
+0000060 2030 2031 2032 2033 2034 2035 2036 2037
+0000070 2038 2039 203a 203b 203c 203d 203e 203f
+0000080 2040 2041 2042 2043 2044 2045 2046 2047
+0000090 2048 2049 204a 204b 204c 204d 204e 204f
+00000a0 2050 2051 2052 2053 2054 2055 2056 2057
+00000b0 2058 2059 205a 205b 205c 205d 205e 205f
+00000c0 2060 2061 2062 2063 2064 2065 2066 2067
+00000d0 2068 2069 206a 206b 206c 206d 206e 206f
+00000e0 2070 2071 2072 2073 2074 2075 2076 2077
+00000f0 2078 2079 207a 207b 207c 207d 207e 207f
+0000100 80c2 c220 2081 82c2 c220 2083 84c2 c220
+0000110 2085 86c2 c220 2087 88c2 c220 2089 8ac2
+0000120 c220 208b 8cc2 c220 208d 8ec2 c220 208f
+0000130 90c2 c220 2091 92c2 c220 2093 94c2 c220
+0000140 2095 96c2 c220 2097 98c2 c220 2099 9ac2
+0000150 c220 209b 9cc2 c220 209d 9ec2 c220 209f
+0000160 a0c2 c220 20a1 a2c2 c220 20a3 a4c2 c220
+0000170 20a5 a6c2 c220 20a7 a8c2 c220 20a9 aac2
+0000180 c220 20ab acc2 c220 20ad aec2 c220 20af
+0000190 b0c2 c220 20b1 b2c2 c220 20b3 b4c2 c220
+00001a0 20b5 b6c2 c220 20b7 b8c2 c220 20b9 bac2
+00001b0 c220 20bb bcc2 c220 20bd bec2 c220 20bf
+00001c0 80c3 c320 2081 82c3 c320 2083 84c3 c320
+00001d0 2085 86c3 c320 2087 88c3 c320 2089 8ac3
+00001e0 c320 208b 8cc3 c320 208d 8ec3 c320 208f
+00001f0 90c3 c320 2091 92c3 c320 2093 94c3 c320
+0000200 2095 96c3 c320 2097 98c3 c320 2099 9ac3
+0000210 c320 209b 9cc3 c320 209d 9ec3 c320 209f
+0000220 a0c3 c320 20a1 a2c3 c320 20a3 a4c3 c320
+0000230 20a5 a6c3 c320 20a7 a8c3 c320 20a9 aac3
+0000240 c320 20ab acc3 c320 20ad aec3 c320 20af
+0000250 b0c3 c320 20b1 b2c3 c320 20b3 b4c3 c320
+0000260 20b5 b6c3 c320 20b7 b8c3 c320 20b9 bac3
+0000270 c320 20bb bcc3 c320 20bd bec3 c320 20bf
+0000280
diff --git a/tests/expected/hexdump/format-strings-2b_octal b/tests/expected/hexdump/format-strings-2b_octal
new file mode 100644
index 000000000..e862131dc
--- /dev/null
+++ b/tests/expected/hexdump/format-strings-2b_octal
@@ -0,0 +1,41 @@
+0000000 020000 020001 020002 020003 020004 020005 020006 020007
+0000010 020010 020011 020012 020013 020014 020015 020016 020017
+0000020 020020 020021 020022 020023 020024 020025 020026 020027
+0000030 020030 020031 020032 020033 020034 020035 020036 020037
+0000040 020040 020041 020042 020043 020044 020045 020046 020047
+0000050 020050 020051 020052 020053 020054 020055 020056 020057
+0000060 020060 020061 020062 020063 020064 020065 020066 020067
+0000070 020070 020071 020072 020073 020074 020075 020076 020077
+0000080 020100 020101 020102 020103 020104 020105 020106 020107
+0000090 020110 020111 020112 020113 020114 020115 020116 020117
+00000a0 020120 020121 020122 020123 020124 020125 020126 020127
+00000b0 020130 020131 020132 020133 020134 020135 020136 020137
+00000c0 020140 020141 020142 020143 020144 020145 020146 020147
+00000d0 020150 020151 020152 020153 020154 020155 020156 020157
+00000e0 020160 020161 020162 020163 020164 020165 020166 020167
+00000f0 020170 020171 020172 020173 020174 020175 020176 020177
+0000100 100302 141040 020201 101302 141040 020203 102302 141040
+0000110 020205 103302 141040 020207 104302 141040 020211 105302
+0000120 141040 020213 106302 141040 020215 107302 141040 020217
+0000130 110302 141040 020221 111302 141040 020223 112302 141040
+0000140 020225 113302 141040 020227 114302 141040 020231 115302
+0000150 141040 020233 116302 141040 020235 117302 141040 020237
+0000160 120302 141040 020241 121302 141040 020243 122302 141040
+0000170 020245 123302 141040 020247 124302 141040 020251 125302
+0000180 141040 020253 126302 141040 020255 127302 141040 020257
+0000190 130302 141040 020261 131302 141040 020263 132302 141040
+00001a0 020265 133302 141040 020267 134302 141040 020271 135302
+00001b0 141040 020273 136302 141040 020275 137302 141040 020277
+00001c0 100303 141440 020201 101303 141440 020203 102303 141440
+00001d0 020205 103303 141440 020207 104303 141440 020211 105303
+00001e0 141440 020213 106303 141440 020215 107303 141440 020217
+00001f0 110303 141440 020221 111303 141440 020223 112303 141440
+0000200 020225 113303 141440 020227 114303 141440 020231 115303
+0000210 141440 020233 116303 141440 020235 117303 141440 020237
+0000220 120303 141440 020241 121303 141440 020243 122303 141440
+0000230 020245 123303 141440 020247 124303 141440 020251 125303
+0000240 141440 020253 126303 141440 020255 127303 141440 020257
+0000250 130303 141440 020261 131303 141440 020263 132303 141440
+0000260 020265 133303 141440 020267 134303 141440 020271 135303
+0000270 141440 020273 136303 141440 020275 137303 141440 020277
+0000280
diff --git a/tests/expected/hexdump/format-strings-canon b/tests/expected/hexdump/format-strings-canon
new file mode 100644
index 000000000..94fe5adbd
--- /dev/null
+++ b/tests/expected/hexdump/format-strings-canon
@@ -0,0 +1,41 @@
+00000000 00 20 01 20 02 20 03 20 04 20 05 20 06 20 07 20 |. . . . . . . . |
+00000010 08 20 09 20 0a 20 0b 20 0c 20 0d 20 0e 20 0f 20 |. . . . . . . . |
+00000020 10 20 11 20 12 20 13 20 14 20 15 20 16 20 17 20 |. . . . . . . . |
+00000030 18 20 19 20 1a 20 1b 20 1c 20 1d 20 1e 20 1f 20 |. . . . . . . . |
+00000040 20 20 21 20 22 20 23 20 24 20 25 20 26 20 27 20 | ! " # $ % & ' |
+00000050 28 20 29 20 2a 20 2b 20 2c 20 2d 20 2e 20 2f 20 |( ) * + , - . / |
+00000060 30 20 31 20 32 20 33 20 34 20 35 20 36 20 37 20 |0 1 2 3 4 5 6 7 |
+00000070 38 20 39 20 3a 20 3b 20 3c 20 3d 20 3e 20 3f 20 |8 9 : ; < = > ? |
+00000080 40 20 41 20 42 20 43 20 44 20 45 20 46 20 47 20 |@ A B C D E F G |
+00000090 48 20 49 20 4a 20 4b 20 4c 20 4d 20 4e 20 4f 20 |H I J K L M N O |
+000000a0 50 20 51 20 52 20 53 20 54 20 55 20 56 20 57 20 |P Q R S T U V W |
+000000b0 58 20 59 20 5a 20 5b 20 5c 20 5d 20 5e 20 5f 20 |X Y Z [ \ ] ^ _ |
+000000c0 60 20 61 20 62 20 63 20 64 20 65 20 66 20 67 20 |` a b c d e f g |
+000000d0 68 20 69 20 6a 20 6b 20 6c 20 6d 20 6e 20 6f 20 |h i j k l m n o |
+000000e0 70 20 71 20 72 20 73 20 74 20 75 20 76 20 77 20 |p q r s t u v w |
+000000f0 78 20 79 20 7a 20 7b 20 7c 20 7d 20 7e 20 7f 20 |x y z { | } ~ . |
+00000100 c2 80 20 c2 81 20 c2 82 20 c2 83 20 c2 84 20 c2 |.. .. .. .. .. .|
+00000110 85 20 c2 86 20 c2 87 20 c2 88 20 c2 89 20 c2 8a |. .. .. .. .. ..|
+00000120 20 c2 8b 20 c2 8c 20 c2 8d 20 c2 8e 20 c2 8f 20 | .. .. .. .. .. |
+00000130 c2 90 20 c2 91 20 c2 92 20 c2 93 20 c2 94 20 c2 |.. .. .. .. .. .|
+00000140 95 20 c2 96 20 c2 97 20 c2 98 20 c2 99 20 c2 9a |. .. .. .. .. ..|
+00000150 20 c2 9b 20 c2 9c 20 c2 9d 20 c2 9e 20 c2 9f 20 | .. .. .. .. .. |
+00000160 c2 a0 20 c2 a1 20 c2 a2 20 c2 a3 20 c2 a4 20 c2 |.. .. .. .. .. .|
+00000170 a5 20 c2 a6 20 c2 a7 20 c2 a8 20 c2 a9 20 c2 aa |. .. .. .. .. ..|
+00000180 20 c2 ab 20 c2 ac 20 c2 ad 20 c2 ae 20 c2 af 20 | .. .. .. .. .. |
+00000190 c2 b0 20 c2 b1 20 c2 b2 20 c2 b3 20 c2 b4 20 c2 |.. .. .. .. .. .|
+000001a0 b5 20 c2 b6 20 c2 b7 20 c2 b8 20 c2 b9 20 c2 ba |. .. .. .. .. ..|
+000001b0 20 c2 bb 20 c2 bc 20 c2 bd 20 c2 be 20 c2 bf 20 | .. .. .. .. .. |
+000001c0 c3 80 20 c3 81 20 c3 82 20 c3 83 20 c3 84 20 c3 |.. .. .. .. .. .|
+000001d0 85 20 c3 86 20 c3 87 20 c3 88 20 c3 89 20 c3 8a |. .. .. .. .. ..|
+000001e0 20 c3 8b 20 c3 8c 20 c3 8d 20 c3 8e 20 c3 8f 20 | .. .. .. .. .. |
+000001f0 c3 90 20 c3 91 20 c3 92 20 c3 93 20 c3 94 20 c3 |.. .. .. .. .. .|
+00000200 95 20 c3 96 20 c3 97 20 c3 98 20 c3 99 20 c3 9a |. .. .. .. .. ..|
+00000210 20 c3 9b 20 c3 9c 20 c3 9d 20 c3 9e 20 c3 9f 20 | .. .. .. .. .. |
+00000220 c3 a0 20 c3 a1 20 c3 a2 20 c3 a3 20 c3 a4 20 c3 |.. .. .. .. .. .|
+00000230 a5 20 c3 a6 20 c3 a7 20 c3 a8 20 c3 a9 20 c3 aa |. .. .. .. .. ..|
+00000240 20 c3 ab 20 c3 ac 20 c3 ad 20 c3 ae 20 c3 af 20 | .. .. .. .. .. |
+00000250 c3 b0 20 c3 b1 20 c3 b2 20 c3 b3 20 c3 b4 20 c3 |.. .. .. .. .. .|
+00000260 b5 20 c3 b6 20 c3 b7 20 c3 b8 20 c3 b9 20 c3 ba |. .. .. .. .. ..|
+00000270 20 c3 bb 20 c3 bc 20 c3 bd 20 c3 be 20 c3 bf 20 | .. .. .. .. .. |
+00000280
diff --git a/tests/expected/hexdump/empty-format b/tests/expected/hexdump/format-strings-empty-format
index 9d607966b..9d607966b 100644
--- a/tests/expected/hexdump/empty-format
+++ b/tests/expected/hexdump/format-strings-empty-format
diff --git a/tests/ts/hexdump/empty-format b/tests/ts/hexdump/empty-format
deleted file mode 100755
index 4a3e528cf..000000000
--- a/tests/ts/hexdump/empty-format
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-
-# This file is part of util-linux.
-#
-# This file 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 2 of the License, or
-# (at your option) any later version.
-#
-# This file 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.
-#
-TS_TOPDIR="$(dirname $0)/../.."
-TS_DESC="format-strings"
-
-. $TS_TOPDIR/functions.sh
-ts_init "$*"
-
-INPUT=$(printf \\1)
-$TS_CMD_HEXDUMP -n1 -ve '2 "" "%x"' <<< $INPUT 2>&1 >> $TS_OUTPUT
-
-$TS_CMD_HEXDUMP -n1 -ve '4 "%x"' -e '2 ""' <<< $INPUT 2>&1 >> $TS_OUTPUT
-
-ts_finalize
diff --git a/tests/ts/hexdump/files/ascii.in b/tests/ts/hexdump/files/ascii.in
new file mode 100644
index 000000000..4c2598b0b
--- /dev/null
+++ b/tests/ts/hexdump/files/ascii.in
Binary files differ
diff --git a/tests/ts/hexdump/format-strings b/tests/ts/hexdump/format-strings
new file mode 100755
index 000000000..9b6745c7f
--- /dev/null
+++ b/tests/ts/hexdump/format-strings
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+# This file is part of util-linux.
+#
+# This file 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 2 of the License, or
+# (at your option) any later version.
+#
+# This file 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.
+#
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="format-strings"
+FILES="$TS_TOPDIR/ts/hexdump/files"
+#sample input consists of hexdump-ed results of the following py3script:
+#for i in range(256):
+# print(chr(i), end= ' ')
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+[ -x $TS_CMD_HEXDUMP ] || ts_skip "hexdump not compiled"
+
+#885314
+ts_init_subtest "empty-format"
+INPUT=$(printf \\1)
+$TS_CMD_HEXDUMP -n1 -ve '2 "" "%x"' <<< $INPUT 2>&1 >> $TS_OUTPUT
+
+$TS_CMD_HEXDUMP -n1 -ve '4 "%x"' -e '2 ""' <<< $INPUT 2>&1 >> $TS_OUTPUT
+ts_finalize_subtest
+
+#basic formats
+ts_init_subtest "1b_octal"
+$TS_CMD_HEXDUMP -b $FILES/ascii.in &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "1b_char"
+$TS_CMD_HEXDUMP -c $FILES/ascii.in &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "canon"
+$TS_CMD_HEXDUMP -C $FILES/ascii.in &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "2b_dec"
+$TS_CMD_HEXDUMP -d $FILES/ascii.in &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "2b_octal"
+$TS_CMD_HEXDUMP -o $FILES/ascii.in &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "2b_hex"
+$TS_CMD_HEXDUMP -x $FILES/ascii.in &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_finalize