Kernel-Tests.deploy.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. '_testJoin',
  5. smalltalk.method({
  6. selector: 'testJoin',
  7. fn: function (){
  8. var self=this;
  9. smalltalk.send(self, "_assert_equals_", [unescape("hello%2Cworld"), smalltalk.send(unescape("%2C"), "_join_", [["hello", "world"]])]);
  10. return self;}
  11. }),
  12. smalltalk.StringTest);
  13. smalltalk.addMethod(
  14. '_testStreamContents',
  15. smalltalk.method({
  16. selector: 'testStreamContents',
  17. fn: function (){
  18. var self=this;
  19. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["hello"]);smalltalk.send($rec, "_space", []);return smalltalk.send($rec, "_nextPutAll_", ["world"]);})(aStream);})])]);
  20. return self;}
  21. }),
  22. smalltalk.StringTest);
  23. smalltalk.addMethod(
  24. '_testIncludesSubString',
  25. smalltalk.method({
  26. selector: 'testIncludesSubString',
  27. fn: function (){
  28. var self=this;
  29. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  30. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  31. return self;}
  32. }),
  33. smalltalk.StringTest);
  34. smalltalk.addMethod(
  35. '_testEquality',
  36. smalltalk.method({
  37. selector: 'testEquality',
  38. fn: function (){
  39. var self=this;
  40. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  41. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  42. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  43. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  44. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  45. return self;}
  46. }),
  47. smalltalk.StringTest);
  48. smalltalk.addMethod(
  49. '_testCopyWithoutAll',
  50. smalltalk.method({
  51. selector: 'testCopyWithoutAll',
  52. fn: function (){
  53. var self=this;
  54. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send(unescape("*hello*%20*world*"), "_copyWithoutAll_", [unescape("*")])]);
  55. return self;}
  56. }),
  57. smalltalk.StringTest);
  58. smalltalk.addMethod(
  59. '_testAt',
  60. smalltalk.method({
  61. selector: 'testAt',
  62. fn: function (){
  63. var self=this;
  64. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
  65. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
  66. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  67. return self;}
  68. }),
  69. smalltalk.StringTest);
  70. smalltalk.addMethod(
  71. '_testAtPut',
  72. smalltalk.method({
  73. selector: 'testAtPut',
  74. fn: function (){
  75. var self=this;
  76. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  77. return self;}
  78. }),
  79. smalltalk.StringTest);
  80. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  81. smalltalk.addMethod(
  82. '_testPrintString',
  83. smalltalk.method({
  84. selector: 'testPrintString',
  85. fn: function (){
  86. var self=this;
  87. smalltalk.send(self, "_assert_equals_", [unescape("a%20Dictionary%28%27firstname%27%20-%3E%20%27James%27%20%2C%20%27lastname%27%20-%3E%20%27Bond%27%29"), (function($rec){smalltalk.send($rec, "_at_put_", ["firstname", "James"]);smalltalk.send($rec, "_at_put_", ["lastname", "Bond"]);return smalltalk.send($rec, "_printString", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []))]);
  88. return self;}
  89. }),
  90. smalltalk.DictionaryTest);
  91. smalltalk.addMethod(
  92. '_testEquality',
  93. smalltalk.method({
  94. selector: 'testEquality',
  95. fn: function (){
  96. var self=this;
  97. var d1=nil;
  98. var d2=nil;
  99. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  100. d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  101. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  102. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  103. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  104. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  105. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  106. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  107. d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);smalltalk.send($rec, "_at_put_", [(3), (4)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  108. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  109. return self;}
  110. }),
  111. smalltalk.DictionaryTest);
  112. smalltalk.addMethod(
  113. '_testDynamicDictionaries',
  114. smalltalk.method({
  115. selector: 'testDynamicDictionaries',
  116. fn: function (){
  117. var self=this;
  118. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.Dictionary._fromPairs_([smalltalk.send((1), "__minus_gt", ["hello"]),smalltalk.send((2), "__minus_gt", ["world"])]), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_with_with_", [smalltalk.send((1), "__minus_gt", ["hello"]), smalltalk.send((2), "__minus_gt", ["world"])])])]);
  119. return self;}
  120. }),
  121. smalltalk.DictionaryTest);
  122. smalltalk.addMethod(
  123. '_testAccessing',
  124. smalltalk.method({
  125. selector: 'testAccessing',
  126. fn: function (){
  127. var self=this;
  128. var d=nil;
  129. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  130. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  131. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  132. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  133. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  134. smalltalk.send(d, "_at_put_", [(1), (2)]);
  135. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  136. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  137. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  138. return self;}
  139. }),
  140. smalltalk.DictionaryTest);
  141. smalltalk.addMethod(
  142. '_testSize',
  143. smalltalk.method({
  144. selector: 'testSize',
  145. fn: function (){
  146. var self=this;
  147. var d=nil;
  148. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  149. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  150. smalltalk.send(d, "_at_put_", [(1), (2)]);
  151. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  152. smalltalk.send(d, "_at_put_", [(2), (3)]);
  153. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  154. return self;}
  155. }),
  156. smalltalk.DictionaryTest);
  157. smalltalk.addMethod(
  158. '_testValues',
  159. smalltalk.method({
  160. selector: 'testValues',
  161. fn: function (){
  162. var self=this;
  163. var d=nil;
  164. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  165. smalltalk.send(d, "_at_put_", [(1), (2)]);
  166. smalltalk.send(d, "_at_put_", [(2), (3)]);
  167. smalltalk.send(d, "_at_put_", [(3), (4)]);
  168. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  169. return self;}
  170. }),
  171. smalltalk.DictionaryTest);
  172. smalltalk.addMethod(
  173. '_testKeys',
  174. smalltalk.method({
  175. selector: 'testKeys',
  176. fn: function (){
  177. var self=this;
  178. var d=nil;
  179. d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []);
  180. smalltalk.send(d, "_at_put_", [(1), (2)]);
  181. smalltalk.send(d, "_at_put_", [(2), (3)]);
  182. smalltalk.send(d, "_at_put_", [(3), (4)]);
  183. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  184. return self;}
  185. }),
  186. smalltalk.DictionaryTest);
  187. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  188. smalltalk.addMethod(
  189. '_testLogic',
  190. smalltalk.method({
  191. selector: 'testLogic',
  192. fn: function (){
  193. var self=this;
  194. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [true])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_&", [false])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [false])]);})(self);
  195. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [true])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [false])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_|", [false])]);})(self);
  196. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [(1) > (0)])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [false])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [(1) > (2)])]);})(self);
  197. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [(1) > (0)])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [false])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [(1) > (2)])]);})(self);
  198. return self;}
  199. }),
  200. smalltalk.BooleanTest);
  201. smalltalk.addMethod(
  202. '_testEquality',
  203. smalltalk.method({
  204. selector: 'testEquality',
  205. fn: function (){
  206. var self=this;
  207. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  208. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  209. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  210. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  211. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  212. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  213. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  214. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  215. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  216. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  217. return self;}
  218. }),
  219. smalltalk.BooleanTest);
  220. smalltalk.addMethod(
  221. '_testLogicKeywords',
  222. smalltalk.method({
  223. selector: 'testLogicKeywords',
  224. fn: function (){
  225. var self=this;
  226. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return true;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_and_", [(function(){return false;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return false;})])]);})(self);
  227. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return true;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return false;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_or_", [(function(){return false;})])]);})(self);
  228. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return false;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return (1) > (2);})])]);})(self);
  229. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return false;})])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return (1) > (2);})])]);})(self);
  230. return self;}
  231. }),
  232. smalltalk.BooleanTest);
  233. smalltalk.addMethod(
  234. '_testIfTrueIfFalse',
  235. smalltalk.method({
  236. selector: 'testIfTrueIfFalse',
  237. fn: function (){
  238. var self=this;
  239. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  240. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  241. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  242. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  243. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  244. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  245. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  246. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  247. return self;}
  248. }),
  249. smalltalk.BooleanTest);
  250. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  251. smalltalk.addMethod(
  252. '_testPrintShowingDecimalPlaces',
  253. smalltalk.method({
  254. selector: 'testPrintShowingDecimalPlaces',
  255. fn: function (){
  256. var self=this;
  257. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  258. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  259. smalltalk.send(self, "_assert_equals_", [unescape("-234.56700"), smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  260. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  261. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  262. smalltalk.send(self, "_assert_equals_", [unescape("-23"), smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  263. smalltalk.send(self, "_assert_equals_", [unescape("-24"), smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  264. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  265. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  266. smalltalk.send(self, "_assert_equals_", [unescape("-0.98"), smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  267. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  268. smalltalk.send(self, "_assert_equals_", [unescape("-2.57"), smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  269. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  270. return self;}
  271. }),
  272. smalltalk.NumberTest);
  273. smalltalk.addMethod(
  274. '_testEquality',
  275. smalltalk.method({
  276. selector: 'testEquality',
  277. fn: function (){
  278. var self=this;
  279. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  280. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  281. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  282. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  283. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  284. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  285. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  286. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  287. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  288. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  289. return self;}
  290. }),
  291. smalltalk.NumberTest);
  292. smalltalk.addMethod(
  293. '_testArithmetic',
  294. smalltalk.method({
  295. selector: 'testArithmetic',
  296. fn: function (){
  297. var self=this;
  298. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  299. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  300. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  301. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  302. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  303. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  304. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  305. return self;}
  306. }),
  307. smalltalk.NumberTest);
  308. smalltalk.addMethod(
  309. '_testRounded',
  310. smalltalk.method({
  311. selector: 'testRounded',
  312. fn: function (){
  313. var self=this;
  314. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  315. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  316. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  317. return self;}
  318. }),
  319. smalltalk.NumberTest);
  320. smalltalk.addMethod(
  321. '_testNegated',
  322. smalltalk.method({
  323. selector: 'testNegated',
  324. fn: function (){
  325. var self=this;
  326. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  327. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  328. return self;}
  329. }),
  330. smalltalk.NumberTest);
  331. smalltalk.addMethod(
  332. '_testComparison',
  333. smalltalk.method({
  334. selector: 'testComparison',
  335. fn: function (){
  336. var self=this;
  337. smalltalk.send(self, "_assert_", [(3) > (2)]);
  338. smalltalk.send(self, "_assert_", [(2) < (3)]);
  339. smalltalk.send(self, "_deny_", [(3) < (2)]);
  340. smalltalk.send(self, "_deny_", [(2) > (3)]);
  341. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  342. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  343. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  344. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  345. return self;}
  346. }),
  347. smalltalk.NumberTest);
  348. smalltalk.addMethod(
  349. '_testTruncated',
  350. smalltalk.method({
  351. selector: 'testTruncated',
  352. fn: function (){
  353. var self=this;
  354. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  355. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  356. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  357. return self;}
  358. }),
  359. smalltalk.NumberTest);
  360. smalltalk.addMethod(
  361. '_testCopying',
  362. smalltalk.method({
  363. selector: 'testCopying',
  364. fn: function (){
  365. var self=this;
  366. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq", [(1)])]);
  367. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq", [(1)])]);
  368. return self;}
  369. }),
  370. smalltalk.NumberTest);
  371. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  372. smalltalk.addMethod(
  373. '_testMethodWithArguments',
  374. smalltalk.method({
  375. selector: 'testMethodWithArguments',
  376. fn: function (){
  377. var self=this;
  378. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  379. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  380. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  381. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  382. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  383. return self;}
  384. }),
  385. smalltalk.JSObjectProxyTest);
  386. smalltalk.addMethod(
  387. '_testYourself',
  388. smalltalk.method({
  389. selector: 'testYourself',
  390. fn: function (){
  391. var self=this;
  392. var body=nil;
  393. body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", []));
  394. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  395. smalltalk.send(body, "_removeClass_", ["amber"]);
  396. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  397. return self;}
  398. }),
  399. smalltalk.JSObjectProxyTest);
  400. smalltalk.addMethod(
  401. '_testPropertyThatReturnsEmptyString',
  402. smalltalk.method({
  403. selector: 'testPropertyThatReturnsEmptyString',
  404. fn: function (){
  405. var self=this;
  406. document.location.hash = '';
  407. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  408. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  409. smalltalk.send(self, "_assert_equals_", [unescape("%23test"), smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  410. return self;}
  411. }),
  412. smalltalk.JSObjectProxyTest);
  413. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  414. smalltalk.addMethod(
  415. '_setUp',
  416. smalltalk.method({
  417. selector: 'setUp',
  418. fn: function (){
  419. var self=this;
  420. self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []);
  421. self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []);
  422. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  423. self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]);
  424. self['@grulPackage']=(function($rec){smalltalk.send($rec, "_name_", ["Grul"]);smalltalk.send($rec, "_commitPathJs_", [unescape("server/grul/js")]);smalltalk.send($rec, "_commitPathSt_", [unescape("grul/st")]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Package || Package), "_new", []));
  425. return self;}
  426. }),
  427. smalltalk.PackageTest);
  428. smalltalk.addMethod(
  429. '_tearDown',
  430. smalltalk.method({
  431. selector: 'tearDown',
  432. fn: function (){
  433. var self=this;
  434. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  435. return self;}
  436. }),
  437. smalltalk.PackageTest);
  438. smalltalk.addMethod(
  439. '_testGrulCommitPathStShouldBeGrulSt',
  440. smalltalk.method({
  441. selector: 'testGrulCommitPathStShouldBeGrulSt',
  442. fn: function (){
  443. var self=this;
  444. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  445. return self;}
  446. }),
  447. smalltalk.PackageTest);
  448. smalltalk.addMethod(
  449. '_testZorkCommitPathStShouldBeSt',
  450. smalltalk.method({
  451. selector: 'testZorkCommitPathStShouldBeSt',
  452. fn: function (){
  453. var self=this;
  454. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  455. return self;}
  456. }),
  457. smalltalk.PackageTest);
  458. smalltalk.addMethod(
  459. '_testZorkCommitPathJsShouldBeJs',
  460. smalltalk.method({
  461. selector: 'testZorkCommitPathJsShouldBeJs',
  462. fn: function (){
  463. var self=this;
  464. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  465. return self;}
  466. }),
  467. smalltalk.PackageTest);
  468. smalltalk.addMethod(
  469. '_testGrulCommitPathJsShouldBeServerGrulJs',
  470. smalltalk.method({
  471. selector: 'testGrulCommitPathJsShouldBeServerGrulJs',
  472. fn: function (){
  473. var self=this;
  474. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  475. return self;}
  476. }),
  477. smalltalk.PackageTest);
  478. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  479. smalltalk.addMethod(
  480. '_setUp',
  481. smalltalk.method({
  482. selector: 'setUp',
  483. fn: function (){
  484. var self=this;
  485. smalltalk.send(self, "_setUp", [], smalltalk.PackageTest);
  486. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [unescape("javascripts/")]);return smalltalk.send($rec, "_defaultCommitPathSt_", [unescape("smalltalk/")]);})((smalltalk.Package || Package));
  487. return self;}
  488. }),
  489. smalltalk.PackageWithDefaultCommitPathChangedTest);
  490. smalltalk.addMethod(
  491. '_testGrulCommitPathJsShouldBeServerGrulJs',
  492. smalltalk.method({
  493. selector: 'testGrulCommitPathJsShouldBeServerGrulJs',
  494. fn: function (){
  495. var self=this;
  496. smalltalk.send(self, "_assert_equals_", [unescape("server/grul/js"), smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  497. return self;}
  498. }),
  499. smalltalk.PackageWithDefaultCommitPathChangedTest);
  500. smalltalk.addMethod(
  501. '_testGrulCommitPathStShouldBeGrulSt',
  502. smalltalk.method({
  503. selector: 'testGrulCommitPathStShouldBeGrulSt',
  504. fn: function (){
  505. var self=this;
  506. smalltalk.send(self, "_assert_equals_", [unescape("grul/st"), smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  507. return self;}
  508. }),
  509. smalltalk.PackageWithDefaultCommitPathChangedTest);
  510. smalltalk.addMethod(
  511. '_testZorkCommitPathJsShouldBeJavascript',
  512. smalltalk.method({
  513. selector: 'testZorkCommitPathJsShouldBeJavascript',
  514. fn: function (){
  515. var self=this;
  516. smalltalk.send(self, "_assert_equals_", [unescape("javascripts/"), smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  517. return self;}
  518. }),
  519. smalltalk.PackageWithDefaultCommitPathChangedTest);
  520. smalltalk.addMethod(
  521. '_testZorkCommitPathStShouldBeSmalltalk',
  522. smalltalk.method({
  523. selector: 'testZorkCommitPathStShouldBeSmalltalk',
  524. fn: function (){
  525. var self=this;
  526. smalltalk.send(self, "_assert_equals_", [unescape("smalltalk/"), smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  527. return self;}
  528. }),
  529. smalltalk.PackageWithDefaultCommitPathChangedTest);
  530. smalltalk.addMethod(
  531. '_shouldInheritSelectors',
  532. smalltalk.method({
  533. selector: 'shouldInheritSelectors',
  534. fn: function (){
  535. var self=this;
  536. return false;
  537. return self;}
  538. }),
  539. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);