へんにね
合わせすぎても
たぶん
つらいだけさ
Summary
おてがるテスト
Motivation
愛用してる perssimon.script が travis
で動作しなくなってるため、急遽書いた
like this
// かんたんチェッカー
let check x y =
stdout.WriteLine " ----------------------------------- "
if x = y then
"OK" |> printfn "%A"
x |> printfn "%A"
y |> printfn "%A"
else
"NG" |> printfn "%A"
x |> printfn "%A"
y |> printfn "%A"
raise (System.ArgumentException("===== NG =====") )
// --------------------------------------------------------
// 使い方
// --------------------------------------------------------
// OK
check 1 1
check "foo" "foo"
check [1..10] [1..10]
// NG -> エラーを発生させる
check 1 2
結果
[Loading /Users/callmekohei/foo.fsx]
-----------------------------------
"OK"
1
1
-----------------------------------
"OK"
"foo"
"foo"
-----------------------------------
"OK"
[1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
[1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
-----------------------------------
"NG"
1
2
System.ArgumentException: ===== NG =====
at FSI_0008.Foo.check[0] (a x, a y) [0x00108] in <062d34e0fb6f431f9681f515345f5230>:0
at <StartupCode$FSI_0008>.$FSI_0008_Foo$fsx.main@ () [0x00062] in <062d34e0fb6f431f9681f515345f5230>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0003b] in <547b0ab402754bd3aef2dcb174312979>:0
Stopped due to error
*** time : 0.12656 s ***
まぁこれでいいのだ