1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
// #Conformance
#if ALL_IN_ONE
module Core_nested
#endif
let failures = ref []
let report_failure (s : string) =
stderr.Write" NO: "
stderr.WriteLine s
failures := !failures @ [s]
let test (s : string) b =
stderr.Write(s)
if b then stderr.WriteLine " OK"
else report_failure (s)
let check s b1 b2 = test s (b1 = b2)
#if NetCore
#else
let argv = System.Environment.GetCommandLineArgs()
let SetCulture() =
if argv.Length > 2 && argv.[1] = "--culture" then begin
let cultureString = argv.[2] in
let culture = new System.Globalization.CultureInfo(cultureString) in
stdout.WriteLine ("Running under culture "+culture.ToString()+"...");
System.Threading.Thread.CurrentThread.CurrentCulture <- culture
end
do SetCulture()
#endif
let f () = 3
let wher = ref []
let spot x = wher := !wher @ [x]; stderr.WriteLine(x:string)
do spot "Initialized before X1 OK"
module X1 = begin
type x = X | Y
let y = 3
do spot "Initialized X1 OK";
end
module X2 = begin
type x = X | Y
let x = 3
let y () = X
let z = x + (match y() with X -> 4 | Y -> 5)
do spot "Initialized X2 OK";
end
module X3 = begin
let y = X2.X
do spot "Initialized X3 OK";
end
do spot "Initialized after X3 OK"
let _ = X2.z + X2.x + X1.y
do test "uyf78" (!wher = [ "Initialized before X1 OK";
"Initialized X1 OK";
"Initialized X2 OK";
"Initialized X3 OK";
"Initialized after X3 OK" ])
#if ALL_IN_ONE
let RUN() = !failures
#else
let aa =
match !failures with
| [] ->
stdout.WriteLine "Test Passed"
System.IO.File.WriteAllText("test.ok","ok")
exit 0
| _ ->
stdout.WriteLine "Test Failed"
exit 1
#endif
|