From 745b94cbb8150f2706cc261ef95766af03f8de3b Mon Sep 17 00:00:00 2001 From: Himanshu Sharma Date: Sun, 26 Jan 2025 16:38:31 +0530 Subject: [PATCH 1/9] Fixes #29: Port Tests --- tests/cli/Dockerfile | 13 ++++++++----- tests/node/port-test.js | 21 +++++++++++++++++++++ tests/python/port-test.py | 16 ++++++++++++++++ tests/ruby/port-test.rb | 15 +++++++++++++++ 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 tests/node/port-test.js create mode 100644 tests/python/port-test.py create mode 100644 tests/ruby/port-test.rb diff --git a/tests/cli/Dockerfile b/tests/cli/Dockerfile index b86118a..af24611 100644 --- a/tests/cli/Dockerfile +++ b/tests/cli/Dockerfile @@ -53,10 +53,13 @@ RUN echo "Running tests ${CACHE_INVALIDATE}" \ | grep -e 'function add(a, b)' -e 'function mult(a, b)' \ && printf "load py sum.py\ninspect\nexit" \ | metacallcli \ - | grep -e 'function sum(a, b, c)' - -# | grep -e 'function sum(a, b, c)' \ -# && printf "load cs say.cs\ninspect\nexit" \ -# | metacallcli || cat /root/metacall.log + | grep -e 'function sum(a, b, c)' \ + && printf "Running port tests\n" \ + && metacallcli port-test.py \ + | grep "Python port works" \ + && metacallcli port-test.js \ + | grep "Node.js port works" \ + && metacallcli port-test.rb \ + | grep "Ruby port works" ENTRYPOINT ["sh", "-c"] diff --git a/tests/node/port-test.js b/tests/node/port-test.js new file mode 100644 index 0000000..dc90cb1 --- /dev/null +++ b/tests/node/port-test.js @@ -0,0 +1,21 @@ +#!/usr/bin/env node + +/* + * MetaCall Distributable by Parra Studios + * Distributable infrastructure for MetaCall. + * + * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia + * + * Licensed under the Apache License, Version 2.0 (the "License") + */ + +const { metacall } = require('metacall'); + +function testPort() { + console.log("Node.js port works"); + return "Node.js port works"; +} + +module.exports = { + testPort +}; \ No newline at end of file diff --git a/tests/python/port-test.py b/tests/python/port-test.py new file mode 100644 index 0000000..17e0692 --- /dev/null +++ b/tests/python/port-test.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +# +# MetaCall Distributable by Parra Studios +# Distributable infrastructure for MetaCall. +# +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia +# +# Licensed under the Apache License, Version 2.0 (the "License") +# + +from metacall import metacall + +def test_port(): + print("Python port works") + return "Python port works" \ No newline at end of file diff --git a/tests/ruby/port-test.rb b/tests/ruby/port-test.rb new file mode 100644 index 0000000..a00de47 --- /dev/null +++ b/tests/ruby/port-test.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +# +# MetaCall Distributable by Parra Studios +# Distributable infrastructure for MetaCall. +# +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia +# +# Licensed under the Apache License, Version 2.0 (the "License") +# + +def test_port + puts "Ruby port works" + return "Ruby port works" +end \ No newline at end of file From 26f98706d24592b3e136dccf3b6903eb433e5189 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:07:50 -0500 Subject: [PATCH 2/9] Update Dockerfile --- tests/cli/Dockerfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/cli/Dockerfile b/tests/cli/Dockerfile index af24611..f8dc519 100644 --- a/tests/cli/Dockerfile +++ b/tests/cli/Dockerfile @@ -55,11 +55,15 @@ RUN echo "Running tests ${CACHE_INVALIDATE}" \ | metacallcli \ | grep -e 'function sum(a, b, c)' \ && printf "Running port tests\n" \ - && metacallcli port-test.py \ - | grep "Python port works" \ - && metacallcli port-test.js \ - | grep "Node.js port works" \ - && metacallcli port-test.rb \ - | grep "Ruby port works" + && metacallcli port-test.py \ + | grep "Python port works" \ + && metacallcli port-test.js \ + | grep "Node.js port works" \ + && metacallcli port-test.rb \ + | grep "Ruby port works" + +# | grep "Ruby port works" \ +# && printf "load cs say.cs\ninspect\nexit" \ +# | metacallcli || cat /root/metacall.log ENTRYPOINT ["sh", "-c"] From 4613f5ac1a995e662fb5dd6675e20579163f08f4 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:08:30 -0500 Subject: [PATCH 3/9] Update port-test.js --- tests/node/port-test.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/node/port-test.js b/tests/node/port-test.js index dc90cb1..9d9efa6 100644 --- a/tests/node/port-test.js +++ b/tests/node/port-test.js @@ -11,11 +11,4 @@ const { metacall } = require('metacall'); -function testPort() { - console.log("Node.js port works"); - return "Node.js port works"; -} - -module.exports = { - testPort -}; \ No newline at end of file +console.log("Node.js port works"); From 0bc9b3bb9457f4dc6938536de737be4a90ca28ea Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:09:00 -0500 Subject: [PATCH 4/9] Update port-test.py --- tests/python/port-test.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/python/port-test.py b/tests/python/port-test.py index 17e0692..eabe35b 100644 --- a/tests/python/port-test.py +++ b/tests/python/port-test.py @@ -9,8 +9,6 @@ # Licensed under the Apache License, Version 2.0 (the "License") # -from metacall import metacall +import metacall -def test_port(): - print("Python port works") - return "Python port works" \ No newline at end of file +print("Python port works") From a0752d1b3001318f27885b34c3a65ad8cc8675dc Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:10:02 -0500 Subject: [PATCH 5/9] Update port-test.py --- tests/python/port-test.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/python/port-test.py b/tests/python/port-test.py index eabe35b..2873742 100644 --- a/tests/python/port-test.py +++ b/tests/python/port-test.py @@ -6,7 +6,17 @@ # # Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # -# Licensed under the Apache License, Version 2.0 (the "License") +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # import metacall From f33c866800dcbb283f3539570d95766c86c61f22 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:10:48 -0500 Subject: [PATCH 6/9] Update port-test.rb --- tests/ruby/port-test.rb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/ruby/port-test.rb b/tests/ruby/port-test.rb index a00de47..3f75beb 100644 --- a/tests/ruby/port-test.rb +++ b/tests/ruby/port-test.rb @@ -6,10 +6,19 @@ # # Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia # -# Licensed under the Apache License, Version 2.0 (the "License") +# Licensed under the Apache License, Version 2.0 (the 'License'); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'metacall' -def test_port - puts "Ruby port works" - return "Ruby port works" -end \ No newline at end of file +puts "Ruby port works" From ea3edb99d2649191fc1c2af4ff14ae72e66bdd8a Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:11:16 -0500 Subject: [PATCH 7/9] Update port-test.js --- tests/node/port-test.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/node/port-test.js b/tests/node/port-test.js index 9d9efa6..322a969 100644 --- a/tests/node/port-test.js +++ b/tests/node/port-test.js @@ -6,7 +6,18 @@ * * Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia * - * Licensed under the Apache License, Version 2.0 (the "License") + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ const { metacall } = require('metacall'); From d9e47f592eeeea57e199ec96b69f7b9b0cd94365 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:12:20 -0500 Subject: [PATCH 8/9] Update Dockerfile --- tests/cli/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cli/Dockerfile b/tests/cli/Dockerfile index f8dc519..388712d 100644 --- a/tests/cli/Dockerfile +++ b/tests/cli/Dockerfile @@ -62,7 +62,7 @@ RUN echo "Running tests ${CACHE_INVALIDATE}" \ && metacallcli port-test.rb \ | grep "Ruby port works" -# | grep "Ruby port works" \ +# TODO: C# Loader # && printf "load cs say.cs\ninspect\nexit" \ # | metacallcli || cat /root/metacall.log From 74a64e602efd784400c324e5c4a74e5f8dec7976 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:32:34 -0500 Subject: [PATCH 9/9] Update Dockerfile --- tests/cli/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/cli/Dockerfile b/tests/cli/Dockerfile index 388712d..558867f 100644 --- a/tests/cli/Dockerfile +++ b/tests/cli/Dockerfile @@ -60,10 +60,11 @@ RUN echo "Running tests ${CACHE_INVALIDATE}" \ && metacallcli port-test.js \ | grep "Node.js port works" \ && metacallcli port-test.rb \ - | grep "Ruby port works" + | grep "Ruby port works" \ + || cat /root/metacall.log # TODO: C# Loader # && printf "load cs say.cs\ninspect\nexit" \ -# | metacallcli || cat /root/metacall.log +# | metacallcli ENTRYPOINT ["sh", "-c"]