Added tests for std::os

parent ba3fabed
......@@ -27,6 +27,7 @@ import test::std::test_iterator
import test::std::test_mirror
import test::std::test_nil
import test::std::test_object
import test::std::test_os
import test::std::test_string
import test::std::test_string_buffer
......
import std::os::(self, NEWLINE)
import std::test
import std::test::assert
let VALID_PLATFORMS = [
'android',
'bitrig',
'dragonfly',
'freebsd',
'ios',
'linux',
'macos',
'netbsd',
'openbsd',
'unix',
'unknown',
'windows'
]
test.group('std::os.platform') do (g) {
g.test('Obtaining the name of the underlying platform') {
assert.true(VALID_PLATFORMS.contains?(os.platform))
}
}
test.group('std::os.windows?') do (g) {
g.test('Checking if the underlying platform is Windows') {
assert.equal(os.windows?, os.platform == 'windows')
}
}
test.group('std::os::NEWLINE') do (g) {
g.test('Obtaining the newline separator for the underlying platform') {
let expected = os.windows?.if true: { "\r\n" }, false: { "\n" }
assert.equal(NEWLINE, expected)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment