0
我現在都有兩個功能與測試:測試關閉了功能
function A(x) {
// do A things
return Aresults;
}
function testA() {
// this put A through its test and make sure it does what it's supposed to
}
和
function B(x) {
// do B things which involve using A
return Bresults;
}
function testB() {
// this put B through its test and make sure it does what it's supposed to
}
我現在認識到A的唯一用途是B.所以我想重新隔離和保護代碼爲因素:
function B(x) {
function A(x) {
// do A things
return Aresults;
}
// do B things which involve using A
return Bresults;
}
function testB() {
// this put B through its test and make sure it does what it's supposed to
}
我的問題是我怎麼能添加試驗A現在,它是B的關閉切換功能?即我的testA功能在哪裏?
看起來像[link](http://stackoverflow.com/questions/2932917) – Jacob 2013-03-14 14:15:51
和[link](http://stackoverflow.com/questions/8569647)爲什麼我不能在我之前找到這個問? – Jacob 2013-03-14 14:36:35