src/HOL/Library/code_test.ML
changeset 72278 199dc903131b
parent 72277 48254fa33d88
child 72283 c0d04c740b8a
equal deleted inserted replaced
72277:48254fa33d88 72278:199dc903131b
   317       "    val _ = print \"" ^ end_markerN ^ "\";\n" ^
   317       "    val _ = print \"" ^ end_markerN ^ "\";\n" ^
   318       "  in\n" ^
   318       "  in\n" ^
   319       "    ()\n" ^
   319       "    ()\n" ^
   320       "  end;\n";
   320       "  end;\n";
   321     val cmd =
   321     val cmd =
   322       "\"$POLYML_EXE\" --use " ^ Bash.string (File.platform_path code_path) ^
   322       "\"$POLYML_EXE\" --use " ^ File.bash_platform_path code_path ^
   323       " --use " ^ Bash.string (File.platform_path driver_path) ^
   323       " --use " ^ File.bash_platform_path driver_path ^
   324       " --eval " ^ Bash.string "main ()"
   324       " --eval " ^ Bash.string "main ()"
   325   in
   325   in
   326     List.app (File.write code_path o snd) code_files;
   326     List.app (File.write code_path o snd) code_files;
   327     File.write driver_path driver;
   327     File.write driver_path driver;
   328     evaluate compiler cmd
   328     evaluate compiler cmd
   476 
   476 
   477     val compiled_path = Path.append dir (Path.basic "test")
   477     val compiled_path = Path.append dir (Path.basic "test")
   478     val cmd =
   478     val cmd =
   479       "\"$ISABELLE_GHC\" " ^ Code_Haskell.language_params ^ " " ^
   479       "\"$ISABELLE_GHC\" " ^ Code_Haskell.language_params ^ " " ^
   480       Config.get ctxt ghc_options ^ " -o " ^
   480       Config.get ctxt ghc_options ^ " -o " ^
   481       Bash.string (File.platform_path compiled_path) ^ " " ^
   481       File.bash_platform_path compiled_path ^ " " ^
   482       Bash.string (File.platform_path driver_path) ^ " -i" ^
   482       File.bash_platform_path driver_path ^ " -i" ^
   483       Bash.string (File.platform_path dir)
   483       File.bash_platform_path dir
   484   in
   484   in
   485     check_settings compiler ISABELLE_GHC "GHC executable";
   485     check_settings compiler ISABELLE_GHC "GHC executable";
   486     List.app (fn (name, code) => File.write (Path.append dir (Path.basic name)) code) code_files;
   486     List.app (fn (name, code) => File.write (Path.append dir (Path.basic name)) code) code_files;
   487     File.write driver_path driver;
   487     File.write driver_path driver;
   488     compile compiler cmd;
   488     compile compiler cmd;
   519       "    result.map{test:(Boolean, Option[Unit => String]) => print(format(test))};\n" ^
   519       "    result.map{test:(Boolean, Option[Unit => String]) => print(format(test))};\n" ^
   520       "    print(\"" ^ end_markerN ^ "\");\n" ^
   520       "    print(\"" ^ end_markerN ^ "\");\n" ^
   521       "  }\n" ^
   521       "  }\n" ^
   522       "}\n"
   522       "}\n"
   523     val compile_cmd =
   523     val compile_cmd =
   524       "isabelle_scala scalac $ISABELLE_SCALAC_OPTIONS -d " ^ Bash.string (File.platform_path dir) ^
   524       "isabelle_scala scalac $ISABELLE_SCALAC_OPTIONS -d " ^ File.bash_platform_path dir ^
   525       " -classpath " ^ Bash.string (File.platform_path dir) ^ " " ^
   525       " -classpath " ^ File.bash_platform_path dir ^ " " ^
   526       Bash.string (File.platform_path code_path) ^ " " ^
   526       File.bash_platform_path code_path ^ " " ^ File.bash_platform_path driver_path
   527       Bash.string (File.platform_path driver_path)
   527     val run_cmd = "isabelle_scala scala -cp " ^ File.bash_platform_path dir ^ " Test"
   528     val run_cmd =
       
   529       "isabelle_scala scala -cp " ^ Bash.string (File.platform_path dir) ^ " Test"
       
   530   in
   528   in
   531     List.app (File.write code_path o snd) code_files;
   529     List.app (File.write code_path o snd) code_files;
   532     File.write driver_path driver;
   530     File.write driver_path driver;
   533     compile compiler compile_cmd;
   531     compile compiler compile_cmd;
   534     evaluate compiler run_cmd
   532     evaluate compiler run_cmd