Test cases for trailing comments of object literal

This commit is contained in:
Sheetal Nandi 2014-08-15 13:30:26 -07:00
parent 3dd21fc3a7
commit 48c3abd445
9 changed files with 71 additions and 43 deletions

View File

@ -10,6 +10,6 @@
*/
initialize: function(name) {
this.name = name;
},
} /* trailing comment 1*/,
}
);

View File

@ -8,7 +8,7 @@ var Person = makeClass(
*/
initialize: function(name) {
this.name = name;
},
} /* trailing comment 1*/,
}
);
@ -21,5 +21,5 @@ var Person = makeClass({
*/
initialize: function (name) {
this.name = name;
}
} /* trailing comment 1*/
});

View File

@ -1,24 +0,0 @@
==== tests/cases/compiler/commentsOnObjectLiteral3.ts (2 errors) ====
var v = {
//property
prop: 1,
//property
func: function () {
},
//PropertyName + CallSignature
func1() { },
//getter
get a() {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return this.prop;
},
//setter
set a(value) {
~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
this.prop = value;
}
};

View File

@ -0,0 +1,42 @@
//// [commentsOnObjectLiteral3.ts]
var v = {
//property
prop: 1 /* multiple trailing comments */ /*trailing comments*/,
//property
func: function () {
},
//PropertyName + CallSignature
func1() { },
//getter
get a() {
return this.prop;
} /*trailing 1*/,
//setter
set a(value) {
this.prop = value;
} // trailing 2
};
//// [commentsOnObjectLiteral3.js]
var v = {
//property
prop: 1 /* multiple trailing comments */ /*trailing comments*/ ,
//property
func: function () {
},
//PropertyName + CallSignature
func1:
//PropertyName + CallSignature
function () {
},
//getter
get a() {
return this.prop;
} /*trailing 1*/ ,
//setter
set a(value) {
this.prop = value;
} // trailing 2
};

View File

@ -1,12 +0,0 @@
==== tests/cases/compiler/commentsOnObjectLiteral4.ts (1 errors) ====
var v = {
/**
* @type {number}
*/
get bar(): number {
~~~
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return this._bar;
}
}

View File

@ -0,0 +1,20 @@
//// [commentsOnObjectLiteral4.ts]
var v = {
/**
* @type {number}
*/
get bar(): number {
return this._bar;
}
}
//// [commentsOnObjectLiteral4.js]
var v = {
/**
* @type {number}
*/
get bar() {
return this._bar;
}
};

View File

@ -8,6 +8,6 @@ var Person = makeClass(
*/
initialize: function(name) {
this.name = name;
},
} /* trailing comment 1*/,
}
);

View File

@ -1,8 +1,9 @@
// @comments: true
// @target: ES5
var v = {
//property
prop: 1,
prop: 1 /* multiple trailing comments */ /*trailing comments*/,
//property
func: function () {
},
@ -11,9 +12,9 @@ var v = {
//getter
get a() {
return this.prop;
},
} /*trailing 1*/,
//setter
set a(value) {
this.prop = value;
}
} // trailing 2
};

View File

@ -1,4 +1,5 @@
// @comments: true
// @target: ES5
var v = {
/**