Skip to content

Commit

Permalink
Run install home test only in Linux/MacOs and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lwronski committed Oct 6, 2021
1 parent fabc308 commit 3c6e447
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package scala.cli.integration

import com.eed3si9n.expecty.Expecty.expect

import scala.util.Properties

class InstallHomeTests extends munit.FunSuite {

val firstVersion = "0.0.1"
Expand Down Expand Up @@ -51,45 +53,46 @@ class InstallHomeTests extends munit.FunSuite {
)
}

test("updating and downgrading dummy scala-cli using install-home command") {
if (!Properties.isWin && TestUtil.isCI) {
test("updating and downgrading dummy scala-cli using install-home command") {

testInputs.fromRoot { root =>
testInputs.fromRoot { root =>

val binDummyScalaCliFirst = dummyScalaCliFirstName.stripSuffix(".scala").toLowerCase
val binDummyScalaCliSecond = dummyScalaCliSecondName.stripSuffix(".scala").toLowerCase
val binDummyScalaCliFirst = dummyScalaCliFirstName.stripSuffix(".scala").toLowerCase
val binDummyScalaCliSecond = dummyScalaCliSecondName.stripSuffix(".scala").toLowerCase

packageDummyScalaCli(root, dummyScalaCliFirstName, binDummyScalaCliFirst)
packageDummyScalaCli(root, dummyScalaCliSecondName, binDummyScalaCliSecond)
packageDummyScalaCli(root, dummyScalaCliFirstName, binDummyScalaCliFirst)
packageDummyScalaCli(root, dummyScalaCliSecondName, binDummyScalaCliSecond)

// install 1 version
installScalaCli(root, binDummyScalaCliFirst, force = true)
// install 1 version
installScalaCli(root, binDummyScalaCliFirst, force = true)

println(binDirPath / dummyScalaCliBinName)
println(binDirPath / dummyScalaCliBinName)

val v1Install = os.proc(binDirPath / dummyScalaCliBinName).call(
cwd = root,
stdin = os.Inherit
).out.text.trim
expect(v1Install == firstVersion)
val v1Install = os.proc(binDirPath / dummyScalaCliBinName).call(
cwd = root,
stdin = os.Inherit
).out.text.trim
expect(v1Install == firstVersion)

// update to 2 version
installScalaCli(root, binDummyScalaCliSecond, force = false)
// update to 2 version
installScalaCli(root, binDummyScalaCliSecond, force = false)

val v2Update = os.proc(binDirPath / dummyScalaCliBinName).call(
cwd = root,
stdin = os.Inherit
).out.text.trim
expect(v2Update == secondVersion)
val v2Update = os.proc(binDirPath / dummyScalaCliBinName).call(
cwd = root,
stdin = os.Inherit
).out.text.trim
expect(v2Update == secondVersion)

// downgrade to 1 version with force
installScalaCli(root, binDummyScalaCliFirst, force = true)
// downgrade to 1 version with force
installScalaCli(root, binDummyScalaCliFirst, force = true)

val v1Downgrade = os.proc(binDirPath / dummyScalaCliBinName).call(
cwd = root,
stdin = os.Inherit
).out.text.trim
expect(v1Downgrade == firstVersion)
val v1Downgrade = os.proc(binDirPath / dummyScalaCliBinName).call(
cwd = root,
stdin = os.Inherit
).out.text.trim
expect(v1Downgrade == firstVersion)
}
}
}

}
26 changes: 26 additions & 0 deletions website/docs/reference/cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ title: Command-line options
sidebar_position: 1
---

## About options

Available in commands:
- [`about`](./commands#about)


<!-- Automatically generated, DO NOT EDIT MANUALLY -->

#### `--version`

Aliases: `-v`

Print only the scala-cli version

## Add path options

Available in commands:
Expand Down Expand Up @@ -342,6 +356,18 @@ Aliases: `-f`

Overwrite scala-cli if exists

#### `--binary-name`

Binary name

#### `--env`

Print the env update

#### `--bin-dir`

Binary directory

## Java options

Available in commands:
Expand Down
3 changes: 3 additions & 0 deletions website/docs/reference/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ sidebar_position: 3

Print details about this application

Accepts options:
- [about](./cli-options.md#about-options)

## `bsp`

Accepts options:
Expand Down

0 comments on commit 3c6e447

Please sign in to comment.