mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-27 14:02:07 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			61 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| test("valid 'use strict; directive", () => {
 | |
|     expect(
 | |
|         (() => {
 | |
|             "use strict";
 | |
|             return isStrictMode();
 | |
|         })()
 | |
|     ).toBeTrue();
 | |
|     expect(
 | |
|         // prettier-ignore
 | |
|         (() => {
 | |
|             'use strict';
 | |
|             return isStrictMode();
 | |
|         })()
 | |
|     ).toBeTrue();
 | |
| });
 | |
| 
 | |
| test("invalid 'use strict; directive", () => {
 | |
|     expect(
 | |
|         (() => {
 | |
|             " use strict ";
 | |
|             return isStrictMode();
 | |
|         })()
 | |
|     ).toBeFalse();
 | |
|     expect(
 | |
|         (() => {
 | |
|             `use strict`;
 | |
|             return isStrictMode();
 | |
|         })()
 | |
|     ).toBeFalse();
 | |
|     expect(
 | |
|         (() => {
 | |
|             "use\
 | |
|             strict";
 | |
|             return isStrictMode();
 | |
|         })()
 | |
|     ).toBeFalse();
 | |
|     expect(
 | |
|         (() => {
 | |
|             "use\ strict";
 | |
|             return isStrictMode();
 | |
|         })()
 | |
|     ).toBeFalse();
 | |
|     expect(
 | |
|         (() => {
 | |
|             "use \163trict";
 | |
|             return isStrictMode();
 | |
|         })()
 | |
|     ).toBeFalse();
 | |
|     expect(
 | |
|         (() => {
 | |
|             `"use strict"`;
 | |
|             return isStrictMode();
 | |
|         })()
 | |
|     ).toBeFalse();
 | |
|     expect(
 | |
|         (() => {
 | |
|             "use strict" + 1;
 | |
|             return isStrictMode();
 | |
|         })()
 | |
|     ).toBeFalse();
 | |
| });
 | 
