diff options
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | t/win32/getosversion.t | 13 | ||||
-rw-r--r-- | win32/win32.c | 6 |
3 files changed, 20 insertions, 0 deletions
@@ -2949,6 +2949,7 @@ t/uni/tr_sjis.t See if Unicode tr/// works t/uni/tr_utf8.t See if Unicode tr/// works t/uni/upper.t See if Unicode casing works t/uni/write.t See if Unicode formats work +t/win32/getosversion.t Test if Win32::GetOSVersion() works t/win32/longpath.t Test if Win32::GetLongPathName() works t/win32/system.t See if system works in Win* t/win32/system_tests Test runner for system.t diff --git a/t/win32/getosversion.t b/t/win32/getosversion.t new file mode 100644 index 0000000000..2a708cb80a --- /dev/null +++ b/t/win32/getosversion.t @@ -0,0 +1,13 @@ +#!perl -w + +# tests for Win32::GetOSVersion() + +$^O =~ /^MSWin/ or print("1..0 # not win32\n" ), exit; + +print "1..1\n"; + +my $scalar = Win32::GetOSVersion(); +my @array = Win32::GetOSVersion(); + +print "not " unless $scalar == $array[4]; +print "ok 1\n"; diff --git a/win32/win32.c b/win32/win32.c index f4c43fc6de..19662af800 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4618,6 +4618,9 @@ XS(w32_GetOSVersion) XSRETURN_EMPTY; } } + if (GIMME_V == G_SCALAR) { + XSRETURN_IV(osverw.dwPlatformId); + } W2AHELPER(osverw.szCSDVersion, szCSDVersion, sizeof(szCSDVersion)); XPUSHs(newSVpvn(szCSDVersion, strlen(szCSDVersion))); osver.dwMajorVersion = osverw.dwMajorVersion; @@ -4638,6 +4641,9 @@ XS(w32_GetOSVersion) XSRETURN_EMPTY; } } + if (GIMME_V == G_SCALAR) { + XSRETURN_IV(osver.dwPlatformId); + } XPUSHs(newSVpvn(osver.szCSDVersion, strlen(osver.szCSDVersion))); } XPUSHs(newSViv(osver.dwMajorVersion)); |