Last active
August 29, 2015 14:25
-
-
Save mjambon/4c4931d97c212efc7b5b to your computer and use it in GitHub Desktop.
Empty stack trace for BatString.split depending on I don't know what.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Both calls to BatString.split and List.assoc below | |
raise Not_found. The stack trace shouldn't be empty | |
in either case, but it is empty under certain mysterious | |
circumstances for BatString.split. | |
#use "topfind";; | |
#require "batteries";; | |
*) | |
let debug_this () = | |
(* Known to not produce a backtrace sometimes. Trying to find out | |
under which conditions *) | |
let split_test () = | |
try | |
ignore (BatString.split "" "x"); | |
false | |
with e -> | |
Printexc.get_backtrace () <> "" | |
in | |
(* Known to produce a backtrace even when BatString.split doesn't *) | |
let assoc_test () = | |
try | |
ignore (List.assoc 0 []); | |
false | |
with e -> | |
Printexc.get_backtrace () <> "" | |
in | |
Printexc.record_backtrace true; | |
assert (assoc_test ()); | |
Printf.eprintf "***** %s\n%!" | |
(if split_test () then "SUCCESS" else "FAILURE") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment