Skip to content

Commit

Permalink
More unwind tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Sep 7, 2019
1 parent 754c038 commit 49b3e77
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/unlang/interpret.c
Expand Up @@ -369,6 +369,11 @@ static inline unlang_frame_action_t result_calculate(REQUEST *request, unlang_st
*priority);
}

/*
* Not allowed in frame uflags...
*/
rad_assert(!(frame->uflags & UNWIND_FLAG_NO_CLEAR));

/*
* If we are unwinding the stack due to a break / return,
* then handle it now.
Expand Down
30 changes: 30 additions & 0 deletions src/tests/keywords/return-break-mix
@@ -0,0 +1,30 @@
update control {
&Tmp-Integer-0 += 0
&Tmp-Integer-0 += 1
&Tmp-Integer-0 += 2
&Tmp-Integer-0 += 3
}

foreach &control:Tmp-Integer-0 {
policy_return

# Should continue executing
if ("%{Foreach-Variable-0}" == '2') {
break
}

update control {
&Tmp-Integer-0 -= "%{Foreach-Variable-0}"
}
}

# Everything should have been removed except
# the last incidence of &Tmp-Integer-0
if (!&control:Tmp-Integer-0) {
test_fail
}
if (&control:Tmp-Integer-0[0] != 2) {
test_fail
}

success

0 comments on commit 49b3e77

Please sign in to comment.