55mod common;
66use common:: { ExecuteValidateLoggerDatabase , LogDatabase } ;
77use expect_test:: expect;
8- use salsa:: { CycleRecoveryAction , Database as Db , DatabaseImpl as DbImpl , Durability , Setter } ;
8+ use salsa:: {
9+ CycleRecoveryAction , Database as Db , DatabaseImpl as DbImpl , Durability , Setter ,
10+ UnexpectedCycle ,
11+ } ;
912#[ cfg( not( miri) ) ]
1013use test_log:: test;
1114
@@ -222,14 +225,12 @@ fn value(num: u8) -> Input {
222225///
223226/// Simple self-cycle, no iteration, should panic.
224227#[ test]
225- #[ should_panic( expected = "dependency graph cycle" ) ]
226228fn self_panic ( ) {
227229 let mut db = DbImpl :: new ( ) ;
228230 let a_in = Inputs :: new ( & db, vec ! [ ] ) ;
229231 let a = Input :: MinPanic ( a_in) ;
230232 a_in. set_inputs ( & mut db) . to ( vec ! [ a. clone( ) ] ) ;
231-
232- a. eval ( & db) ;
233+ UnexpectedCycle :: catch ( || a. eval ( & db) ) . unwrap_err ( ) ;
233234}
234235
235236/// a:Np(u10, a) -+
@@ -238,14 +239,13 @@ fn self_panic() {
238239///
239240/// Simple self-cycle with untracked read, no iteration, should panic.
240241#[ test]
241- #[ should_panic( expected = "dependency graph cycle" ) ]
242242fn self_untracked_panic ( ) {
243243 let mut db = DbImpl :: new ( ) ;
244244 let a_in = Inputs :: new ( & db, vec ! [ ] ) ;
245245 let a = Input :: MinPanic ( a_in) ;
246246 a_in. set_inputs ( & mut db) . to ( vec ! [ untracked( 10 ) , a. clone( ) ] ) ;
247247
248- a. eval ( & db) ;
248+ UnexpectedCycle :: catch ( || a. eval ( & db) ) . unwrap_err ( ) ;
249249}
250250
251251/// a:Ni(a) -+
@@ -289,7 +289,6 @@ fn two_mixed_converge_initial_value() {
289289/// Two-query cycle, one with iteration and one without.
290290/// If we enter from the one with no iteration, we panic.
291291#[ test]
292- #[ should_panic( expected = "dependency graph cycle" ) ]
293292fn two_mixed_panic ( ) {
294293 let mut db = DbImpl :: new ( ) ;
295294 let a_in = Inputs :: new ( & db, vec ! [ ] ) ;
@@ -299,7 +298,7 @@ fn two_mixed_panic() {
299298 a_in. set_inputs ( & mut db) . to ( vec ! [ b] ) ;
300299 b_in. set_inputs ( & mut db) . to ( vec ! [ a. clone( ) ] ) ;
301300
302- a. eval ( & db) ;
301+ UnexpectedCycle :: catch ( || a. eval ( & db) ) . unwrap_err ( ) ;
303302}
304303
305304/// a:Ni(b) --> b:Xi(a)
@@ -370,7 +369,6 @@ fn two_indirect_iterate_converge_initial_value() {
370369///
371370/// Two-query cycle, enter indirectly at node without iteration, panic.
372371#[ test]
373- #[ should_panic( expected = "dependency graph cycle" ) ]
374372fn two_indirect_panic ( ) {
375373 let mut db = DbImpl :: new ( ) ;
376374 let a_in = Inputs :: new ( & db, vec ! [ ] ) ;
@@ -383,7 +381,7 @@ fn two_indirect_panic() {
383381 b_in. set_inputs ( & mut db) . to ( vec ! [ c] ) ;
384382 c_in. set_inputs ( & mut db) . to ( vec ! [ b] ) ;
385383
386- a. eval ( & db) ;
384+ UnexpectedCycle :: catch ( || a. eval ( & db) ) . unwrap_err ( ) ;
387385}
388386
389387/// a:Np(b) -> b:Ni(v200,c) -> c:Xp(b)
0 commit comments