Trapped-Tests.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. define("trapped/Trapped-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Trapped-Tests');
  4. $core.packages["Trapped-Tests"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Trapped-Tests"].transport = {"type":"amd","amdNamespace":"trapped"};
  6. $core.addClass('IsolatorTest', $globals.TestCase, ['rootModel'], 'Trapped-Tests');
  7. $core.addMethod(
  8. $core.method({
  9. selector: "setUp",
  10. protocol: 'running',
  11. fn: function (){
  12. var self=this;
  13. function $EavModel(){return $globals.EavModel||(typeof EavModel=="undefined"?nil:EavModel)}
  14. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15. return $core.withContext(function($ctx1) {
  16. //>>excludeEnd("ctx");
  17. var $1,$2;
  18. $1=$recv($EavModel())._new();
  19. $recv($1)._getBlock_((function(x){
  20. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21. return $core.withContext(function($ctx2) {
  22. //>>excludeEnd("ctx");
  23. return $recv(x)._root();
  24. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  26. //>>excludeEnd("ctx");
  27. }));
  28. $2=$recv($1)._putBlock_((function(x,y){
  29. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30. return $core.withContext(function($ctx2) {
  31. //>>excludeEnd("ctx");
  32. return $recv(x)._root_(y);
  33. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,2)});
  35. //>>excludeEnd("ctx");
  36. }));
  37. self["@rootModel"]=$2;
  38. return self;
  39. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.IsolatorTest)});
  41. //>>excludeEnd("ctx");
  42. },
  43. //>>excludeStart("ide", pragmas.excludeIdeData);
  44. args: [],
  45. source: "setUp\x0a\x0arootModel := EavModel new\x0a\x09getBlock: [:x | x root];\x0a putBlock: [:x :y | x root: y].",
  46. referencedClasses: ["EavModel"],
  47. //>>excludeEnd("ide");
  48. messageSends: ["getBlock:", "new", "root", "putBlock:", "root:"]
  49. }),
  50. $globals.IsolatorTest);
  51. $core.addMethod(
  52. $core.method({
  53. selector: "testNontrivialModelGetsAppropriateValueForModification",
  54. protocol: 'tests',
  55. fn: function (){
  56. var self=this;
  57. var isolator,model,result;
  58. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  59. function $EavModel(){return $globals.EavModel||(typeof EavModel=="undefined"?nil:EavModel)}
  60. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61. return $core.withContext(function($ctx1) {
  62. //>>excludeEnd("ctx");
  63. var $1,$3,$2,$4;
  64. result=nil;
  65. isolator=$recv($Isolator())._on_($globals.HashedCollection._newFromPairs_(["foo",["bar", [(1), [(2), (5)]], "baz"],"moo","zoo"]));
  66. $1=$recv($EavModel())._new();
  67. $recv($1)._getBlock_((function(x){
  68. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69. return $core.withContext(function($ctx2) {
  70. //>>excludeEnd("ctx");
  71. $3=$recv(x)._root();
  72. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73. $ctx2.sendIdx["root"]=1;
  74. //>>excludeEnd("ctx");
  75. $2=$recv($3)._at_("foo");
  76. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77. $ctx2.sendIdx["at:"]=2;
  78. //>>excludeEnd("ctx");
  79. return $recv($2)._at_((2));
  80. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  81. $ctx2.sendIdx["at:"]=1;
  82. //>>excludeEnd("ctx");
  83. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  84. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  85. //>>excludeEnd("ctx");
  86. }));
  87. $4=$recv($1)._putBlock_((function(x,y){
  88. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  89. return $core.withContext(function($ctx2) {
  90. //>>excludeEnd("ctx");
  91. return $recv($recv($recv(x)._root())._at_("foo"))._at_put_((2),y);
  92. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  93. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,2)});
  94. //>>excludeEnd("ctx");
  95. }));
  96. model=$4;
  97. $recv(isolator)._model_modify_(model,(function(r){
  98. result=r;
  99. return result;
  100. }));
  101. self._assert_equals_([(1), [(2), (5)]],result);
  102. return self;
  103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  104. }, function($ctx1) {$ctx1.fill(self,"testNontrivialModelGetsAppropriateValueForModification",{isolator:isolator,model:model,result:result},$globals.IsolatorTest)});
  105. //>>excludeEnd("ctx");
  106. },
  107. //>>excludeStart("ide", pragmas.excludeIdeData);
  108. args: [],
  109. source: "testNontrivialModelGetsAppropriateValueForModification\x0a| isolator model result |\x0aresult := nil.\x0aisolator := Isolator on: #{ 'foo' -> #('bar' #(1 #(2 5)) 'baz'). 'moo' -> 'zoo' }.\x0amodel := EavModel new\x0a\x09getBlock: [ :x | (x root at: 'foo') at: 2 ];\x0a\x09putBlock: [ :x :y | (x root at: 'foo') at: 2 put: y].\x0aisolator model: model modify: [:r|result := r].\x0aself assert: #(1 #(2 5)) equals: result",
  110. referencedClasses: ["Isolator", "EavModel"],
  111. //>>excludeEnd("ide");
  112. messageSends: ["on:", "getBlock:", "new", "at:", "root", "putBlock:", "at:put:", "model:modify:", "assert:equals:"]
  113. }),
  114. $globals.IsolatorTest);
  115. $core.addMethod(
  116. $core.method({
  117. selector: "testNontrivialModelModifiesAppropriateValue",
  118. protocol: 'tests',
  119. fn: function (){
  120. var self=this;
  121. var isolator,model,result;
  122. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  123. function $EavModel(){return $globals.EavModel||(typeof EavModel=="undefined"?nil:EavModel)}
  124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  125. return $core.withContext(function($ctx1) {
  126. //>>excludeEnd("ctx");
  127. var $1,$3,$2,$4;
  128. result=nil;
  129. isolator=$recv($Isolator())._on_($globals.HashedCollection._newFromPairs_(["foo",["bar", [(1), [(2), (3)]], "baz"],"moo","zoo"]));
  130. $1=$recv($EavModel())._new();
  131. $recv($1)._getBlock_((function(x){
  132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  133. return $core.withContext(function($ctx2) {
  134. //>>excludeEnd("ctx");
  135. $3=$recv(x)._root();
  136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  137. $ctx2.sendIdx["root"]=1;
  138. //>>excludeEnd("ctx");
  139. $2=$recv($3)._at_("foo");
  140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  141. $ctx2.sendIdx["at:"]=2;
  142. //>>excludeEnd("ctx");
  143. return $recv($2)._at_((2));
  144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  145. $ctx2.sendIdx["at:"]=1;
  146. //>>excludeEnd("ctx");
  147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  148. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  149. //>>excludeEnd("ctx");
  150. }));
  151. $4=$recv($1)._putBlock_((function(x,y){
  152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  153. return $core.withContext(function($ctx2) {
  154. //>>excludeEnd("ctx");
  155. return $recv($recv($recv(x)._root())._at_("foo"))._at_put_((2),y);
  156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  157. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,2)});
  158. //>>excludeEnd("ctx");
  159. }));
  160. model=$4;
  161. $recv(isolator)._model_modify_(model,(function(r){
  162. return "new";
  163. }));
  164. $recv(isolator)._model_read_(model,(function(r){
  165. result=r;
  166. return result;
  167. }));
  168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  169. $ctx1.sendIdx["model:read:"]=1;
  170. //>>excludeEnd("ctx");
  171. self._assert_equals_("new",result);
  172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  173. $ctx1.sendIdx["assert:equals:"]=1;
  174. //>>excludeEnd("ctx");
  175. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  176. result=r;
  177. return result;
  178. }));
  179. self._assert_equals_($globals.HashedCollection._newFromPairs_(["foo",["bar", "new", "baz"],"moo","zoo"]),result);
  180. return self;
  181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  182. }, function($ctx1) {$ctx1.fill(self,"testNontrivialModelModifiesAppropriateValue",{isolator:isolator,model:model,result:result},$globals.IsolatorTest)});
  183. //>>excludeEnd("ctx");
  184. },
  185. //>>excludeStart("ide", pragmas.excludeIdeData);
  186. args: [],
  187. source: "testNontrivialModelModifiesAppropriateValue\x0a| isolator model result |\x0aresult := nil.\x0aisolator := Isolator on: #{ 'foo' -> #('bar' #(1 #(2 3)) 'baz'). 'moo' -> 'zoo' }.\x0amodel := EavModel new\x0a\x09getBlock: [ :x | (x root at: 'foo') at: 2 ];\x0a\x09putBlock: [ :x :y | (x root at: 'foo') at: 2 put: y].\x0aisolator model: model modify: [:r|#new].\x0aisolator model: model read: [:r|result := r].\x0aself assert: #new equals: result.\x0aisolator model: rootModel read: [:r|result := r].\x0aself assert: #{ 'foo' -> #('bar' #new 'baz'). 'moo' -> 'zoo' } equals: result",
  188. referencedClasses: ["Isolator", "EavModel"],
  189. //>>excludeEnd("ide");
  190. messageSends: ["on:", "getBlock:", "new", "at:", "root", "putBlock:", "at:put:", "model:modify:", "model:read:", "assert:equals:"]
  191. }),
  192. $globals.IsolatorTest);
  193. $core.addMethod(
  194. $core.method({
  195. selector: "testNontrivialModelReturnsAppropriateValue",
  196. protocol: 'tests',
  197. fn: function (){
  198. var self=this;
  199. var isolator,model,result;
  200. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  201. function $EavModel(){return $globals.EavModel||(typeof EavModel=="undefined"?nil:EavModel)}
  202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  203. return $core.withContext(function($ctx1) {
  204. //>>excludeEnd("ctx");
  205. result=nil;
  206. isolator=$recv($Isolator())._on_($globals.HashedCollection._newFromPairs_(["foo",["bar", [(1), [(2), (3)]], "baz"],"moo","zoo"]));
  207. model=$recv($recv($EavModel())._new())._getBlock_((function(x){
  208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  209. return $core.withContext(function($ctx2) {
  210. //>>excludeEnd("ctx");
  211. return $recv($recv($recv(x)._root())._at_("foo"))._at_((2));
  212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  213. $ctx2.sendIdx["at:"]=1;
  214. //>>excludeEnd("ctx");
  215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  216. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  217. //>>excludeEnd("ctx");
  218. }));
  219. $recv(isolator)._model_read_(model,(function(r){
  220. result=r;
  221. return result;
  222. }));
  223. self._assert_equals_([(1), [(2), (3)]],result);
  224. return self;
  225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  226. }, function($ctx1) {$ctx1.fill(self,"testNontrivialModelReturnsAppropriateValue",{isolator:isolator,model:model,result:result},$globals.IsolatorTest)});
  227. //>>excludeEnd("ctx");
  228. },
  229. //>>excludeStart("ide", pragmas.excludeIdeData);
  230. args: [],
  231. source: "testNontrivialModelReturnsAppropriateValue\x0a| isolator model result |\x0aresult := nil.\x0aisolator := Isolator on: #{ 'foo' -> #('bar' #(1 #(2 3)) 'baz'). 'moo' -> 'zoo' }.\x0amodel := EavModel new getBlock: [ :x | (x root at: 'foo') at: 2 ].\x0aisolator model: model read: [:r|result := r].\x0aself assert: #(1 #(2 3)) equals: result",
  232. referencedClasses: ["Isolator", "EavModel"],
  233. //>>excludeEnd("ide");
  234. messageSends: ["on:", "getBlock:", "new", "at:", "root", "model:read:", "assert:equals:"]
  235. }),
  236. $globals.IsolatorTest);
  237. $core.addMethod(
  238. $core.method({
  239. selector: "testRootModelExaminesThenModifiesRoot",
  240. protocol: 'tests',
  241. fn: function (){
  242. var self=this;
  243. var isolator,result;
  244. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  246. return $core.withContext(function($ctx1) {
  247. //>>excludeEnd("ctx");
  248. result=nil;
  249. isolator=$recv($Isolator())._on_([(1), [(2), (3)]]);
  250. $recv(isolator)._model_modify_(self["@rootModel"],(function(r){
  251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  252. return $core.withContext(function($ctx2) {
  253. //>>excludeEnd("ctx");
  254. return $recv(r)._second();
  255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  256. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1,1)});
  257. //>>excludeEnd("ctx");
  258. }));
  259. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  260. result=r;
  261. return result;
  262. }));
  263. self._assert_equals_([(2), (3)],result);
  264. return self;
  265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  266. }, function($ctx1) {$ctx1.fill(self,"testRootModelExaminesThenModifiesRoot",{isolator:isolator,result:result},$globals.IsolatorTest)});
  267. //>>excludeEnd("ctx");
  268. },
  269. //>>excludeStart("ide", pragmas.excludeIdeData);
  270. args: [],
  271. source: "testRootModelExaminesThenModifiesRoot\x0a| isolator result |\x0aresult := nil.\x0aisolator := Isolator on: #(1 #(2 3)).\x0aisolator model: rootModel modify: [:r|r second].\x0aisolator model: rootModel read: [:r|result := r].\x0aself assert: #(2 3) equals: result",
  272. referencedClasses: ["Isolator"],
  273. //>>excludeEnd("ide");
  274. messageSends: ["on:", "model:modify:", "second", "model:read:", "assert:equals:"]
  275. }),
  276. $globals.IsolatorTest);
  277. $core.addMethod(
  278. $core.method({
  279. selector: "testRootModelGetsRootForModification",
  280. protocol: 'tests',
  281. fn: function (){
  282. var self=this;
  283. var isolator,result;
  284. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  286. return $core.withContext(function($ctx1) {
  287. //>>excludeEnd("ctx");
  288. result=nil;
  289. isolator=$recv($Isolator())._on_([(2), [(1), (0)]]);
  290. $recv(isolator)._model_modify_(self["@rootModel"],(function(r){
  291. result=r;
  292. return result;
  293. }));
  294. self._assert_equals_([(2), [(1), (0)]],result);
  295. return self;
  296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  297. }, function($ctx1) {$ctx1.fill(self,"testRootModelGetsRootForModification",{isolator:isolator,result:result},$globals.IsolatorTest)});
  298. //>>excludeEnd("ctx");
  299. },
  300. //>>excludeStart("ide", pragmas.excludeIdeData);
  301. args: [],
  302. source: "testRootModelGetsRootForModification\x0a| isolator result |\x0aresult := nil.\x0aisolator := Isolator on: #(2 #(1 0)).\x0aisolator model: rootModel modify: [:r|result := r].\x0aself assert: #(2 #(1 0)) equals: result",
  303. referencedClasses: ["Isolator"],
  304. //>>excludeEnd("ide");
  305. messageSends: ["on:", "model:modify:", "assert:equals:"]
  306. }),
  307. $globals.IsolatorTest);
  308. $core.addMethod(
  309. $core.method({
  310. selector: "testRootModelModifiesAndDeeplyIsolatesInPlaceModifiedRoot",
  311. protocol: 'tests',
  312. fn: function (){
  313. var self=this;
  314. var isolator,result,newValue;
  315. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  317. return $core.withContext(function($ctx1) {
  318. //>>excludeEnd("ctx");
  319. result=nil;
  320. newValue=nil;
  321. isolator=$recv($Isolator())._on_([(1), [(2), (3)]]);
  322. $recv(isolator)._model_modify_(self["@rootModel"],(function(r){
  323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  324. return $core.withContext(function($ctx2) {
  325. //>>excludeEnd("ctx");
  326. newValue=r;
  327. newValue;
  328. $recv(r)._at_put_((1),(4));
  329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  330. $ctx2.sendIdx["at:put:"]=1;
  331. //>>excludeEnd("ctx");
  332. return r;
  333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  334. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1,1)});
  335. //>>excludeEnd("ctx");
  336. }));
  337. $recv(newValue)._at_put_((2),"bar");
  338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  339. $ctx1.sendIdx["at:put:"]=2;
  340. //>>excludeEnd("ctx");
  341. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  342. result=r;
  343. return result;
  344. }));
  345. $recv(newValue)._at_put_((2),"baz");
  346. self._assert_equals_([(4), [(2), (3)]],result);
  347. return self;
  348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  349. }, function($ctx1) {$ctx1.fill(self,"testRootModelModifiesAndDeeplyIsolatesInPlaceModifiedRoot",{isolator:isolator,result:result,newValue:newValue},$globals.IsolatorTest)});
  350. //>>excludeEnd("ctx");
  351. },
  352. //>>excludeStart("ide", pragmas.excludeIdeData);
  353. args: [],
  354. source: "testRootModelModifiesAndDeeplyIsolatesInPlaceModifiedRoot\x0a| isolator result newValue |\x0aresult := nil. newValue := nil.\x0aisolator := Isolator on: #(1 #(2 3)).\x0aisolator model: rootModel modify: [:r|newValue := r. r at: 1 put: 4. r].\x0anewValue at: 2 put: 'bar'.\x0aisolator model: rootModel read: [:r|result := r].\x0anewValue at: 2 put: 'baz'.\x0aself assert: #(4 #(2 3)) equals: result",
  355. referencedClasses: ["Isolator"],
  356. //>>excludeEnd("ide");
  357. messageSends: ["on:", "model:modify:", "at:put:", "model:read:", "assert:equals:"]
  358. }),
  359. $globals.IsolatorTest);
  360. $core.addMethod(
  361. $core.method({
  362. selector: "testRootModelModifiesAndDeeplyIsolatesRoot",
  363. protocol: 'tests',
  364. fn: function (){
  365. var self=this;
  366. var isolator,result,newValue;
  367. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  369. return $core.withContext(function($ctx1) {
  370. //>>excludeEnd("ctx");
  371. var $1;
  372. result=nil;
  373. isolator=$recv($Isolator())._on_([(1), [(2), (3)]]);
  374. newValue=$globals.HashedCollection._newFromPairs_(["foo",[(4), (5), (6)]]);
  375. $recv(isolator)._model_modify_(self["@rootModel"],(function(r){
  376. return newValue;
  377. }));
  378. $1=$recv(newValue)._at_("foo");
  379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  380. $ctx1.sendIdx["at:"]=1;
  381. //>>excludeEnd("ctx");
  382. $recv($1)._at_put_((1),"bar");
  383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  384. $ctx1.sendIdx["at:put:"]=1;
  385. //>>excludeEnd("ctx");
  386. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  387. result=r;
  388. return result;
  389. }));
  390. $recv($recv(newValue)._at_("foo"))._at_put_((3),"baz");
  391. self._assert_equals_($globals.HashedCollection._newFromPairs_(["foo",[(4), (5), (6)]]),result);
  392. return self;
  393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  394. }, function($ctx1) {$ctx1.fill(self,"testRootModelModifiesAndDeeplyIsolatesRoot",{isolator:isolator,result:result,newValue:newValue},$globals.IsolatorTest)});
  395. //>>excludeEnd("ctx");
  396. },
  397. //>>excludeStart("ide", pragmas.excludeIdeData);
  398. args: [],
  399. source: "testRootModelModifiesAndDeeplyIsolatesRoot\x0a| isolator result newValue |\x0aresult := nil.\x0aisolator := Isolator on: #(1 #(2 3)).\x0anewValue := #{'foo'->#(4 5 6)}.\x0aisolator model: rootModel modify: [:r|newValue].\x0a(newValue at: 'foo') at: 1 put: 'bar'.\x0aisolator model: rootModel read: [:r|result := r].\x0a(newValue at: 'foo') at: 3 put: 'baz'.\x0aself assert: #{'foo'->#(4 5 6)} equals: result",
  400. referencedClasses: ["Isolator"],
  401. //>>excludeEnd("ide");
  402. messageSends: ["on:", "model:modify:", "at:put:", "at:", "model:read:", "assert:equals:"]
  403. }),
  404. $globals.IsolatorTest);
  405. $core.addMethod(
  406. $core.method({
  407. selector: "testRootModelModifiesAndIsolatesRoot",
  408. protocol: 'tests',
  409. fn: function (){
  410. var self=this;
  411. var isolator,result,newValue;
  412. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  414. return $core.withContext(function($ctx1) {
  415. //>>excludeEnd("ctx");
  416. result=nil;
  417. isolator=$recv($Isolator())._on_([(1), [(2), (3)]]);
  418. newValue=$globals.HashedCollection._newFromPairs_(["foo",[(4), (5), (6)]]);
  419. $recv(isolator)._model_modify_(self["@rootModel"],(function(r){
  420. return newValue;
  421. }));
  422. $recv(newValue)._at_put_("foo","bar");
  423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  424. $ctx1.sendIdx["at:put:"]=1;
  425. //>>excludeEnd("ctx");
  426. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  427. result=r;
  428. return result;
  429. }));
  430. $recv(newValue)._at_put_("foo","baz");
  431. self._assert_equals_($globals.HashedCollection._newFromPairs_(["foo",[(4), (5), (6)]]),result);
  432. return self;
  433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  434. }, function($ctx1) {$ctx1.fill(self,"testRootModelModifiesAndIsolatesRoot",{isolator:isolator,result:result,newValue:newValue},$globals.IsolatorTest)});
  435. //>>excludeEnd("ctx");
  436. },
  437. //>>excludeStart("ide", pragmas.excludeIdeData);
  438. args: [],
  439. source: "testRootModelModifiesAndIsolatesRoot\x0a| isolator result newValue |\x0aresult := nil.\x0aisolator := Isolator on: #(1 #(2 3)).\x0anewValue := #{'foo'->#(4 5 6)}.\x0aisolator model: rootModel modify: [:r|newValue].\x0anewValue at: 'foo' put: 'bar'.\x0aisolator model: rootModel read: [:r|result := r].\x0anewValue at: 'foo' put: 'baz'.\x0aself assert: #{'foo'->#(4 5 6)} equals: result",
  440. referencedClasses: ["Isolator"],
  441. //>>excludeEnd("ide");
  442. messageSends: ["on:", "model:modify:", "at:put:", "model:read:", "assert:equals:"]
  443. }),
  444. $globals.IsolatorTest);
  445. $core.addMethod(
  446. $core.method({
  447. selector: "testRootModelModifiesRoot",
  448. protocol: 'tests',
  449. fn: function (){
  450. var self=this;
  451. var isolator,result;
  452. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  454. return $core.withContext(function($ctx1) {
  455. //>>excludeEnd("ctx");
  456. result=nil;
  457. isolator=$recv($Isolator())._on_([(1), [(2), (3)]]);
  458. $recv(isolator)._model_modify_(self["@rootModel"],(function(r){
  459. return $globals.HashedCollection._newFromPairs_(["foo",[(4), (5), (6)]]);
  460. }));
  461. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  462. result=r;
  463. return result;
  464. }));
  465. self._assert_equals_($globals.HashedCollection._newFromPairs_(["foo",[(4), (5), (6)]]),result);
  466. return self;
  467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  468. }, function($ctx1) {$ctx1.fill(self,"testRootModelModifiesRoot",{isolator:isolator,result:result},$globals.IsolatorTest)});
  469. //>>excludeEnd("ctx");
  470. },
  471. //>>excludeStart("ide", pragmas.excludeIdeData);
  472. args: [],
  473. source: "testRootModelModifiesRoot\x0a| isolator result |\x0aresult := nil.\x0aisolator := Isolator on: #(1 #(2 3)).\x0aisolator model: rootModel modify: [:r|#{'foo'->#(4 5 6)}].\x0aisolator model: rootModel read: [:r|result := r].\x0aself assert: #{'foo'->#(4 5 6)} equals: result",
  474. referencedClasses: ["Isolator"],
  475. //>>excludeEnd("ide");
  476. messageSends: ["on:", "model:modify:", "model:read:", "assert:equals:"]
  477. }),
  478. $globals.IsolatorTest);
  479. $core.addMethod(
  480. $core.method({
  481. selector: "testRootModelReturnsDeeplyIsolatedRoot",
  482. protocol: 'tests',
  483. fn: function (){
  484. var self=this;
  485. var isolator,result;
  486. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  488. return $core.withContext(function($ctx1) {
  489. //>>excludeEnd("ctx");
  490. result=nil;
  491. isolator=$recv($Isolator())._on_([(1), [(2), (3)]]);
  492. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  494. return $core.withContext(function($ctx2) {
  495. //>>excludeEnd("ctx");
  496. return $recv($recv(r)._at_((2)))._at_put_((1),(0));
  497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  498. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1,1)});
  499. //>>excludeEnd("ctx");
  500. }));
  501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  502. $ctx1.sendIdx["model:read:"]=1;
  503. //>>excludeEnd("ctx");
  504. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  505. result=r;
  506. return result;
  507. }));
  508. self._assert_equals_([(1), [(2), (3)]],result);
  509. return self;
  510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  511. }, function($ctx1) {$ctx1.fill(self,"testRootModelReturnsDeeplyIsolatedRoot",{isolator:isolator,result:result},$globals.IsolatorTest)});
  512. //>>excludeEnd("ctx");
  513. },
  514. //>>excludeStart("ide", pragmas.excludeIdeData);
  515. args: [],
  516. source: "testRootModelReturnsDeeplyIsolatedRoot\x0a| isolator result |\x0aresult := nil.\x0aisolator := Isolator on: #(1 #(2 3)).\x0aisolator model: rootModel read: [:r|(r at: 2) at: 1 put: 0].\x0aisolator model: rootModel read: [:r|result := r].\x0aself assert: #(1 #(2 3)) equals: result",
  517. referencedClasses: ["Isolator"],
  518. //>>excludeEnd("ide");
  519. messageSends: ["on:", "model:read:", "at:put:", "at:", "assert:equals:"]
  520. }),
  521. $globals.IsolatorTest);
  522. $core.addMethod(
  523. $core.method({
  524. selector: "testRootModelReturnsIsolatedRoot",
  525. protocol: 'tests',
  526. fn: function (){
  527. var self=this;
  528. var isolator,result;
  529. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  531. return $core.withContext(function($ctx1) {
  532. //>>excludeEnd("ctx");
  533. result=nil;
  534. isolator=$recv($Isolator())._on_([(1), [(2), (4)]]);
  535. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  537. return $core.withContext(function($ctx2) {
  538. //>>excludeEnd("ctx");
  539. return $recv(r)._at_put_((2),nil);
  540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  541. }, function($ctx2) {$ctx2.fillBlock({r:r},$ctx1,1)});
  542. //>>excludeEnd("ctx");
  543. }));
  544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  545. $ctx1.sendIdx["model:read:"]=1;
  546. //>>excludeEnd("ctx");
  547. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  548. result=r;
  549. return result;
  550. }));
  551. self._assert_equals_([(1), [(2), (4)]],result);
  552. return self;
  553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  554. }, function($ctx1) {$ctx1.fill(self,"testRootModelReturnsIsolatedRoot",{isolator:isolator,result:result},$globals.IsolatorTest)});
  555. //>>excludeEnd("ctx");
  556. },
  557. //>>excludeStart("ide", pragmas.excludeIdeData);
  558. args: [],
  559. source: "testRootModelReturnsIsolatedRoot\x0a| isolator result |\x0aresult := nil.\x0aisolator := Isolator on: #(1 #(2 4)).\x0aisolator model: rootModel read: [:r|r at: 2 put: nil].\x0aisolator model: rootModel read: [:r|result := r].\x0aself assert: #(1 #(2 4)) equals: result",
  560. referencedClasses: ["Isolator"],
  561. //>>excludeEnd("ide");
  562. messageSends: ["on:", "model:read:", "at:put:", "assert:equals:"]
  563. }),
  564. $globals.IsolatorTest);
  565. $core.addMethod(
  566. $core.method({
  567. selector: "testRootModelReturnsRoot",
  568. protocol: 'tests',
  569. fn: function (){
  570. var self=this;
  571. var isolator,result;
  572. function $Isolator(){return $globals.Isolator||(typeof Isolator=="undefined"?nil:Isolator)}
  573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  574. return $core.withContext(function($ctx1) {
  575. //>>excludeEnd("ctx");
  576. result=nil;
  577. isolator=$recv($Isolator())._on_([(1), [(2), (3)]]);
  578. $recv(isolator)._model_read_(self["@rootModel"],(function(r){
  579. result=r;
  580. return result;
  581. }));
  582. self._assert_equals_([(1), [(2), (3)]],result);
  583. return self;
  584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  585. }, function($ctx1) {$ctx1.fill(self,"testRootModelReturnsRoot",{isolator:isolator,result:result},$globals.IsolatorTest)});
  586. //>>excludeEnd("ctx");
  587. },
  588. //>>excludeStart("ide", pragmas.excludeIdeData);
  589. args: [],
  590. source: "testRootModelReturnsRoot\x0a| isolator result |\x0aresult := nil.\x0aisolator := Isolator on: #(1 #(2 3)).\x0aisolator model: rootModel read: [:r|result := r].\x0aself assert: #(1 #(2 3)) equals: result",
  591. referencedClasses: ["Isolator"],
  592. //>>excludeEnd("ide");
  593. messageSends: ["on:", "model:read:", "assert:equals:"]
  594. }),
  595. $globals.IsolatorTest);
  596. });