| 
									
										
										
										
											2020-05-02 19:18:55 +01:00
										 |  |  | load("test-common.js"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | try { | 
					
						
							| 
									
										
										
										
											2020-05-02 20:28:48 +01:00
										 |  |  |     assert((function () { }).name === ""); | 
					
						
							| 
									
										
										
										
											2020-05-02 19:18:55 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-02 20:28:48 +01:00
										 |  |  |     var foo = function () { } | 
					
						
							| 
									
										
										
										
											2020-05-02 19:18:55 +01:00
										 |  |  |     assert(foo.name === "foo"); | 
					
						
							|  |  |  |     assert((foo.name = "bar") === "bar"); | 
					
						
							|  |  |  |     assert(foo.name === "foo"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-02 20:28:48 +01:00
										 |  |  |     var a, b; | 
					
						
							|  |  |  |     a = b = function () { } | 
					
						
							|  |  |  |     assert(a.name === "b"); | 
					
						
							|  |  |  |     assert(b.name === "b"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     var arr = [ | 
					
						
							|  |  |  |         function () { }, | 
					
						
							|  |  |  |         function () { }, | 
					
						
							|  |  |  |         function () { } | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  |     assert(arr[0].name === "arr"); | 
					
						
							|  |  |  |     assert(arr[1].name === "arr"); | 
					
						
							|  |  |  |     assert(arr[2].name === "arr"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     var f; | 
					
						
							|  |  |  |     var o = { a: function () { } }; | 
					
						
							|  |  |  |     assert(o.a.name === "a"); | 
					
						
							|  |  |  |     f = o.a; | 
					
						
							|  |  |  |     assert(f.name === "a"); | 
					
						
							|  |  |  |     assert(o.a.name === "a"); | 
					
						
							|  |  |  |     o = { ...o, b: f }; | 
					
						
							|  |  |  |     assert(o.a.name === "a"); | 
					
						
							|  |  |  |     assert(o.b.name === "a"); | 
					
						
							|  |  |  |     o.c = function () { }; | 
					
						
							|  |  |  |     assert(o.c.name === "c"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function bar() { } | 
					
						
							|  |  |  |     assert(bar.name === "bar"); | 
					
						
							|  |  |  |     assert((bar.name = "baz") === "baz"); | 
					
						
							|  |  |  |     assert(bar.name === "bar"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-02 19:18:55 +01:00
										 |  |  |     assert(console.log.name === "log"); | 
					
						
							|  |  |  |     assert((console.log.name = "warn") === "warn"); | 
					
						
							|  |  |  |     assert(console.log.name === "log"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     console.log("PASS"); | 
					
						
							|  |  |  | } catch (e) { | 
					
						
							|  |  |  |     console.log("FAIL: " + e); | 
					
						
							|  |  |  | } |