mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
I am unable to print all comments correctly. Comments have way too much semantic meaning in JavaScript. This PR reduces the scope to only print jsdoc comments that are attached to statements and class elements, in order to get isolated declarations shipped.
78 lines
1.3 KiB
Rust
78 lines
1.3 KiB
Rust
use crate::snapshot;
|
|
|
|
#[test]
|
|
fn comment() {
|
|
let cases = vec![
|
|
r"
|
|
/** This is a description of the foo function. */
|
|
function foo() {
|
|
}
|
|
|
|
/**
|
|
* Represents a book.
|
|
* @constructor
|
|
* @param {string} title - The title of the book.
|
|
* @param {string} author - The author of the book.
|
|
*/
|
|
function Book(title, author) {
|
|
}
|
|
|
|
/** Class representing a point. */
|
|
class Point {
|
|
/**
|
|
* Create a point.
|
|
* @param {number} x - The x value.
|
|
* @param {number} y - The y value.
|
|
*/
|
|
constructor(x, y) {
|
|
}
|
|
|
|
/**
|
|
* Get the x value.
|
|
* @return {number} The x value.
|
|
*/
|
|
getX() {
|
|
}
|
|
|
|
/**
|
|
* Get the y value.
|
|
* @return {number} The y value.
|
|
*/
|
|
getY() {
|
|
}
|
|
|
|
/**
|
|
* Convert a string containing two comma-separated numbers into a point.
|
|
* @param {string} str - The string containing two comma-separated numbers.
|
|
* @return {Point} A Point object.
|
|
*/
|
|
static fromString(str) {
|
|
}
|
|
}
|
|
|
|
/** Class representing a point. */
|
|
const Point = class {
|
|
}
|
|
|
|
/**
|
|
* Shirt module.
|
|
* @module my/shirt
|
|
*/
|
|
|
|
/** Button the shirt. */
|
|
exports.button = function() {
|
|
};
|
|
|
|
/** Unbutton the shirt. */
|
|
exports.unbutton = function() {
|
|
};
|
|
|
|
this.Book = function(title) {
|
|
/** The title of the book. */
|
|
this.title = title;
|
|
}
|
|
",
|
|
];
|
|
|
|
snapshot("jsodc", &cases);
|
|
}
|