mirror of
				https://github.com/flynx/object.js.git
				synced 2025-10-31 03:20:09 +00:00 
			
		
		
		
	cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									8f42025fc7
								
							
						
					
					
						commit
						6a69983cc8
					
				
							
								
								
									
										120
									
								
								test.js
									
									
									
									
									
								
							
							
						
						
									
										120
									
								
								test.js
									
									
									
									
									
								
							| @ -702,128 +702,10 @@ var cases = test.Cases({ | |||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	// text utils...
 | 	// text utils...
 | ||||||
| 	/* XXX might be a good idea to do a separate test suite for this to  | 	// XXX might be a good idea to do a separate test suite for this to 
 | ||||||
| 	// 		be able to reference individual cases...
 | 	// 		be able to reference individual cases...
 | ||||||
| 	// 		...or to re-organize this thing differently....
 | 	// 		...or to re-organize this thing differently....
 | ||||||
| 	// XXX still need to test tab_size values (0, ...)
 | 	// XXX still need to test tab_size values (0, ...)
 | ||||||
| 	text_cases: [ |  | ||||||
| 		// sanity checks...
 |  | ||||||
| 		{ input: '', |  | ||||||
| 			all: ''}, |  | ||||||
| 		{ input: 'abc', |  | ||||||
| 			all: 'abc'}, |  | ||||||
| 		{ input: '\n\t\tabc', |  | ||||||
| 			all: 'abc'}, |  | ||||||
| 
 |  | ||||||
| 		// NOTE: there is no way to know what is the indent of 'a'
 |  | ||||||
| 		// 		relative to the rest of the text...
 |  | ||||||
| 		{ input: `a
 |  | ||||||
| 				c`,
 |  | ||||||
| 			text: 'a\nc',  |  | ||||||
| 			doc: 'a\n    c'}, |  | ||||||
| 		{ input: `a\nc`, |  | ||||||
| 			text: 'a\nc',  |  | ||||||
| 			doc: 'a\nc'}, |  | ||||||
| 		{ input: `\
 |  | ||||||
| 				a |  | ||||||
| 					c`,
 |  | ||||||
| 			all: 'a\n    c'}, |  | ||||||
| 		{ input: ` |  | ||||||
| 				a |  | ||||||
| 					c`,
 |  | ||||||
| 			all: 'a\n    c'}, |  | ||||||
| 		{ input: ` |  | ||||||
| 				a |  | ||||||
| 					c`, 
 |  | ||||||
| 			all: 'a\n    c' }, |  | ||||||
| 
 |  | ||||||
| 		{ input: `a
 |  | ||||||
| 				b |  | ||||||
| 				c`, 
 |  | ||||||
| 			text: 'a\nb\nc', |  | ||||||
| 	   		doc: 'a\n    b\n    c' }, |  | ||||||
| 
 |  | ||||||
| 		{ input: ` |  | ||||||
| 				a |  | ||||||
| 				b |  | ||||||
| 					c`, 
 |  | ||||||
| 			all: 'a\nb\n    c' }, |  | ||||||
| 		{ input: ` |  | ||||||
| 				a |  | ||||||
| 					b |  | ||||||
| 					c`, 
 |  | ||||||
| 			all: 'a\n    b\n    c' }, |  | ||||||
| 
 |  | ||||||
| 		{ input: `a
 |  | ||||||
| 					b |  | ||||||
| 				c`, 
 |  | ||||||
| 			all: `a\n    b\nc` }, |  | ||||||
| 		{ input: `a
 |  | ||||||
| 					b |  | ||||||
| 						c`, 
 |  | ||||||
| 			all: `a\nb\n    c` }, |  | ||||||
| 		{ input: ` |  | ||||||
| 				a |  | ||||||
| 					b |  | ||||||
| 						c`, 
 |  | ||||||
| 			all: `a\n    b\n        c` }, |  | ||||||
| 		{ input: `a
 |  | ||||||
| 					b |  | ||||||
| 					b |  | ||||||
| 					b |  | ||||||
| 				c`, 
 |  | ||||||
| 			all: `a\n    b\n    b\n    b\nc` }, |  | ||||||
| 		{ input: `a
 |  | ||||||
| 					b |  | ||||||
| 						b |  | ||||||
| 					b |  | ||||||
| 				c`, 
 |  | ||||||
| 			all: `a\n    b\n        b\n    b\nc` }, |  | ||||||
| 		{ input: ` |  | ||||||
| 				a |  | ||||||
| 					b |  | ||||||
| 				c`, 
 |  | ||||||
| 			all: `a\n    b\nc` }, |  | ||||||
| 		{ input: `a
 |  | ||||||
| 					b |  | ||||||
| 				c |  | ||||||
| 				d`, 
 |  | ||||||
| 			text: `a\n    b\nc\nd`, |  | ||||||
| 			// XXX not sure about this...
 |  | ||||||
| 			doc: `a\n        b\n    c\n    d` }, |  | ||||||
| 	], |  | ||||||
| 	text: function(assert){ |  | ||||||
| 		this.text_cases |  | ||||||
| 			.map(function({input, doc, text, all}, i){ |  | ||||||
| 				doc = doc != null ?  |  | ||||||
| 					doc  |  | ||||||
| 					: all |  | ||||||
| 				text = text != null ?  |  | ||||||
| 					text  |  | ||||||
| 					:  all |  | ||||||
| 
 |  | ||||||
| 				var test = function(func, input, expect){ |  | ||||||
| 					var res |  | ||||||
| 					return assert((res = object[func](input)) == expect,  |  | ||||||
| 						func +'(text_cases['+i+']):' |  | ||||||
| 							+'\n---input---\n' |  | ||||||
| 							+ (input instanceof Array ? |  | ||||||
| 								input[0] |  | ||||||
| 								: input) |  | ||||||
| 							+'\n---Expected---\n' |  | ||||||
| 							+ expect |  | ||||||
| 							+'\n---Got---\n' |  | ||||||
| 							+ res |  | ||||||
| 							+'\n---') } |  | ||||||
| 
 |  | ||||||
| 				doc != null |  | ||||||
| 					&& test('normalizeIndent', input, doc) |  | ||||||
| 					&& test('doc', [input], doc) |  | ||||||
| 				text != null |  | ||||||
| 					&& test('normalizeTextIndent', input, text) |  | ||||||
| 					&& test('text', [input], text) }) }, |  | ||||||
| 	//*/
 |  | ||||||
| 
 |  | ||||||
| 	// XXX naming is not clear -- should be close to automatic...
 | 	// XXX naming is not clear -- should be close to automatic...
 | ||||||
| 	// XXX still need to test tab_size values (0, ...)
 | 	// XXX still need to test tab_size values (0, ...)
 | ||||||
| 	// sanity checks...
 | 	// sanity checks...
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user