Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formulae(s - t): use language-specific heredoc #199790

Merged
merged 41 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift click to select a range
c535a4c
s3cmd: use language-specific heredoc
cho-m Dec 2, 2024
ceb1761
safeint: use language-specific heredoc
cho-m Dec 2, 2024
187ec5c
scala: use language-specific heredoc
cho-m Dec 2, 2024
d5fdcfa
[email protected]: use language-specific heredoc
cho-m Dec 2, 2024
9f1cac1
[email protected]: use language-specific heredoc
cho-m Dec 2, 2024
67d78a5
[email protected]: use language-specific heredoc
cho-m Dec 2, 2024
107cdcd
scalastyle: use language-specific heredoc
cho-m Dec 2, 2024
eb1148a
schema-evolution-manager: use language-specific heredoc
cho-m Dec 2, 2024
61b3dc2
scrcpy: use language-specific heredoc
cho-m Dec 2, 2024
9cb91b6
scrypt: use language-specific heredoc
cho-m Dec 2, 2024
378d51e
shc: use language-specific heredoc
cho-m Dec 2, 2024
51219ce
shellcheck: use language-specific heredoc
cho-m Dec 2, 2024
6b35fb7
shellharden: use language-specific heredoc
cho-m Dec 2, 2024
81ba576
shyaml: use language-specific heredoc
cho-m Dec 2, 2024
ffb08da
six: use language-specific heredoc
cho-m Dec 2, 2024
f25d657
slashem: use language-specific heredoc
cho-m Dec 2, 2024
169f7db
smug: use language-specific heredoc
cho-m Dec 2, 2024
89a964d
spicetify-cli: use language-specific heredoc
cho-m Dec 2, 2024
a7c537b
splint: use language-specific heredoc
cho-m Dec 2, 2024
8f80e8e
sq: use language-specific heredoc
cho-m Dec 2, 2024
d4e1b75
sql-migrate: use language-specific heredoc
cho-m Dec 2, 2024
6949b8c
sql-translator: use language-specific heredoc
cho-m Dec 2, 2024
d9a9a2b
sqlc: use language-specific heredoc
cho-m Dec 2, 2024
6376fc7
sqlcipher: use language-specific heredoc
cho-m Dec 2, 2024
2573603
sqlfluff: use language-specific heredoc
cho-m Dec 2, 2024
16dc6b2
sqlite-analyzer: use language-specific heredoc
cho-m Dec 2, 2024
919da98
sqlite: use language-specific heredoc
cho-m Dec 2, 2024
79361d7
standardese: use language-specific heredoc
cho-m Dec 2, 2024
ef25399
storj-uplink: use language-specific heredoc
cho-m Dec 2, 2024
31018a5
supervisor: use language-specific heredoc
cho-m Dec 2, 2024
6bc0dd1
swift-protobuf: use language-specific heredoc
cho-m Dec 2, 2024
9c64aa9
swift: use language-specific heredoc
cho-m Dec 2, 2024
7e7e43b
tcpstat: use language-specific heredoc
cho-m Dec 2, 2024
9ea3912
terraform-inventory: use language-specific heredoc
cho-m Dec 2, 2024
8fc9f3c
terraform: use language-specific heredoc
cho-m Dec 2, 2024
618bf50
tfmigrate: use language-specific heredoc
cho-m Dec 2, 2024
18ef43b
thrift: use language-specific heredoc
cho-m Dec 2, 2024
3a6ffbe
thriftgo: use language-specific heredoc
cho-m Dec 2, 2024
3d1b8af
tm: use language-specific heredoc
cho-m Dec 2, 2024
5907bb1
toml-test: use language-specific heredoc
cho-m Dec 2, 2024
77f725b
twtxt: use language-specific heredoc
cho-m Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Formula/s/s3cmd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 42,11 @@ def install
end

test do
(testpath/".s3cfg").write <<~EOS
(testpath/".s3cfg").write <<~INI
[default]
access_key = FAKE_KEY
secret_key = FAKE_SECRET
EOS
INI
output = shell_output("#{bin}/s3cmd ls s3://brewtest 2>&1", 77)
assert_match "ERROR: S3 error: 403 (InvalidAccessKeyId)", output

Expand Down
4 changes: 2 additions & 2 deletions Formula/s/safeint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 31,7 @@ def install
test do
# Modified from:
# https://learn.microsoft.com/en-us/cpp/safeint/safeint-class?view=msvc-170#example
(testpath/"test.cc").write <<~EOS
(testpath/"test.cc").write <<~CPP
#ifdef NDEBUG
#undef NDEBUG
#endif
Expand All @@ -52,7 52,7 @@ def install
assert(result == 2);
assert(!success);
}
EOS
CPP

system ENV.cxx, "-std=c 17", "-I#{include}", "-o", "test", "test.cc"
system "./test"
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/scala.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 42,13 @@ def caveats

