tests: close files in glr-regression
authorTheophile Ranquet <ranquet@lrde.epita.fr>
Mon, 12 Nov 2012 15:41:52 +0000 (15:41 +0000)
committerAkim Demaille <akim@lrde.epita.fr>
Mon, 12 Nov 2012 15:46:57 +0000 (16:46 +0100)
* tests/glr-regression.at: Here.

tests/glr-regression.at

index 7df17b6..6ca021f 100644 (file)
@@ -196,8 +196,12 @@ int
 main (int argc, char **argv)
 {
   input = stdin;
-  if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3;
-  return yyparse ();
+  if (argc == 2 && !(input = fopen (argv[1], "r")))
+    return 3;
+  int res = yyparse ();
+  if (argc == 2 && fclose (input))
+    return 4;
+  return res;
 }
 ]])
 AT_BISON_OPTION_POPDEFS
@@ -324,8 +328,12 @@ int
 main(int argc, char* argv[])
 {
   input = stdin;
-  if (argc == 2 && !(input = fopen (argv[1], "r"))) return 3;
-  return yyparse ();
+  if (argc == 2 && !(input = fopen (argv[1], "r")))
+    return 3;
+  int res = yyparse ();
+  if (argc == 2 && fclose (input))
+    return 4;
+  return res;
 }
 ]])
 AT_BISON_OPTION_POPDEFS