Skip to content

Commit f28cd08

Browse files
committed
dep-tree: use JavaScript and JSON specific heredoc delimiters
1 parent c1b658f commit f28cd08

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

Formula/d/dep-tree.rb

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,16 @@ def install
2424
end
2525

2626
test do
27-
foo_test_file = testpath/"foo.js"
28-
foo_test_file.write "import { bar } from './bar'"
29-
30-
bar_test_file = testpath/"bar.js"
31-
bar_test_file.write "export const bar = 'bar'"
32-
33-
package_json_file = testpath/"package.json"
34-
package_json_file.write "{ \"name\": \"foo\" }"
35-
36-
result_file = testpath/"out.json"
37-
output = shell_output("#{bin}/dep-tree tree --json #{foo_test_file}")
38-
result_file.write(output)
39-
40-
expected = <<~EOF
27+
(testpath/"foo.js").write <<~JS
28+
import { bar } from './bar'
29+
JS
30+
(testpath/"bar.js").write <<~JS
31+
export const bar = 'bar'
32+
JS
33+
(testpath/"package.json").write <<~JSON
34+
{ "name": "foo" }
35+
JSON
36+
expected = <<~JSON
4137
{
4238
"tree": {
4339
"foo.js": {
@@ -47,7 +43,8 @@ def install
4743
"circularDependencies": [],
4844
"errors": {}
4945
}
50-
EOF
51-
assert_equal expected, result_file.read
46+
JSON
47+
48+
assert_equal expected, shell_output("#{bin}/dep-tree tree --json #{testpath}/foo.js")
5249
end
5350
end

0 commit comments

Comments
 (0)