English 中文(简体)
如何在米杰实施?
原标题:How is provided implemented in a fact in Midje?

我正在阅读关于TDD的第8号行动文件中的“克隆”,并尝试模拟宏观。 它利用具有活力的具有约束力的机制来阻止职能。 Alas, in Clojure 1.3, it is not possible to use the binding mechanism for non-dynamic vars, so the stubbing men don t work in most cases, than You specified the var which points to a function Dynamic. 然后,我想知道,在Midje是如何做的,并试图找到所提供的来源,但我无法找到。 因此:

如何在米杰实施? 是否有人对此作出详细解释?

最佳回答

彩礼1.3 提供了一种微粒,甚至与已宣布有活力的var合在一起:

user=> (def this-is-not-dynamic)
user=> (with-redefs [this-is-not-dynamic 900] this-is-not-dynamic)
900

对于落后的兼容性, Midje使用自己的版本,其口号类似:

(defn alter-one-root [[variable new-value]]
   (if (bound? variable) 
     (let [old-value (deref variable)]
       (alter-var-root variable (fn [current-value] new-value))
       [variable old-value])
     (do
       (.bindRoot variable new-value)
       [variable unbound-marker])))
问题回答

暂无回答




相关问题
Separating rapid development from refactoring/optimization

I m working in a team of 2 front-end developers on a web-based late-stage startup project. The site works quite well, but there s a lot of room for improvement code-wise, as the code is quite messy ...

Test-driven development with ASP.NET MVC - where to begin?

I ve read a lot about Test-Driven Development (TDD) and I find the principles very compelling, based on personal experience. At the moment I m developing a website for a start-up project I m involved ...

Silencing Factory Girl logging

Just to clear the air, I am not some cruel factory master trying to silence working ladies. I am having a very annoying problem where when using Thoughtbot s factory girl in my specs, every time ...

TDD vs. Unit testing [closed]

My company is fairly new to unit testing our code. I ve been reading about TDD and unit testing for some time and am convinced of their value. I ve attempted to convince our team that TDD is worth ...

unit test a method that creates an object

I m trying to get my head round Unit Testing and there s one more piece of the jigsaw I need to find. What I m trying to do is write tests for the following code. In this case, I ve got a really ...

Testing private method of an abstract class using Reflection

How can I test a private method of an abstract class using reflection (using C#)? I am specifically interested in adapting the code found in this thread. I am aware of the discussion around the ...

C#: How would you unit test GetHashCode?

Testing the Equals method is pretty much straight forward (as far as I know). But how on earth do you test the GetHashCode method?

热门标签