test do
file = testpath/"Test.scala"
file.write <<~EOS
file.write <<~SCALA
object Test {
def main(args: Array[String]): Unit = {
println(s"${2 2}")
}
}
EOS
SCALA

out = shell_output("#{bin}/scala #{file}").strip

Expand Down
4 changes: 2 additions & 2 deletions Formula/s/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 45,13 @@ def caveats

test do
file = testpath/"Test.scala"
file.write <<~EOS
file.write <<~SCALA
object Test {
def main(args: Array[String]) {
println(s"${2 2}")
}
}
EOS
SCALA

out = shell_output("#{bin}/scala -nc #{file}").strip

Expand Down
4 changes: 2 additions & 2 deletions Formula/s/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 45,13 @@ def caveats

test do
file = testpath/"Test.scala"
file.write <<~EOS
file.write <<~SCALA
object Test {
def main(args: Array[String]): Unit = {
println(s"${2 2}")
}
}
EOS
SCALA

out = shell_output("#{bin}/scala #{file}").strip

Expand Down
4 changes: 2 additions & 2 deletions Formula/s/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 38,13 @@ def caveats

test do
file = testpath/"Test.scala"
file.write <<~EOS
file.write <<~SCALA
object Test {
def main(args: Array[String]): Unit = {
println(s"${2 2}")
}
}
EOS
SCALA

out = shell_output("#{bin}/scala #{file}").strip

Expand Down
4 changes: 2 additions & 2 deletions Formula/s/scalastyle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 30,13 @@ def install
end

test do
(testpath/"test.scala").write <<~EOS
(testpath/"test.scala").write <<~SCALA
object HelloWorld {
def main(args: Array[String]) {
println("Hello")
}
}
EOS
SCALA
testpath.install resource("default_config")
system bin/"scalastyle", "--config", "scalastyle_config.xml", testpath/"test.scala"
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/schema-evolution-manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 17,9 @@ def install
end

test do
(testpath/"new.sql").write <<~EOS
(testpath/"new.sql").write <<~SQL
CREATE TABLE IF NOT EXISTS test (id text);
EOS
SQL
system "git", "init", "."
assert_match "File staged in git", shell_output("#{bin}/sem-add ./new.sql")
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/scrcpy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 64,7 @@ def caveats
# However, exiting on $3 = shell didn't work properly, so instead
# fakeadb exits on $3 = reverse

fakeadb.write <<~EOS
fakeadb.write <<~SH
#!/bin/sh
echo "$@" >> #{testpath/"fakeadb.log"}

Expand All @@ -76,7 76,7 @@ def caveats
if [ "$3" = "reverse" ]; then
exit 42
fi
EOS
SH

fakeadb.chmod 0755
ENV["ADB"] = fakeadb
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/scrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 34,7 @@ def install
end

test do
(testpath/"test.exp").write <<~EOS
(testpath/"test.exp").write <<~EXPECT
set timeout -1
spawn #{bin}/scrypt enc homebrew.txt homebrew.txt.enc
expect -exact "Please enter passphrase: "
Expand All @@ -43,7 43,7 @@ def install
Please confirm passphrase: "
send -- "Testing\n"
expect eof
EOS
EXPECT
touch "homebrew.txt"

system "expect", "-f", "test.exp"
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/shc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 30,11 @@ def install
end

test do
(testpath/"test.sh").write <<~EOS
(testpath/"test.sh").write <<~SH
#!/bin/sh
echo hello
exit 0
EOS
SH
system bin/"shc", "-f", "test.sh", "-o", "test"
assert_equal "hello", shell_output("./test").chomp
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/shellcheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 30,12 @@ def install

test do
sh = testpath/"test.sh"
sh.write <<~EOS
sh.write <<~SH
for f in $(ls *.wav)
do
echo "$f"
done
EOS
SH
assert_match "[SC2045]", shell_output("#{bin}/shellcheck -f gcc #{sh}", 1)
end
end
4 changes: 2 additions & 2 deletions Formula/s/shellharden.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 23,10 @@ def install
end

test do
(testpath/"script.sh").write <<~EOS
(testpath/"script.sh").write <<~SH
dog="poodle"
echo $dog
EOS
SH
system bin/"shellharden", "--replace", "script.sh"
assert_match "echo \"$dog\"", (testpath/"script.sh").read
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/shyaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 35,12 @@ def install
end

test do
yaml = <<~EOS
yaml = <<~YAML
key: val
arr:
- 1st
- 2nd
EOS
YAML
assert_equal "val", pipe_output("#{bin}/shyaml get-value key", yaml, 0)
assert_equal "1st", pipe_output("#{bin}/shyaml get-value arr.0", yaml, 0)
assert_equal "2nd", pipe_output("#{bin}/shyaml get-value arr.-1", yaml, 0)
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/six.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 37,11 @@ def caveats

