diff options
author | Arnaud Moura <arnaudmoura@gmail.com> | 2020-04-22 07:49:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 07:49:42 +0200 |
commit | dc40fb805f82bad83d5892e1c5734942a2ceade7 (patch) | |
tree | 5b32e3e241d0939e6b86a7adfb5464fb1525aa6c /tests/distros | |
parent | 9604a5a97af45fa601d8d38827eb1462642e2c16 (diff) | |
download | Nim-dc40fb805f82bad83d5892e1c5734942a2ceade7.tar.gz |
Fix OS detection in a docker container (#13172)
* Support detection in docker container. * Get only ID information in os-release. * Add test to distros module. * Fix Linux OS detection in Windows. * Fix OS detection for FreeBSD and OpenBSD.
Diffstat (limited to 'tests/distros')
-rw-r--r-- | tests/distros/tdistros_detect.nim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/distros/tdistros_detect.nim b/tests/distros/tdistros_detect.nim new file mode 100644 index 000000000..793a9edd3 --- /dev/null +++ b/tests/distros/tdistros_detect.nim @@ -0,0 +1,21 @@ +import distros + +discard """ + exitcode: 0 + output: "" +""" + +when defined(windows): + doAssert detectOs(Windows) == true + doAssert detectOs(Ubuntu) == false + doAssert detectOs(MacOSX) == false + +when defined(linux): + doAssert detectOs(Ubuntu) == true + doAssert detectOs(Windows) == false + doAssert detectOs(MacOSX) == false + +when defined(macosx): + doAssert detectOs(MacOSX) == true + doAssert detectOs(Windows) == false + doAssert detectOs(Ubuntu) == false \ No newline at end of file |