Trapped-Tests.deploy.js 10 KB

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