Skip to content

Commit 0e2d492

Browse files
Moisanchenrui333
authored andcommitted
replxx 0.0.4 (new formula)
autobump: add replxx Signed-off-by: Rui Chen <rui@chenrui.dev>
1 parent 3b98fa3 commit 0e2d492

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.github/autobump.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,6 +2587,7 @@ release-it
25872587
remarshal
25882588
remind
25892589
renovate
2590+
replxx
25902591
repo
25912592
reposurgeon
25922593
repren

Formula/r/replxx.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
class Replxx < Formula
2+
desc "Readline and libedit replacement"
3+
homepage "https://github.com/AmokHuginnsson/replxx"
4+
url "https://github.com/AmokHuginnsson/replxx/archive/refs/tags/release-0.0.4.tar.gz"
5+
sha256 "a22988b2184e1d256e2d111b5749e16ffb1accbf757c7b248226d73c426844c4"
6+
license all_of: ["BSD-3-Clause", "Unicode-TOU"]
7+
8+
depends_on "cmake" => :build
9+
10+
def install
11+
system "cmake", "-S", ".", "-B", "build", "-DBUILD_SHARED_LIBS=ON", *std_cmake_args
12+
system "cmake", "--build", "build"
13+
system "cmake", "--install", "build"
14+
15+
pkgshare.install "examples"
16+
end
17+
18+
test do
19+
cp_r pkgshare/"examples", testpath
20+
cd "examples" do
21+
system ENV.cc, "-c", "util.c", "-o", "util.o"
22+
system ENV.cc, "c-api.c", "util.o", "-L#{lib}", "-I#{include}", "-lreplxx", "-lm", "-o", "test"
23+
24+
# `test` executable is an interactive program so we use Open3 to interact with it
25+
Open3.popen3("./test") do |stdin, stdout, stderr, _|
26+
sleep 2
27+
assert_match "starting...", stdout.gets
28+
29+
stdin.puts "hello"
30+
sleep 2
31+
32+
assert_match "thanks for the input: hello", stdout.gets
33+
34+
stdin.close # simulate Ctrl+D by closing stdin
35+
36+
assert_empty stderr.read
37+
end
38+
end
39+
end
40+
end

0 commit comments

Comments
 (0)