| 1 | # Test advanced variable substitution edge cases |
| 2 | pattern: "(?P<user>\\w+)\\s+(?P<action>\\w+)\\s+(?P<resource>\\S+)" |
| 3 | |
| 4 | inject: |
| 5 | # Test circular references (should not crash) |
| 6 | - key: CIRCULAR_A |
| 7 | value: "A references ${CIRCULAR_B}" |
| 8 | |
| 9 | - key: CIRCULAR_B |
| 10 | value: "B references ${CIRCULAR_A}" |
| 11 | |
| 12 | # Test self-references |
| 13 | - key: SELF_REF |
| 14 | value: "Self: ${SELF_REF}" |
| 15 | |
| 16 | # Test deeply nested references |
| 17 | - key: DEEP_1 |
| 18 | value: "${DEEP_2}" |
| 19 | |
| 20 | - key: DEEP_2 |
| 21 | value: "${DEEP_3}" |
| 22 | |
| 23 | - key: DEEP_3 |
| 24 | value: "${DEEP_4}" |
| 25 | |
| 26 | - key: DEEP_4 |
| 27 | value: "Final: ${USER}" |
| 28 | |
| 29 | # Test variables with special characters |
| 30 | - key: SPECIAL_VARS |
| 31 | value: "User: ${USER}, Action: ${ACTION}, Resource: ${RESOURCE}" |
| 32 | |
| 33 | # Test undefined variable handling |
| 34 | - key: UNDEFINED_TEST |
| 35 | value: "Before ${UNDEFINED_VAR} After" |
| 36 | |
| 37 | # Test empty variable values |
| 38 | - key: EMPTY_VAR |
| 39 | value: "" |
| 40 | |
| 41 | - key: EMPTY_TEST |
| 42 | value: "Value: '${EMPTY_VAR}' (should be empty)" |
| 43 | |
| 44 | rewrite: |
| 45 | # Test variables in different contexts |
| 46 | - key: VAR_IN_MATCH |
| 47 | match: "${ACTION}" |
| 48 | value: "Matched action: ${ACTION}" |
| 49 | |
| 50 | # Test variables in key names (if supported) |
| 51 | - key: DYNAMIC_KEY_TEST |
| 52 | value: "Dynamic key based on action: ${ACTION}" |
| 53 | inject: yes |
| 54 | |
| 55 | # Test complex variable combinations |
| 56 | - key: COMPLEX_SUBSTITUTION |
| 57 | value: "${USER} performed ${ACTION} on ${RESOURCE} at ${UNDEFINED_TIME:-unknown_time}" |
| 58 | inject: yes |
| 59 | |
| 60 | # Test variables with default values (if supported) |
| 61 | - key: DEFAULT_VALUE_TEST |
| 62 | value: "${MISSING_VAR:-default_value}" |
| 63 | inject: yes |
| 64 | |
| 65 | # Test variables in rename operations |
| 66 | rename: |
| 67 | - old_key: USER |
| 68 | new_key: USERNAME |
| 69 | |
| 70 | - old_key: ACTION |
| 71 | new_key: USER_ACTION |