From 353805e170a0b5fb9ede3294d201664323e8cf83 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 6 Dec 2019 11:09:35 +0200 Subject: [PATCH] os: test is_link() --- vlib/os/os_test.v | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/vlib/os/os_test.v b/vlib/os/os_test.v index b63bb9fc5d..674aefd888 100644 --- a/vlib/os/os_test.v +++ b/vlib/os/os_test.v @@ -170,6 +170,37 @@ fn test_tmpdir(){ os.rm(tfile) } + +fn test_make_symlink_check_is_link_and_remove_symlink() { + $if windows { + // TODO + assert true + return + } + + folder := 'tfolder' + symlink := 'tsymlink' + + os.rm(symlink) + os.rm(folder) + + os.mkdir(folder) or { panic(err) } + folder_contents := os.ls(folder) or { panic(err) } + assert folder_contents.len == 0 + + os.system('ln -s $folder $symlink') + assert os.is_link(symlink) == true + + os.rm(symlink) + os.rm(folder) + + folder_exists := os.is_dir(folder) + assert folder_exists == false + + symlink_exists := os.is_link(symlink) + assert symlink_exists == false +} + //fn test_fork() { // pid := os.fork() // if pid == 0 {