diff --git a/Formula/quickjs.rb b/Formula/quickjs.rb new file mode 100644 index 0000000000..8cfc419d1b --- /dev/null +++ b/Formula/quickjs.rb @@ -0,0 +1,21 @@ +class Quickjs < Formula + desc "Small and embeddable JavaScript engine" + homepage "https://bellard.org/quickjs/" + url "https://bellard.org/quickjs/quickjs-2019-07-09.tar.xz" + sha256 "350c1cd9dd318ad75e15c9991121c80b85c2ef873716a8900f811554017cd564" + + def install + system "make", "install", "prefix=#{prefix}" + end + + test do + output = shell_output("#{bin}/qjs -e 'console.log(\"hello\");'").strip + assert_equal "hello", output + + path = testpath/"test.js" + path.write "console.log('hello');" + system "#{bin}/qjsc", path + output = shell_output(testpath/"a.out").strip + assert_equal "hello", output + end +end