mirror of
https://github.com/flynx/object.js.git
synced 2025-10-30 02:50:10 +00:00
bugfix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
dce24493ff
commit
d6d8492cd6
@ -92,7 +92,8 @@ function(text, tab_size, leading_tabs){
|
||||
: text
|
||||
// trim the tail and remove leading blank lines...
|
||||
var lines = text.trimEnd().split(/\n/)
|
||||
while(lines[0].trim() == ''){
|
||||
while(lines.length > 0
|
||||
&& lines[0].trim() == ''){
|
||||
// XXX we have two options here:
|
||||
// - indent everyline including the first non-blank
|
||||
// - do not indent anything (current)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-object",
|
||||
"version": "5.2.7",
|
||||
"version": "5.2.8",
|
||||
"description": "",
|
||||
"main": "object.js",
|
||||
"scripts": {
|
||||
|
||||
41
test.js
41
test.js
@ -673,6 +673,8 @@ var cases = test.Cases({
|
||||
// XXX still need to test tab_size values (0, ...)
|
||||
text_cases: [
|
||||
// sanity checks...
|
||||
{ input: '',
|
||||
all: ''},
|
||||
{ input: 'abc',
|
||||
all: 'abc'},
|
||||
{ input: '\n\t\tabc',
|
||||
@ -758,28 +760,33 @@ var cases = test.Cases({
|
||||
text: function(assert){
|
||||
this.text_cases
|
||||
.map(function({input, doc, text, all}, i){
|
||||
var res
|
||||
doc = doc != null ?
|
||||
doc
|
||||
: all
|
||||
text = text != null ?
|
||||
text
|
||||
: all
|
||||
|
||||
;(doc || all)
|
||||
&& assert((res = object.doc([input])) == (doc || all),
|
||||
'doc(text_cases['+i+']):'
|
||||
var test = function(func, input, expect){
|
||||
var res
|
||||
return assert((res = object[func](input)) == expect,
|
||||
func +'(text_cases['+i+']):'
|
||||
+'\n---input---\n'
|
||||
+ input
|
||||
+ (input instanceof Array ?
|
||||
input[0]
|
||||
: input)
|
||||
+'\n---Expected---\n'
|
||||
+ (doc || all)
|
||||
+ expect
|
||||
+'\n---Got---\n'
|
||||
+ res
|
||||
+'\n---')
|
||||
;(text || all)
|
||||
&& assert((res = object.text([input])) == (text || all),
|
||||
'text(text_cases['+i+']):'
|
||||
+'\n---input---\n'
|
||||
+ input
|
||||
+'\n---Expected---\n'
|
||||
+ (text || all)
|
||||
+'\n---Got---\n'
|
||||
+ res
|
||||
+'\n---') }) },
|
||||
+'\n---') }
|
||||
|
||||
doc != null
|
||||
&& test('normalizeIndent', input, doc)
|
||||
&& test('doc', [input], doc)
|
||||
text != null
|
||||
&& test('normalizeTextIndent', input, text)
|
||||
&& test('text', [input], text) }) },
|
||||
})
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user