Diffstat (limited to 'frontend/gamma/tests/SimpleTest/SimpleTest.Async.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/tests/SimpleTest/SimpleTest.Async.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/gamma/tests/SimpleTest/SimpleTest.Async.js b/frontend/gamma/tests/SimpleTest/SimpleTest.Async.js index 3633182..268a04d 100644 --- a/frontend/gamma/tests/SimpleTest/SimpleTest.Async.js +++ b/frontend/gamma/tests/SimpleTest/SimpleTest.Async.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | MochiKit.Base.update(Clipperz.Async.Deferred.prototype, { | 24 | MochiKit.Base.update(Clipperz.Async.Deferred.prototype, { |
27 | /* | 25 | /* |
28 | '_addTest': function(anExpectedValue, aDescription, isDeep, aResult) { | 26 | '_addTest': function(anExpectedValue, aDescription, isDeep, aResult) { |
29 | if (isDeep) { | 27 | if (isDeep) { |
30 | SimpleTest.isDeeply(aResult, anExpectedValue, aDescription); | 28 | SimpleTest.isDeeply(aResult, anExpectedValue, aDescription); |
31 | } else { | 29 | } else { |
32 | SimpleTest.is(aResult, anExpectedValue, aDescription); | 30 | SimpleTest.is(aResult, anExpectedValue, aDescription); |
33 | } | 31 | } |
34 | 32 | ||
35 | return aResult; | 33 | return aResult; |
36 | }, | 34 | }, |
37 | */ | 35 | */ |
38 | 'addTest': function (anExpectedValue, aDescription, isDeep) { | 36 | 'addTest': function (anExpectedValue, aDescription, isDeep) { |
39 | // this.addMethod(this, '_addTest', anExpectedValue, aDescription, isDeep); | 37 | // this.addMethod(this, '_addTest', anExpectedValue, aDescription, isDeep); |
40 | // this.addCallback(Clipperz.Async.test, anExpectedValue, aDescription, isDeep); | 38 | // this.addCallback(Clipperz.Async.test, anExpectedValue, aDescription, isDeep); |
41 | 39 | ||
42 | if (isDeep) { | 40 | if (isDeep) { |
43 | // SimpleTest.isDeeply(aResult, anExpectedValue, aDescription); | 41 | // SimpleTest.isDeeply(aResult, anExpectedValue, aDescription); |
44 | this.addCallback(Clipperz.Async.Test.isDeeply(anExpectedValue, aDescription)); | 42 | this.addCallback(Clipperz.Async.Test.isDeeply(anExpectedValue, aDescription)); |
45 | } else { | 43 | } else { |
46 | // SimpleTest.is(aResult, anExpectedValue, aDescription); | 44 | // SimpleTest.is(aResult, anExpectedValue, aDescription); |
47 | this.addCallback(Clipperz.Async.Test.is(anExpectedValue, aDescription)); | 45 | this.addCallback(Clipperz.Async.Test.is(anExpectedValue, aDescription)); |
48 | } | 46 | } |
49 | }, | 47 | }, |
50 | 48 | ||
51 | //------------------------------------------------------------------------- | 49 | //------------------------------------------------------------------------- |
52 | 50 | ||
53 | 'shouldSucceed': function (aDescription) { | 51 | 'shouldSucceed': function (aDescription) { |
54 | this.addCallbackPass(SimpleTest.ok, true, aDescription); | 52 | this.addCallbackPass(SimpleTest.ok, true, aDescription); |
55 | this.addErrbackPass (SimpleTest.ok, false, aDescription); | 53 | this.addErrbackPass (SimpleTest.ok, false, aDescription); |
56 | this.addBoth(MochiKit.Async.succeed, null); | 54 | this.addBoth(MochiKit.Async.succeed, null); |
57 | }, | 55 | }, |
58 | 56 | ||
59 | 'shouldFail': function (aDescription) { | 57 | 'shouldFail': function (aDescription) { |
60 | this.addCallbackPass(SimpleTest.ok, false, aDescription); | 58 | this.addCallbackPass(SimpleTest.ok, false, aDescription); |
61 | this.addErrbackPass (SimpleTest.ok, true, aDescription); | 59 | this.addErrbackPass (SimpleTest.ok, true, aDescription); |
62 | this.addBoth(MochiKit.Async.succeed, null); | 60 | this.addBoth(MochiKit.Async.succeed, null); |
63 | }, | 61 | }, |
64 | 62 | ||
65 | //------------------------------------------------------------------------- | 63 | //------------------------------------------------------------------------- |
66 | 64 | ||
67 | }); | 65 | }); |
68 | 66 | ||
69 | 67 | ||
70 | Clipperz.Async.Test = {}; | 68 | Clipperz.Async.Test = {}; |
71 | MochiKit.Base.update(Clipperz.Async.Test, { | 69 | MochiKit.Base.update(Clipperz.Async.Test, { |
72 | 70 | ||
73 | 'is': function (anExpectedResult, aDescription) { | 71 | 'is': function (anExpectedResult, aDescription) { |
74 | return MochiKit.Base.partial(function (anExpectedResult, aDescription, aResult) { | 72 | return MochiKit.Base.partial(function (anExpectedResult, aDescription, aResult) { |
75 | SimpleTest.is(aResult, anExpectedResult, aDescription); | 73 | SimpleTest.is(aResult, anExpectedResult, aDescription); |
76 | 74 | ||
77 | return aResult; | 75 | return aResult; |
78 | }, anExpectedResult, aDescription); | 76 | }, anExpectedResult, aDescription); |
79 | }, | 77 | }, |
80 | 78 | ||
81 | //------------------------------------------------------------------------- | 79 | //------------------------------------------------------------------------- |
82 | 80 | ||
83 | 'ok': function (aDescription) { | 81 | 'ok': function (aDescription) { |
84 | return MochiKit.Base.partial(function (aDescription, aResult) { | 82 | return MochiKit.Base.partial(function (aDescription, aResult) { |
85 | SimpleTest.ok(aResult, aDescription); | 83 | SimpleTest.ok(aResult, aDescription); |
86 | 84 | ||
87 | return aResult; | 85 | return aResult; |
88 | }, aDescription); | 86 | }, aDescription); |
89 | }, | 87 | }, |
90 | 88 | ||
91 | //------------------------------------------------------------------------- | 89 | //------------------------------------------------------------------------- |
92 | 90 | ||
93 | 'fail': function(aDescription) { | 91 | 'fail': function(aDescription) { |
94 | return MochiKit.Base.partial(function (aDescription, aResult) { | 92 | return MochiKit.Base.partial(function (aDescription, aResult) { |
95 | SimpleTest.ok(!aResult, aDescription); | 93 | SimpleTest.ok(!aResult, aDescription); |
96 | 94 | ||
97 | return aResult; | 95 | return aResult; |
98 | }, aDescription); | 96 | }, aDescription); |
99 | }, | 97 | }, |
100 | 98 | ||
101 | //------------------------------------------------------------------------- | 99 | //------------------------------------------------------------------------- |
102 | 100 | ||
103 | 'isDeeply': function (anExpectedResult, aDescription) { | 101 | 'isDeeply': function (anExpectedResult, aDescription) { |
104 | return MochiKit.Base.partial(function (anExpectedResult, aDescription, aResult) { | 102 | return MochiKit.Base.partial(function (anExpectedResult, aDescription, aResult) { |
105 | SimpleTest.isDeeply(aResult, anExpectedResult, aDescription); | 103 | SimpleTest.isDeeply(aResult, anExpectedResult, aDescription); |
106 | 104 | ||
107 | return aResult; | 105 | return aResult; |
108 | }, anExpectedResult, aDescription); | 106 | }, anExpectedResult, aDescription); |
109 | }, | 107 | }, |
110 | 108 | ||
111 | //------------------------------------------------------------------------- | 109 | //------------------------------------------------------------------------- |
112 | __syntaxFix__: "syntax fix" | 110 | __syntaxFix__: "syntax fix" |
113 | }); | 111 | }); |
114 | 112 | ||
115 | 113 | ||
116 | SimpleTest.runDeferredTests = function (aName, aTestSet, aTestArguments) { | 114 | SimpleTest.runDeferredTests = function (aName, aTestSet, aTestArguments) { |
117 | try { | 115 | try { |
118 | var deferredTests; | 116 | var deferredTests; |