mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
wsl2: wsl no longer differs in output
refactor `is_wsl` to `is_wsl_1` and `is_wsl_2` On my tests with wsl2 ubuntu2004 all tests pass without special cases I moved wsl detection into uucore so that it can be shared instead of duplicated I moved `parse_mode` into uucode as it seemed to fit there better and anyway requires libc feature
This commit is contained in:
parent
cc4f32d87a
commit
b1fcb621a8
11 changed files with 84 additions and 84 deletions
|
@ -1,4 +1,5 @@
|
|||
use crate::common::util::*;
|
||||
use uucore;
|
||||
|
||||
const SUB_DIR: &str = "subdir/deeper";
|
||||
const SUB_DIR_LINKS: &str = "subdir/links";
|
||||
|
@ -52,7 +53,7 @@ fn _du_basics_subdir(s: String) {
|
|||
#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))]
|
||||
fn _du_basics_subdir(s: String) {
|
||||
// MS-WSL linux has altered expected output
|
||||
if !is_wsl() {
|
||||
if !uucore::os::is_wsl_1() {
|
||||
assert_eq!(s, "8\tsubdir/deeper\n");
|
||||
} else {
|
||||
assert_eq!(s, "0\tsubdir/deeper\n");
|
||||
|
@ -96,7 +97,7 @@ fn _du_soft_link(s: String) {
|
|||
#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))]
|
||||
fn _du_soft_link(s: String) {
|
||||
// MS-WSL linux has altered expected output
|
||||
if !is_wsl() {
|
||||
if !uucore::os::is_wsl_1() {
|
||||
assert_eq!(s, "16\tsubdir/links\n");
|
||||
} else {
|
||||
assert_eq!(s, "8\tsubdir/links\n");
|
||||
|
@ -128,7 +129,7 @@ fn _du_hard_link(s: String) {
|
|||
#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))]
|
||||
fn _du_hard_link(s: String) {
|
||||
// MS-WSL linux has altered expected output
|
||||
if !is_wsl() {
|
||||
if !uucore::os::is_wsl_1() {
|
||||
assert_eq!(s, "16\tsubdir/links\n");
|
||||
} else {
|
||||
assert_eq!(s, "8\tsubdir/links\n");
|
||||
|
@ -156,7 +157,7 @@ fn _du_d_flag(s: String) {
|
|||
#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))]
|
||||
fn _du_d_flag(s: String) {
|
||||
// MS-WSL linux has altered expected output
|
||||
if !is_wsl() {
|
||||
if !uucore::os::is_wsl_1() {
|
||||
assert_eq!(s, "28\t./subdir\n36\t./\n");
|
||||
} else {
|
||||
assert_eq!(s, "8\t./subdir\n8\t./\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue