Skip to content

Commit 503c91b

Browse files
committed
add test and add os.devnull to globals
1 parent f55197f commit 503c91b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

os/os.module.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ func init() {
9090
"pathsep": getpathsep(),
9191
"linesep": getlinesep(),
9292
"defpath": getdefpath(),
93+
"devnull": getdevnull(),
9394
}
9495

9596
py.RegisterModule(&py.ModuleImpl{

os/os.test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,16 @@ def _fail(test_name):
198198
_fail("os.linesep corresponding with os.name")
199199
failed+=1
200200

201+
if os.devnull == "/dev/null" and os.name == "posix":
202+
_pass('os.devnull == "/dev/null" and os.name == "posix"')
203+
passed_tests+=1
204+
elif os.devnull == "nul" and os.name == "nt":
205+
_pass('os.devnull == "nul" and os.name == "nt"')
206+
passed_tests+=1
207+
else:
208+
_fail("os.devnull corresponding with os.name")
209+
failed+=1
210+
201211
print()
202212
print(bcolors.ENDC+bcolors.BOLD+bcolors.HEADER+"Please check if $HOME will be outputted...")
203213
print(bcolors.ENDC)

0 commit comments

Comments
 (0)