Skip to content

Commit e79afbc

Browse files
committed
[ test ] Add an example revealed to be failing
1 parent dfe6f0e commit e79afbc

File tree

7 files changed

+50
-1
lines changed

7 files changed

+50
-1
lines changed

tests/Main.idr

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ idrisTestsReflection = MkTestPool "Quotation and Reflection" [] Nothing
251251
"reflection009", "reflection010", "reflection011", "reflection012",
252252
"reflection013", "reflection014", "reflection015", "reflection016",
253253
"reflection017", "reflection018", "reflection019", "reflection020",
254-
"reflection021"]
254+
"reflection021", "reflection022"]
255255

256256
idrisTestsWith : TestPool
257257
idrisTestsWith = MkTestPool "With abstraction" [] Nothing
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module FailingRunElab
2+
3+
import ScriptDecl
4+
5+
%default total
6+
7+
%language ElabReflection
8+
9+
%runElab theScript False
10+
11+
failing "Expectedly failing"
12+
%runElab theScript True
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module ScriptDecl
2+
3+
import public Language.Reflection
4+
import SomeNonPublicExportLib
5+
6+
%default total
7+
8+
f : Bool -> Elab Bool
9+
f x = do
10+
logMsg "reflection" 0 "f \{show x}"
11+
pure x
12+
13+
export
14+
theScript : (shouldFail : Bool) -> Elab ()
15+
theScript b = do
16+
b <- traverseList [b] f
17+
case any id b of
18+
True => fail "Expectedly failing"
19+
False => declare `[
20+
x : Nat
21+
x = 5
22+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module SomeNonPublicExportLib
2+
3+
%default total
4+
5+
export
6+
traverseList : Applicative f => List a -> (a -> f b) -> f $ List b
7+
traverseList [] _ = pure []
8+
traverseList (x::xs) f = [| f x :: traverseList xs f |]

tests/idris2/reflection022/expected

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1/3: Building SomeNonPublicExportLib (SomeNonPublicExportLib.idr)
2+
2/3: Building ScriptDecl (ScriptDecl.idr)
3+
3/3: Building FailingRunElab (FailingRunElab.idr)

tests/idris2/reflection022/run

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rm -rf build
2+
3+
$1 --no-color --console-width 0 --check FailingRunElab.idr

tests/idris2/reflection022/test.ipkg

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package a-test

0 commit comments

Comments
 (0)