Files
n8n-openai-adapter/test/elixir/system_test.exs
T
Alexei Sholik 95d0a73afc Do not test System.pwd return value.
The function relies on Erlang's filename:abs function, so we're
basically testing Erlang here. There is no straightforward way to obtain
current directory by other means that'll work seamlessly on all OSes.
So we'll better not check the return value.
2012-04-11 00:58:19 +03:00

38 lines
878 B
Elixir

Code.require_file "../test_helper", __FILE__
require Erlang.os, as: OS
defmodule System.ARGVTest do
use ExUnit.Case
test :argv do
list = OS.cmd('bin/elixir -e "IO.inspect System.argv" -- -o opt arg1 arg2 --long-opt 10')
{ args, _ } = Code.eval list, []
expected = ["-o", "opt", "arg1", "arg2", "--long-opt", "10"]
assert_equal expected, args
end
end
defmodule SystemTest do
use ExUnit.Case
test :at_exit do
output = OS.cmd('bin/elixir -e "System.at_exit(fn(x) -> IO.inspect x end)"')
assert_equal '0\n', output
end
test :env do
assert_equal nil, System.get_env("SYSTEM_ENV_TEST_VAR")
System.put_env('SYSTEM_ENV_TEST_VAR', 'SAMPLE')
assert_equal "SAMPLE", System.get_env("SYSTEM_ENV_TEST_VAR")
end
test :cmd do
assert is_binary(System.cmd "binary")
end
test :pwd do
assert is_binary(System.pwd)
end
end