Trapped-Tests.deploy.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. define("gh_herby_trapped/Trapped-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber/SUnit"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Trapped-Tests');
  3. smalltalk.packages["Trapped-Tests"].transport = {"type":"amd","amdNamespace":"gh_herby_trapped"};
  4. smalltalk.addClass('IsolatorTest', smalltalk.TestCase, ['rootModel'], 'Trapped-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "setUp",
  8. fn: function (){
  9. var self=this;
  10. function $EavModel(){return smalltalk.EavModel||(typeof EavModel=="undefined"?nil:EavModel)}
  11. return smalltalk.withContext(function($ctx1) {
  12. var $1,$2;
  13. $1=_st($EavModel())._new();
  14. _st($1)._getBlock_((function(x){
  15. return smalltalk.withContext(function($ctx2) {
  16. return _st(x)._root();
  17. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}));
  18. $2=_st($1)._putBlock_((function(x,y){
  19. return smalltalk.withContext(function($ctx2) {
  20. return _st(x)._root_(y);
  21. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}));
  22. self["@rootModel"]=$2;
  23. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.IsolatorTest)})},
  24. messageSends: ["getBlock:", "root", "new", "putBlock:", "root:"]}),
  25. smalltalk.IsolatorTest);
  26. smalltalk.addMethod(
  27. smalltalk.method({
  28. selector: "testNontrivialModelGetsAppropriateValueForModification",
  29. fn: function (){
  30. var self=this;
  31. var isolator,model,result;
  32. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  33. function $EavModel(){return smalltalk.EavModel||(typeof EavModel=="undefined"?nil:EavModel)}
  34. return smalltalk.withContext(function($ctx1) {
  35. var $1,$2;
  36. result=nil;
  37. isolator=_st($Isolator())._on_(smalltalk.HashedCollection._from_(["foo".__minus_gt(["bar", [(1), [(2), (5)]], "baz"]),"moo".__minus_gt("zoo")]));
  38. $1=_st($EavModel())._new();
  39. _st($1)._getBlock_((function(x){
  40. return smalltalk.withContext(function($ctx2) {
  41. return _st(_st(_st(x)._root())._at_("foo"))._at_((2));
  42. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}));
  43. $2=_st($1)._putBlock_((function(x,y){
  44. return smalltalk.withContext(function($ctx2) {
  45. return _st(_st(_st(x)._root())._at_("foo"))._at_put_((2),y);
  46. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}));
  47. model=$2;
  48. _st(isolator)._model_modify_(model,(function(r){
  49. return smalltalk.withContext(function($ctx2) {
  50. result=r;
  51. return result;
  52. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  53. self._assert_equals_([(1), [(2), (5)]],result);
  54. return self}, function($ctx1) {$ctx1.fill(self,"testNontrivialModelGetsAppropriateValueForModification",{isolator:isolator,model:model,result:result},smalltalk.IsolatorTest)})},
  55. messageSends: ["on:", "->", "getBlock:", "at:", "root", "new", "putBlock:", "at:put:", "model:modify:", "assert:equals:"]}),
  56. smalltalk.IsolatorTest);
  57. smalltalk.addMethod(
  58. smalltalk.method({
  59. selector: "testNontrivialModelModifiesAppropriateValue",
  60. fn: function (){
  61. var self=this;
  62. var isolator,model,result;
  63. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  64. function $EavModel(){return smalltalk.EavModel||(typeof EavModel=="undefined"?nil:EavModel)}
  65. return smalltalk.withContext(function($ctx1) {
  66. var $1,$2;
  67. result=nil;
  68. isolator=_st($Isolator())._on_(smalltalk.HashedCollection._from_(["foo".__minus_gt(["bar", [(1), [(2), (3)]], "baz"]),"moo".__minus_gt("zoo")]));
  69. $1=_st($EavModel())._new();
  70. _st($1)._getBlock_((function(x){
  71. return smalltalk.withContext(function($ctx2) {
  72. return _st(_st(_st(x)._root())._at_("foo"))._at_((2));
  73. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}));
  74. $2=_st($1)._putBlock_((function(x,y){
  75. return smalltalk.withContext(function($ctx2) {
  76. return _st(_st(_st(x)._root())._at_("foo"))._at_put_((2),y);
  77. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1)})}));
  78. model=$2;
  79. _st(isolator)._model_modify_(model,(function(r){
  80. return smalltalk.withContext(function($ctx2) {
  81. return "new";
  82. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  83. _st(isolator)._model_read_(model,(function(r){
  84. return smalltalk.withContext(function($ctx2) {
  85. result=r;
  86. return result;
  87. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  88. self._assert_equals_("new",result);
  89. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  90. return smalltalk.withContext(function($ctx2) {
  91. result=r;
  92. return result;
  93. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  94. self._assert_equals_(smalltalk.HashedCollection._from_(["foo".__minus_gt(["bar", "new", "baz"]),"moo".__minus_gt("zoo")]),result);
  95. return self}, function($ctx1) {$ctx1.fill(self,"testNontrivialModelModifiesAppropriateValue",{isolator:isolator,model:model,result:result},smalltalk.IsolatorTest)})},
  96. messageSends: ["on:", "->", "getBlock:", "at:", "root", "new", "putBlock:", "at:put:", "model:modify:", "model:read:", "assert:equals:"]}),
  97. smalltalk.IsolatorTest);
  98. smalltalk.addMethod(
  99. smalltalk.method({
  100. selector: "testNontrivialModelReturnsAppropriateValue",
  101. fn: function (){
  102. var self=this;
  103. var isolator,model,result;
  104. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  105. function $EavModel(){return smalltalk.EavModel||(typeof EavModel=="undefined"?nil:EavModel)}
  106. return smalltalk.withContext(function($ctx1) {
  107. result=nil;
  108. isolator=_st($Isolator())._on_(smalltalk.HashedCollection._from_(["foo".__minus_gt(["bar", [(1), [(2), (3)]], "baz"]),"moo".__minus_gt("zoo")]));
  109. model=_st(_st($EavModel())._new())._getBlock_((function(x){
  110. return smalltalk.withContext(function($ctx2) {
  111. return _st(_st(_st(x)._root())._at_("foo"))._at_((2));
  112. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1)})}));
  113. _st(isolator)._model_read_(model,(function(r){
  114. return smalltalk.withContext(function($ctx2) {
  115. result=r;
  116. return result;
  117. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  118. self._assert_equals_([(1), [(2), (3)]],result);
  119. return self}, function($ctx1) {$ctx1.fill(self,"testNontrivialModelReturnsAppropriateValue",{isolator:isolator,model:model,result:result},smalltalk.IsolatorTest)})},
  120. messageSends: ["on:", "->", "getBlock:", "at:", "root", "new", "model:read:", "assert:equals:"]}),
  121. smalltalk.IsolatorTest);
  122. smalltalk.addMethod(
  123. smalltalk.method({
  124. selector: "testRootModelExaminesThenModifiesRoot",
  125. fn: function (){
  126. var self=this;
  127. var isolator,result;
  128. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  129. return smalltalk.withContext(function($ctx1) {
  130. result=nil;
  131. isolator=_st($Isolator())._on_([(1), [(2), (3)]]);
  132. _st(isolator)._model_modify_(self["@rootModel"],(function(r){
  133. return smalltalk.withContext(function($ctx2) {
  134. return _st(r)._second();
  135. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  136. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  137. return smalltalk.withContext(function($ctx2) {
  138. result=r;
  139. return result;
  140. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  141. self._assert_equals_([(2), (3)],result);
  142. return self}, function($ctx1) {$ctx1.fill(self,"testRootModelExaminesThenModifiesRoot",{isolator:isolator,result:result},smalltalk.IsolatorTest)})},
  143. messageSends: ["on:", "model:modify:", "second", "model:read:", "assert:equals:"]}),
  144. smalltalk.IsolatorTest);
  145. smalltalk.addMethod(
  146. smalltalk.method({
  147. selector: "testRootModelGetsRootForModification",
  148. fn: function (){
  149. var self=this;
  150. var isolator,result;
  151. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  152. return smalltalk.withContext(function($ctx1) {
  153. result=nil;
  154. isolator=_st($Isolator())._on_([(2), [(1), (0)]]);
  155. _st(isolator)._model_modify_(self["@rootModel"],(function(r){
  156. return smalltalk.withContext(function($ctx2) {
  157. result=r;
  158. return result;
  159. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  160. self._assert_equals_([(2), [(1), (0)]],result);
  161. return self}, function($ctx1) {$ctx1.fill(self,"testRootModelGetsRootForModification",{isolator:isolator,result:result},smalltalk.IsolatorTest)})},
  162. messageSends: ["on:", "model:modify:", "assert:equals:"]}),
  163. smalltalk.IsolatorTest);
  164. smalltalk.addMethod(
  165. smalltalk.method({
  166. selector: "testRootModelModifiesAndDeeplyIsolatesInPlaceModifiedRoot",
  167. fn: function (){
  168. var self=this;
  169. var isolator,result,newValue;
  170. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  171. return smalltalk.withContext(function($ctx1) {
  172. result=nil;
  173. newValue=nil;
  174. isolator=_st($Isolator())._on_([(1), [(2), (3)]]);
  175. _st(isolator)._model_modify_(self["@rootModel"],(function(r){
  176. return smalltalk.withContext(function($ctx2) {
  177. newValue=r;
  178. newValue;
  179. _st(r)._at_put_((1),(4));
  180. return r;
  181. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  182. _st(newValue)._at_put_((2),"bar");
  183. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  184. return smalltalk.withContext(function($ctx2) {
  185. result=r;
  186. return result;
  187. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  188. _st(newValue)._at_put_((2),"baz");
  189. self._assert_equals_([(4), [(2), (3)]],result);
  190. return self}, function($ctx1) {$ctx1.fill(self,"testRootModelModifiesAndDeeplyIsolatesInPlaceModifiedRoot",{isolator:isolator,result:result,newValue:newValue},smalltalk.IsolatorTest)})},
  191. messageSends: ["on:", "model:modify:", "at:put:", "model:read:", "assert:equals:"]}),
  192. smalltalk.IsolatorTest);
  193. smalltalk.addMethod(
  194. smalltalk.method({
  195. selector: "testRootModelModifiesAndDeeplyIsolatesRoot",
  196. fn: function (){
  197. var self=this;
  198. var isolator,result,newValue;
  199. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  200. return smalltalk.withContext(function($ctx1) {
  201. result=nil;
  202. isolator=_st($Isolator())._on_([(1), [(2), (3)]]);
  203. newValue=smalltalk.HashedCollection._from_(["foo".__minus_gt([(4), (5), (6)])]);
  204. _st(isolator)._model_modify_(self["@rootModel"],(function(r){
  205. return smalltalk.withContext(function($ctx2) {
  206. return newValue;
  207. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  208. _st(_st(newValue)._at_("foo"))._at_put_((1),"bar");
  209. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  210. return smalltalk.withContext(function($ctx2) {
  211. result=r;
  212. return result;
  213. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  214. _st(_st(newValue)._at_("foo"))._at_put_((3),"baz");
  215. self._assert_equals_(smalltalk.HashedCollection._from_(["foo".__minus_gt([(4), (5), (6)])]),result);
  216. return self}, function($ctx1) {$ctx1.fill(self,"testRootModelModifiesAndDeeplyIsolatesRoot",{isolator:isolator,result:result,newValue:newValue},smalltalk.IsolatorTest)})},
  217. messageSends: ["on:", "->", "model:modify:", "at:put:", "at:", "model:read:", "assert:equals:"]}),
  218. smalltalk.IsolatorTest);
  219. smalltalk.addMethod(
  220. smalltalk.method({
  221. selector: "testRootModelModifiesAndIsolatesRoot",
  222. fn: function (){
  223. var self=this;
  224. var isolator,result,newValue;
  225. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  226. return smalltalk.withContext(function($ctx1) {
  227. result=nil;
  228. isolator=_st($Isolator())._on_([(1), [(2), (3)]]);
  229. newValue=smalltalk.HashedCollection._from_(["foo".__minus_gt([(4), (5), (6)])]);
  230. _st(isolator)._model_modify_(self["@rootModel"],(function(r){
  231. return smalltalk.withContext(function($ctx2) {
  232. return newValue;
  233. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  234. _st(newValue)._at_put_("foo","bar");
  235. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  236. return smalltalk.withContext(function($ctx2) {
  237. result=r;
  238. return result;
  239. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  240. _st(newValue)._at_put_("foo","baz");
  241. self._assert_equals_(smalltalk.HashedCollection._from_(["foo".__minus_gt([(4), (5), (6)])]),result);
  242. return self}, function($ctx1) {$ctx1.fill(self,"testRootModelModifiesAndIsolatesRoot",{isolator:isolator,result:result,newValue:newValue},smalltalk.IsolatorTest)})},
  243. messageSends: ["on:", "->", "model:modify:", "at:put:", "model:read:", "assert:equals:"]}),
  244. smalltalk.IsolatorTest);
  245. smalltalk.addMethod(
  246. smalltalk.method({
  247. selector: "testRootModelModifiesRoot",
  248. fn: function (){
  249. var self=this;
  250. var isolator,result;
  251. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  252. return smalltalk.withContext(function($ctx1) {
  253. result=nil;
  254. isolator=_st($Isolator())._on_([(1), [(2), (3)]]);
  255. _st(isolator)._model_modify_(self["@rootModel"],(function(r){
  256. return smalltalk.withContext(function($ctx2) {
  257. return smalltalk.HashedCollection._from_(["foo".__minus_gt([(4), (5), (6)])]);
  258. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  259. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  260. return smalltalk.withContext(function($ctx2) {
  261. result=r;
  262. return result;
  263. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  264. self._assert_equals_(smalltalk.HashedCollection._from_(["foo".__minus_gt([(4), (5), (6)])]),result);
  265. return self}, function($ctx1) {$ctx1.fill(self,"testRootModelModifiesRoot",{isolator:isolator,result:result},smalltalk.IsolatorTest)})},
  266. messageSends: ["on:", "model:modify:", "->", "model:read:", "assert:equals:"]}),
  267. smalltalk.IsolatorTest);
  268. smalltalk.addMethod(
  269. smalltalk.method({
  270. selector: "testRootModelReturnsDeeplyIsolatedRoot",
  271. fn: function (){
  272. var self=this;
  273. var isolator,result;
  274. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  275. return smalltalk.withContext(function($ctx1) {
  276. result=nil;
  277. isolator=_st($Isolator())._on_([(1), [(2), (3)]]);
  278. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  279. return smalltalk.withContext(function($ctx2) {
  280. return _st(_st(r)._at_((2)))._at_put_((1),(0));
  281. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  282. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  283. return smalltalk.withContext(function($ctx2) {
  284. result=r;
  285. return result;
  286. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  287. self._assert_equals_([(1), [(2), (3)]],result);
  288. return self}, function($ctx1) {$ctx1.fill(self,"testRootModelReturnsDeeplyIsolatedRoot",{isolator:isolator,result:result},smalltalk.IsolatorTest)})},
  289. messageSends: ["on:", "model:read:", "at:put:", "at:", "assert:equals:"]}),
  290. smalltalk.IsolatorTest);
  291. smalltalk.addMethod(
  292. smalltalk.method({
  293. selector: "testRootModelReturnsIsolatedRoot",
  294. fn: function (){
  295. var self=this;
  296. var isolator,result;
  297. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  298. return smalltalk.withContext(function($ctx1) {
  299. result=nil;
  300. isolator=_st($Isolator())._on_([(1), [(2), (4)]]);
  301. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  302. return smalltalk.withContext(function($ctx2) {
  303. return _st(r)._at_put_((2),nil);
  304. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  305. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  306. return smalltalk.withContext(function($ctx2) {
  307. result=r;
  308. return result;
  309. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  310. self._assert_equals_([(1), [(2), (4)]],result);
  311. return self}, function($ctx1) {$ctx1.fill(self,"testRootModelReturnsIsolatedRoot",{isolator:isolator,result:result},smalltalk.IsolatorTest)})},
  312. messageSends: ["on:", "model:read:", "at:put:", "assert:equals:"]}),
  313. smalltalk.IsolatorTest);
  314. smalltalk.addMethod(
  315. smalltalk.method({
  316. selector: "testRootModelReturnsRoot",
  317. fn: function (){
  318. var self=this;
  319. var isolator,result;
  320. function $Isolator(){return smalltalk.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  321. return smalltalk.withContext(function($ctx1) {
  322. result=nil;
  323. isolator=_st($Isolator())._on_([(1), [(2), (3)]]);
  324. _st(isolator)._model_read_(self["@rootModel"],(function(r){
  325. return smalltalk.withContext(function($ctx2) {
  326. result=r;
  327. return result;
  328. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1)})}));
  329. self._assert_equals_([(1), [(2), (3)]],result);
  330. return self}, function($ctx1) {$ctx1.fill(self,"testRootModelReturnsRoot",{isolator:isolator,result:result},smalltalk.IsolatorTest)})},
  331. messageSends: ["on:", "model:read:", "assert:equals:"]}),
  332. smalltalk.IsolatorTest);
  333. });