Clojure

Add mechanism to temporarily replace root bindings of vars

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.3
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

There are cases, such as mocking out functions during testing, where it is useful to replace the root bindings of vars (dynamic or otherwise) with new values temporarily, and have them reliably set back to their original values when done.

Some discussion here: http://clojure-log.n01se.net/date/2010-10-29.html#09:11

Activity

Hide
Chouser added a comment -

Attached patch includes a with-redefs macro and a with-redefs-fn, as well as a couple tests.

Show
Chouser added a comment - Attached patch includes a with-redefs macro and a with-redefs-fn, as well as a couple tests.
Hide
Stuart Halloway added a comment -

Second patch subsumes first, improves tests

Show
Stuart Halloway added a comment - Second patch subsumes first, improves tests

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: