camlspotter avatar camlspotter committed edee448

added a test

Comments (0)

Files changed (3)

dcamlexamples/auto-test.pl

   elsif( $? == 512 ){ $result = "ERROR: $result"; }
   elsif( $? != 0 ){ $result = "$?!!!"; }
   else { $result = "OK"; }
-  if( $file =~ /error/ && $result =~ /^ERROR/ ){
-      $result = "OK (error)";
+  if( $file =~ /error/ ){
+      if ($result =~ /^ERROR/ ){
+          $result = "OK (error as intended)";
+      } elsif ( $result =~ /^OK/ ) {
+          $result = "ERROR: passed!";
+      }
   }
   print "$file:\t$result\n";
   while (<IN>) { print $_; }

dcamltests/auto-test.pl

   elsif( $? == 512 ){ $result = "ERROR: $result"; }
   elsif( $? != 0 ){ $result = "$?!!!"; }
   else { $result = "OK"; }
-  if( $file =~ /error/ && $result =~ /^ERROR/ ){
-      $result = "OK (error)";
+  if( $file =~ /error/ ){
+      if ($result =~ /^ERROR/ ){
+          $result = "OK (error as intended)";
+      } elsif ( $result =~ /^OK/ ) {
+          $result = "ERROR: passed!";
+      }
   }
   print "$file:\t$result\n";
   while (<IN>) { print $_; }

dcamltests/non_generalizable_error.ml

+module Plus : sig
+  type 'a t
+  val (+) : $:'a t -> 'a -> 'a -> 'a
+  val int : int t
+  val float : float t
+end = struct
+  type 'a t = 'a -> 'a -> 'a
+  let (+) $:a = a
+  let int = Pervasives.(+)
+  let float = (+.)
+end
+
+open Plus
+
+let () =
+  assert (1 + 2 = 3);
+  assert (1.2 + 3.4 = 4.6);
+;;
+
+let x = ref []
+
+let z =
+  let double () = List.hd !x + List.hd !x in
+  double () = 1;
+  double () = 1.2;
+;;
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.