mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:22:43 +00:00 
			
		
		
		
	 eaf8c2e398
			
		
	
	
		eaf8c2e398
		
	
	
	
	
		
			
			Using ErrorType::ReferencePrimitiveSetProperty the errors for primitives now look like "Cannot set property 'foo' of number '123'". The strict-mode-errors test has been adjusted and re-enabled.
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			774 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			774 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| test("basic functionality", () => {
 | |
|     const s1 = Symbol("foo");
 | |
|     const s2 = Symbol("foo");
 | |
| 
 | |
|     expect(s1).not.toBe(s2);
 | |
|     expect(s1.description).toBe("foo");
 | |
|     expect(s2.description).toBe("foo");
 | |
| 
 | |
|     s1.description = "bar";
 | |
|     expect(s1.description).toBe("foo");
 | |
| 
 | |
|     expect(typeof s1).toBe("symbol");
 | |
| });
 | |
| 
 | |
| test("constructing symbol from symbol is an error", () => {
 | |
|     expect(() => {
 | |
|         Symbol(Symbol("foo"));
 | |
|     }).toThrowWithMessage(TypeError, "Cannot convert symbol to string");
 | |
| });
 | |
| 
 | |
| test("setting new properties on a symbol is an error in strict mode", () => {
 | |
|     "use strict";
 | |
|     var symbol = Symbol("foo");
 | |
|     expect(() => {
 | |
|         symbol.bar = 42;
 | |
|     }).toThrowWithMessage(TypeError, "Cannot set property 'bar' of symbol 'Symbol(foo)'");
 | |
| });
 |