]> git.draconx.ca Git - cdecl99.git/blobdiff - tests/internal.at
tests: Use TAP helpers in rng-test.
[cdecl99.git] / tests / internal.at
index e9fdcf4809066b8545f5c4edfb678d4afe65ebe6..1ae6f994a78829ae287639325b1eecdade3a0cf5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright © 2021 Nick Bowler
+# Copyright © 2021, 2023 Nick Bowler
 #
 # 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
@@ -16,6 +16,7 @@
 AT_BANNER([Internal library behaviour])
 
 AT_SETUP([cdecl__normalize_specs])
+AT_KEYWORDS([libcdecl internal])
 
 TEST_NEED_PROGRAM([normalize])
 
@@ -69,3 +70,44 @@ auto volatile const _Bool
 ]])
 
 AT_CLEANUP
+
+TEST_TAP_SIMPLE([cdecl__err sanity], [cdeclerr],
+  [TEST_NEED_PROGRAM([cdeclerr])], [libcdecl internal])
+
+AT_SETUP([cdecl_declare truncation])
+
+AT_DATA([input],
+[[int hello_world
+int x[1234567890]
+]])
+
+AT_CHECK([rendertest -n 0 <input], [0],
+[[15 @&t@
+17 @&t@
+]])
+
+AT_CHECK([rendertest -n 10 <input], [0],
+[[15 int hello
+17 int x@<:@123
+]])
+
+AT_CLEANUP
+
+AT_SETUP([cdecl_explain truncation])
+
+AT_DATA([input],
+[[declare x as int
+type array 123456789 of int
+]])
+
+AT_CHECK([rendertest --english -n 0 <input], [0],
+[[16 @&t@
+27 @&t@
+]])
+
+AT_CHECK([rendertest --english -n 15 <input], [0],
+[[16 declare x as i
+27 type array 123
+]])
+
+AT_CLEANUP