mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
added more block-comment related tests for single-line block-comments and jsdoc-like @doctags-comments.
This commit is contained in:
parent
1b7491d63d
commit
89f5f9d59d
1 changed files with 125 additions and 0 deletions
|
@ -212,6 +212,18 @@ test "#2916: block comment before implicit call with implicit object", ->
|
|||
fn
|
||||
a: yes
|
||||
|
||||
test "#3132: Format single-line block comment nicely", ->
|
||||
input = """
|
||||
### Single-line block comment without additional space here => ###"""
|
||||
|
||||
result = """
|
||||
|
||||
/* Single-line block comment without additional space here => */
|
||||
|
||||
|
||||
"""
|
||||
eq CoffeeScript.compile(input, bare: on), result
|
||||
|
||||
test "#3132: Format multi-line block comment nicely", ->
|
||||
input = """
|
||||
###
|
||||
|
@ -274,3 +286,116 @@ test "#3132: Format indented block-comment nicely", ->
|
|||
|
||||
"""
|
||||
eq CoffeeScript.compile(input, bare: on), result
|
||||
|
||||
# Although adequately working, block comment-placement is not yet perfect.
|
||||
# (Considering a case where multiple variables have been declared …)
|
||||
test "#3132: Format jsdoc-style block-comment nicely", ->
|
||||
input = """
|
||||
###*
|
||||
# Multiline for jsdoc-"@doctags"
|
||||
#
|
||||
# @type {Function}
|
||||
###
|
||||
fn = () -> 1
|
||||
"""
|
||||
|
||||
result = """
|
||||
|
||||
/**
|
||||
* Multiline for jsdoc-"@doctags"
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
var fn;
|
||||
|
||||
fn = function() {
|
||||
return 1;
|
||||
};
|
||||
|
||||
"""
|
||||
eq CoffeeScript.compile(input, bare: on), result
|
||||
|
||||
# Although adequately working, block comment-placement is not yet perfect.
|
||||
# (Considering a case where multiple variables have been declared …)
|
||||
test "#3132: Format hand-made (raw) jsdoc-style block-comment nicely", ->
|
||||
input = """
|
||||
###*
|
||||
* Multiline for jsdoc-"@doctags"
|
||||
*
|
||||
* @type {Function}
|
||||
###
|
||||
fn = () -> 1
|
||||
"""
|
||||
|
||||
result = """
|
||||
|
||||
/**
|
||||
* Multiline for jsdoc-"@doctags"
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
var fn;
|
||||
|
||||
fn = function() {
|
||||
return 1;
|
||||
};
|
||||
|
||||
"""
|
||||
eq CoffeeScript.compile(input, bare: on), result
|
||||
|
||||
# Although adequately working, block comment-placement is not yet perfect.
|
||||
# (Considering a case where multiple variables have been declared …)
|
||||
test "#3132: Place block-comments nicely", ->
|
||||
input = """
|
||||
###*
|
||||
# A dummy class definition
|
||||
#
|
||||
# @class
|
||||
###
|
||||
class DummyClass
|
||||
|
||||
###*
|
||||
# @constructor
|
||||
###
|
||||
constructor: ->
|
||||
|
||||
###*
|
||||
# Singleton reference
|
||||
#
|
||||
# @type {DummyClass}
|
||||
###
|
||||
@instance = new DummyClass()
|
||||
|
||||
"""
|
||||
|
||||
result = """
|
||||
|
||||
/**
|
||||
* A dummy class definition
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
var DummyClass;
|
||||
|
||||
DummyClass = (function() {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function DummyClass() {}
|
||||
|
||||
|
||||
/**
|
||||
* Singleton reference
|
||||
*
|
||||
* @type {DummyClass}
|
||||
*/
|
||||
|
||||
DummyClass.instance = new DummyClass();
|
||||
|
||||
return DummyClass;
|
||||
|
||||
})();
|
||||
|
||||
"""
|
||||
eq CoffeeScript.compile(input, bare: on), result
|
||||
|
|
Loading…
Reference in a new issue