From 45a24051a7304c255795cb1bc178dc7086a52621 Mon Sep 17 00:00:00 2001 From: Gal Schlezinger Date: Thu, 14 Feb 2019 11:21:48 +0200 Subject: [PATCH] Add test and don't throw errors (#37) --- executable/Install.re | 9 +++++++++ feature_tests/existing_installation/run.sh | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 feature_tests/existing_installation/run.sh diff --git a/executable/Install.re b/executable/Install.re index cc0b2dd..24d15f7 100644 --- a/executable/Install.re +++ b/executable/Install.re @@ -93,6 +93,15 @@ let run = (~version) => , ) |> Lwt.return + | Versions.Already_installed(version) => + Console.log( + + "Version " + version + " is already installed." + , + ) + |> Lwt.return | Versions.Version_not_found(version) => Console.log( diff --git a/feature_tests/existing_installation/run.sh b/feature_tests/existing_installation/run.sh new file mode 100644 index 0000000..15f810f --- /dev/null +++ b/feature_tests/existing_installation/run.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +eval `fnm env` + +fnm install v8.11.3 +fnm install v8.11.3 | grep "already installed" + +if [ "$?" != "0" ]; then + echo "The second installation should say it is already installed" + exit 1 +fi