diff --git a/metacall.rb b/metacall.rb index e75721c..39ef155 100644 --- a/metacall.rb +++ b/metacall.rb @@ -7,7 +7,7 @@ class Metacall < Formula head "https://github.com/metacall/core.git", branch: "develop" depends_on "cmake" => :build - depends_on "node@18" + depends_on "node@14" depends_on "openjdk" depends_on "python@3.12" depends_on "ruby" @@ -99,19 +99,31 @@ def install Dir.mkdir(testpath/"typescript") (testpath/"typescript/typedfunc.ts").write <<~EOS 'use strict'; - export function typed_sum(left:number,right:number):number{return left+right} - export async function typed_sum_async(left:number,right:number):Promise{return left+right} - export function build_name(first:string,last='Smith'){return`${first} ${last}`} - export function object_pattern_ts({asd}){return asd} - export function typed_array(a:number[]):number{return a[0]+a[1]+a[2]} - export function object_record(a:Record):number{return a.element} + export function typed_sum(left: number, right: number): number { + return left+right + } + export async function typed_sum_async(left: number, right: number): Promise { + return left+right + } + export function build_name(first: string, last = 'Smith') { + return`${first} ${last}` + } + export function object_pattern_ts({asd}){ + return asd + } + export function typed_array(a: number[]): number{ + return a[0]+a[1]+a[2] + } + export function object_record(a: Record): number { + return a.element + } EOS - (testpath/"testTypescript.sh").write <<~EOS + (testpath/"test_typescript.sh").write <<~EOS #!/usr/bin/env bash cd typescript echo 'load ts typedfunc.ts\ninspect\ncall typed_sum(4, 5)\nexit' | #{bin}/metacall EOS - chmod("u+x", testpath/"testTypescript.sh") + chmod("u+x", testpath/"test_typescript.sh") (testpath/"test.py").write <<~EOS print("Hello from Python") EOS @@ -119,15 +131,17 @@ def install print("Hello from Ruby") EOS (testpath/"test.java").write <<~EOS - public class HelloWorld{public static void main(String[]args) - {System.err.println("Hello from Java!");System.out.println("Hello from Java!"); - System.out.println("Hello from Java!");System.out.println("Hello from Java!");}} + public class test { + public static void main(String[]args) { + System.err.println("Hello from Java"); + } + } EOS # Tests assert_match "Hello from Python", shell_output("#{bin}/metacall test.py") assert_match "Hello from Ruby", shell_output("#{bin}/metacall test.rb") - assert_match "Script (test.java) loaded correctly\n", shell_output("#{bin}/metacall test.java") + assert_match "Hello from Java", shell_output("#{bin}/metacall test.java") assert_match "Hello from NodeJS", shell_output("#{bin}/metacall test.js") - assert_match "9.0", shell_output(testpath/"testTypescript.sh") + assert_match "9.0", shell_output(testpath/"test_typescript.sh") end end