default-splitscope-undodeferparse.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. function foo1(a, b) {
  6. if (b != 10) {
  7. print("FAILED")
  8. } else {
  9. print("PASSED");
  10. }
  11. if (eval('b') != 10) {
  12. print("FAILED")
  13. } else {
  14. print("PASSED");
  15. }
  16. var b = 1;
  17. if (b != 1) {
  18. print("FAILED")
  19. } else {
  20. print("PASSED");
  21. }
  22. }
  23. foo1(undefined, 10);
  24. function foo2(a, b = 10) {
  25. if (b != 10) {
  26. print("FAILED")
  27. } else {
  28. print("PASSED");
  29. }
  30. if (eval('b') != 10) {
  31. print("FAILED")
  32. } else {
  33. print("PASSED");
  34. }
  35. var b = 1;
  36. if (b != 1) {
  37. print("FAILED")
  38. } else {
  39. print("PASSED");
  40. }
  41. }
  42. foo2();
  43. function foo3(a = 10, b = function () { return a; }) {
  44. if (b() != 10) {
  45. print("FAILED")
  46. } else {
  47. print("PASSED");
  48. }
  49. if (a != 10) {
  50. print("FAILED")
  51. } else {
  52. print("PASSED");
  53. }
  54. var a = 1;
  55. if (b() != 10) {
  56. print("FAILED")
  57. } else {
  58. print("PASSED");
  59. }
  60. if (a != 1) {
  61. print("FAILED")
  62. } else {
  63. print("PASSED");
  64. }
  65. }
  66. foo3();
  67. function foo4(a = 10, b = function () { return a; }) {
  68. if (b() != 10) {
  69. print("FAILED")
  70. } else {
  71. print("PASSED");
  72. }
  73. if (a != 10) {
  74. print("FAILED")
  75. } else {
  76. print("PASSED");
  77. }
  78. a = 1;
  79. if (a != 1) {
  80. print("FAILED")
  81. } else {
  82. print("PASSED");
  83. }
  84. if (b() != 1) {
  85. print("FAILED")
  86. } else {
  87. print("PASSED");
  88. }
  89. }
  90. foo4();
  91. function foo5(a = 10, b = function () { return a; }) {
  92. if (b() != 10) {
  93. print("FAILED")
  94. } else {
  95. print("PASSED");
  96. }
  97. if (eval('b()') != 10) {
  98. print("FAILED")
  99. } else {
  100. print("PASSED");
  101. }
  102. var a = 1;
  103. if (b() != 10) {
  104. print("FAILED")
  105. } else {
  106. print("PASSED");
  107. }
  108. if (a != 1) {
  109. print("FAILED")
  110. } else {
  111. print("PASSED");
  112. }
  113. }
  114. foo5();
  115. function foo6(a = 10, b = function () { return a; }) {
  116. if (b() != 10) {
  117. print("FAILED")
  118. } else {
  119. print("PASSED");
  120. }
  121. if (eval('b()') != 10) {
  122. print("FAILED")
  123. } else {
  124. print("PASSED");
  125. }
  126. a = 1;
  127. if (b() != 1) {
  128. print("FAILED")
  129. } else {
  130. print("PASSED");
  131. }
  132. if (eval('a') != 1) {
  133. print("FAILED")
  134. } else {
  135. print("PASSED");
  136. }
  137. }
  138. foo6();
  139. function foo7(a, b = function () { a; }) {
  140. if (eval("a") !== 1) {
  141. print("FAILED")
  142. } else {
  143. print("PASSED");
  144. }
  145. if (arguments[0] !== 1) {
  146. print("FAILED")
  147. } else {
  148. print("PASSED");
  149. }
  150. if (eval("arguments[0]") !== 1) {
  151. print("FAILED")
  152. } else {
  153. print("PASSED");
  154. }
  155. arguments = 100;
  156. if (eval("a") !== 1) {
  157. print("FAILED")
  158. } else {
  159. print("PASSED");
  160. }
  161. if (eval("arguments") !== 100) {
  162. print("FAILED")
  163. } else {
  164. print("PASSED");
  165. }
  166. if (arguments !== 100) {
  167. print("FAILED")
  168. } else {
  169. print("PASSED");
  170. }
  171. }
  172. foo7(1);
  173. function foo8(a = 10, b = eval("a")) {
  174. if (b != 10) {
  175. print("FAILED")
  176. } else {
  177. print("PASSED");
  178. }
  179. if (eval('b') != 10) {
  180. print("FAILED")
  181. } else {
  182. print("PASSED");
  183. }
  184. if (a != 10) {
  185. print("FAILED")
  186. } else {
  187. print("PASSED");
  188. }
  189. var a = 1;
  190. if (b != 10) {
  191. print("FAILED")
  192. } else {
  193. print("PASSED");
  194. }
  195. if (a != 1) {
  196. print("FAILED")
  197. } else {
  198. print("PASSED");
  199. }
  200. }
  201. foo8();
  202. function foo9(a = 10, b = () => eval("a")) {
  203. if (b() != 10) {
  204. print("FAILED")
  205. } else {
  206. print("PASSED");
  207. }
  208. if (eval('b()') != 10) {
  209. print("FAILED")
  210. } else {
  211. print("PASSED");
  212. }
  213. if (a != 10) {
  214. print("FAILED")
  215. } else {
  216. print("PASSED");
  217. }
  218. a = 1;
  219. if (b() != 1) {
  220. print("FAILED")
  221. } else {
  222. print("PASSED");
  223. }
  224. if (a != 1) {
  225. print("FAILED")
  226. } else {
  227. print("PASSED");
  228. }
  229. }
  230. foo9();
  231. function foo10(a, b = () => eval("a")) {
  232. if (eval("a") !== 1) {
  233. print("FAILED")
  234. } else {
  235. print("PASSED");
  236. }
  237. if (arguments[0] !== 1) {
  238. print("FAILED")
  239. } else {
  240. print("PASSED");
  241. }
  242. if (eval("arguments[0]") !== 1) {
  243. print("FAILED")
  244. } else {
  245. print("PASSED");
  246. }
  247. arguments = 100;
  248. if (eval("a") !== 1) {
  249. print("FAILED")
  250. } else {
  251. print("PASSED");
  252. }
  253. if (eval("arguments") !== 100) {
  254. print("FAILED")
  255. } else {
  256. print("PASSED");
  257. }
  258. if (arguments !== 100) {
  259. print("FAILED")
  260. } else {
  261. print("PASSED");
  262. }
  263. }
  264. foo10(1);