Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS.FileSys.readDir conformance #18

Open
ratmice opened this issue Apr 8, 2018 · 0 comments
Open

OS.FileSys.readDir conformance #18

ratmice opened this issue Apr 8, 2018 · 0 comments

Comments

@ratmice
Copy link

ratmice commented Apr 8, 2018

Noticed a minor issue in the implementation of OS.FileSys.readDir,
According to sml-family

readDir filters out the names corresponding to the current and parent arcs.

I had not quite figured out how to generate the whole .ans file, etc

(* Result: FAIL *)
(* Test OS.FileSys.readDir, should return false. *)
fun hasParentOrCurrentArc() =
  let val cwd = OS.FileSys.openDir(OS.Path.currentArc)
      fun hasParentOrCurrentArc(d, flag) =
          let val entry = OS.FileSys.readDir(d)
              fun check(entry) = 
                String.compare(entry, OS.Path.parentArc) = General.EQUAL
                orelse String.compare(entry, OS.Path.currentArc) = General.EQUAL
              fun ent (SOME entry, false) = hasParentOrCurrentArc(d, check(entry))
                | ent (SOME entry, true) = true
                | ent (NONE, flag) = flag 
           in ent (entry, flag)
          end
   in hasParentOrCurrentArc(cwd, false)
  end
val a = hasParentOrCurrentArc();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant