Skip to content

Commit 5edb553

Browse files
committed
Adjust
1 parent e008d26 commit 5edb553

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

tests/format.rs

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,3 +1890,102 @@ fn trailing_comment_does_not_become_doc_comment() {
18901890
)
18911891
.success();
18921892
}
1893+
1894+
#[test]
1895+
fn trailing_comment_recipe_with_body_is_stripped() {
1896+
Test::new()
1897+
.arg("--dump")
1898+
.justfile(
1899+
"
1900+
foo: # bar
1901+
echo baz
1902+
",
1903+
)
1904+
.stdout(
1905+
"
1906+
foo:
1907+
echo baz
1908+
",
1909+
)
1910+
.success();
1911+
}
1912+
1913+
#[test]
1914+
fn trailing_comment_export() {
1915+
Test::new()
1916+
.arg("--dump")
1917+
.justfile(
1918+
"
1919+
export foo := 'bar' # baz
1920+
",
1921+
)
1922+
.stdout(
1923+
"
1924+
export foo := 'bar' # baz
1925+
",
1926+
)
1927+
.success();
1928+
}
1929+
1930+
#[test]
1931+
fn trailing_comment_recipe_with_dependencies_and_body_is_stripped() {
1932+
Test::new()
1933+
.arg("--dump")
1934+
.justfile(
1935+
"
1936+
foo: bar # baz
1937+
echo qux
1938+
1939+
bar:
1940+
",
1941+
)
1942+
.stdout(
1943+
"
1944+
foo: bar
1945+
echo qux
1946+
1947+
bar:
1948+
",
1949+
)
1950+
.success();
1951+
}
1952+
1953+
#[test]
1954+
fn multiple_trailing_comments() {
1955+
Test::new()
1956+
.arg("--dump")
1957+
.justfile(
1958+
"
1959+
foo := 'bar' # comment1
1960+
baz := 'qux' # comment2
1961+
",
1962+
)
1963+
.stdout(
1964+
"
1965+
foo := 'bar' # comment1
1966+
baz := 'qux' # comment2
1967+
",
1968+
)
1969+
.success();
1970+
}
1971+
1972+
#[test]
1973+
fn trailing_comments_separated_by_blank_line() {
1974+
Test::new()
1975+
.arg("--dump")
1976+
.justfile(
1977+
"
1978+
foo := 'bar' # comment1
1979+
1980+
baz := 'qux' # comment2
1981+
",
1982+
)
1983+
.stdout(
1984+
"
1985+
foo := 'bar' # comment1
1986+
1987+
baz := 'qux' # comment2
1988+
",
1989+
)
1990+
.success();
1991+
}

0 commit comments

Comments
 (0)