From: Alan T. DeKok Date: Mon, 23 Oct 2023 13:02:16 +0000 (-0400) Subject: move more update tests to edit X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc06cdac6febdb0a21fa661b1d7f45a0a045ca55;p=thirdparty%2Ffreeradius-server.git move more update tests to edit --- diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index 0802e7b0534..7f8ebcda659 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -1047,6 +1047,11 @@ static unlang_t *compile_update_to_edit(unlang_t *parent, unlang_compile_t *unla fr_token_t op; char const *attr, *value, *end; + if (cf_item_is_section(ci)) { + cf_log_err(ci, "Cannot specify subsections for 'update'"); + return NULL; + } + if (!cf_item_is_pair(ci)) continue; cp = cf_item_to_pair(ci); diff --git a/src/tests/keywords/all.mk b/src/tests/keywords/all.mk index 080890dc85b..771453c600d 100644 --- a/src/tests/keywords/all.mk +++ b/src/tests/keywords/all.mk @@ -57,18 +57,16 @@ endif # All of the "update" tests which should also be run with "-S rewrite_update=yes" # # update-attr-ref-null &foo := &bar, where bar doesn't exist. Now does nothing -# update-error-3 is now a run-time error instead of parse error -# update-group-error error is on a different line # update-null-value-assign foo := "%{...}" should be an empty string -# update-remove-index used to do???, now is parse-time error +# update-remove-index Remove by index _and_ value. Not implemented in edit code # update-filter lots of errors # # Tests for the "update" keyword -KEYWORD_UPDATE_TESTS := update-error-3 update-group-error update-null-value-assign update-remove-index update-filter vendor-specific-error +KEYWORD_UPDATE_TESTS := update-null-value-assign update-remove-index update-filter vendor-specific-error -# Tests for rewriting "udpate" -KEYWORD_UPDATE_REWRITE_TESTS := update-all update-array update-delete update-remove-any update-group update-hex update-remove-value update-index update-list-error update-remove-list update-prepend unknown-update update-error update-error-2 update-exec-error update-list-null-rhs update-exec +# Tests for rewriting "update" +KEYWORD_UPDATE_REWRITE_TESTS := update-all update-array update-delete update-remove-any update-group update-hex update-remove-value update-index update-list-error update-remove-list update-prepend unknown-update update-error update-error-2 update-exec-error update-list-null-rhs update-exec update-error-3 update-group-error # # Migration support. Some of the tests don't run under the new diff --git a/src/tests/keywords/update-group-error b/src/tests/keywords/update-group-error index 5ca4cc11160..36d10bbc055 100644 --- a/src/tests/keywords/update-group-error +++ b/src/tests/keywords/update-group-error @@ -2,14 +2,12 @@ # PRE: update # update reply { - &Tmp-String-0 := "foo" +# &Tmp-String-0 := "foo" # # This is a string, so it's NOT allowed. # - # @fixme - EDIT - the error is now on the first line - # - &Tmp-String-1 := { - Tmp-String-2 := "1.0" # ERROR + &Tmp-String-1 := { # ERROR + Tmp-String-2 := "1.0" } }