test do
pythons.each do |python|
system python.opt_libexec/"bin/python", "-c", <<~EOS
system python.opt_libexec/"bin/python", "-c", <<~PYTHON
import six
assert not six.PY2
assert six.PY3
EOS
PYTHON
end
end
end
4 changes: 2 additions & 2 deletions Formula/s/slashem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 75,12 @@ def install
# Make sure that we don't modify the user's files
cp_r "#{Formula["slashem"].prefix}/slashemdir", testpath/"slashemdir"
# Write an expect script to respond to the game's prompts and quit
(testpath/"slashem.exp").write <<~EOS
(testpath/"slashem.exp").write <<~EXPECT
spawn -pty #{Formula["slashem"].prefix}/slashemdir/slashem -d #{testpath}/slashemdir
expect "Shall"
send "q"
expect eof
EOS
EXPECT

system "expect", "slashem.exp"
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/smug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 21,12 @@ def install
end

test do
(testpath/".config/smug/test.yml").write <<~EOF
(testpath/".config/smug/test.yml").write <<~YAML
session: homebrew-test-session
root: .
windows:
- name: test
EOF
YAML

assert_equal(version, shell_output(bin/"smug").lines.first.split("Version").last.chomp)

Expand Down
4 changes: 2 additions & 2 deletions Formula/s/spicetify-cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 42,12 @@ def install
mkdir_p spotify_folder
touch pref_file
path = testpath/".config/spicetify/config-xpui.ini"
path.write <<~EOS
path.write <<~INI
[Setting]
spotify_path = #{spotify_folder}
current_theme = SpicetifyDefault
prefs_path = #{pref_file}
EOS
INI

quiet_system bin/"spicetify", "config"
assert_match version.to_s, shell_output("#{bin}/spicetify -v")
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/splint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 53,15 @@ def install

test do
path = testpath/"test.c"
path.write <<~EOS
path.write <<~C
#include <stdio.h>
int main()
{
char c;
printf("%c", c);
return 0;
}
EOS
C

output = shell_output("#{bin}/splint #{path} 2>&1", 1)
assert_match(/5:18:\s Variable c used before definition/, output)
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/sq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 38,10 @@ def install
end

test do
(testpath/"test.sql").write <<~EOS
(testpath/"test.sql").write <<~SQL
create table t(a text, b integer);
insert into t values ('hello',1),('there',42);
EOS
SQL
system "sqlite3 test.db < test.sql"
out1 = shell_output("#{bin}/sq add --active --handle @tst test.db")
assert_equal %w[@tst sqlite3 test.db], out1.strip.split(/\s /)
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/sql-migrate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 27,12 @@ def install
ENV["TZ"] = "UTC"

test_config = testpath/"dbconfig.yml"
test_config.write <<~EOS
test_config.write <<~YAML
development:
dialect: sqlite3
datasource: test.db
dir: migrations/sqlite3
EOS
YAML

mkdir testpath/"migrations/sqlite3"
system bin/"sql-migrate", "new", "brewtest"
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/sql-translator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 108,12 @@ def install
test do
command = "#{bin}/sqlt -f MySQL -t PostgreSQL --no-comments -"
sql_input = "create table sqlt ( id int AUTO_INCREMENT );"
sql_output = <<~EOS
sql_output = <<~SQL
CREATE TABLE "sqlt" (
"id" serial
);

EOS
SQL
assert_equal sql_output, pipe_output(command, sql_input)
end
end
8 changes: 4 additions & 4 deletions Formula/s/sqlc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 26,7 @@ def install
end

test do
(testpath/"sqlc.json").write <<~SQLC
(testpath/"sqlc.json").write <<~JSON
{
"version": "1",
"packages": [
Expand All @@ -39,14 39,14 @@ def install
}
]
}
SQLC
JSON

(testpath/"query.sql").write <<~EOS
(testpath/"query.sql").write <<~SQL
CREATE TABLE foo (bar text);

-- name: SelectFoo :many
SELECT * FROM foo;
EOS
SQL

system bin/"sqlc", "generate"
assert_predicate testpath/"db.go", :exist?
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/sqlcipher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 53,13 @@ def install

test do
path = testpath/"school.sql"
path.write <<~EOS
path.write <<~SQL
create table students (name text, age integer);
insert into students (name, age) values ('Bob', 14);
insert into students (name, age) values ('Sue', 12);
insert into students (name, age) values ('Tim', json_extract('{"age": 13}', '$.age'));
select name from students order by age asc;
EOS
SQL

names = shell_output("#{bin}/sqlcipher < #{path}").strip.split("\n")
assert_equal %w[Sue Tim Bob], names
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/sqlfluff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 112,9 @@ def install

test do
assert_match version.to_s, shell_output("#{bin}/sqlfluff --version")
(testpath/"test.sql").write <<~EOS
(testpath/"test.sql").write <<~SQL
SELECT 1;
EOS
SQL
assert_match "All Finished!", shell_output("#{bin}/sqlfluff lint --dialect sqlite --nocolor #{testpath}/test.sql")
end
end
Loading
Loading