1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/fmt/tests/comments_array_keep.vv

77 lines
1.2 KiB
V
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

fn main() {
_ := [
// pre comment
6,
// and after
]
_ := [
7,
// below expr
]
_ := [
8, /* I don't know why this still is a block comment */
9,
]
arr := [
// test 0
1,
// test 1
2,
// test 2
3, /* 3 */
4, /* 4-1 */ /* 4-2 */
]
}
fn only_comments_array() {
_ := [/* on a single line */ /* too */]
_ := [
// 1,
// 2,
// 3,
]
_ := [
/* whatever */ /* this is */ // 3,
// 4,
]
}
fn single_line_array_pre_comments() {
_ := [/* 2, */ 3]
_ := [/* 4, */ /* 5, */ 6]
_ := [/* cmt */ -4]
}
fn single_line_array_iembed_comments() {
_ := [1, /* betw single line */ 2]
// This caused a bug where the ´-´ was parsed as InfixExpr and not as part of an IntegerLiteral
_ := [1, /* cmt */ -4]
}
fn mixed_comments() {
_ := [
3 /* iembed */,
// keep line comment here
// and here
5,
]
}
fn keep_real_block_comment() {
_ := [
'foo',
/*
'bar',
'baz',
'spam',
*/
'eggs',
]
}
fn comment_at_line_start_with_expressions_after() {
arr := [123456789012345, 234567890123456, 678901234567890, 789012345678901, /* at the end */
345678901234567, /* in between */ 456789012345678,
/* line start */ 567890123456789, 890123456789012]
}