forked from riehlegroup/adap-names
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'riehlegroup:main' into main
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { describe, it, expect } from "vitest"; | ||
|
||
import { StringName } from "../../../src/adap-b05/names/StringName"; | ||
|
||
import { Node } from "../../../src/adap-b05/files/Node"; | ||
import { File } from "../../../src/adap-b05/files/File"; | ||
import { BuggyFile } from "../../../src/adap-b05/files/BuggyFile"; | ||
import { Directory } from "../../../src/adap-b05/files/Directory"; | ||
import { RootNode } from "../../../src/adap-b05/files/RootNode"; | ||
|
||
function createFileSystem(): RootNode { | ||
let rn: RootNode = new RootNode(); | ||
|
||
let usr: Directory = new Directory("usr", rn); | ||
let bin: Directory = new Directory("bin", usr); | ||
let ls: File = new File("ls", bin); | ||
let code: File = new File("code", bin); | ||
|
||
let media: Directory = new Directory("media", rn); | ||
|
||
let home: Directory = new Directory("home", rn); | ||
let riehle: Directory = new Directory("riehle", home); | ||
let bashrc: File = new File(".bashrc", riehle); | ||
let wallpaper: File = new File("wallpaper.jpg", riehle); | ||
let projects: Directory = new Directory("projects", riehle); | ||
|
||
return rn; | ||
} | ||
|
||
describe("Basic naming test", () => { | ||
it("test name checking", () => { | ||
// let fs: RootNode = createFileSystem(); | ||
// let ls: Node = [...fs.findNodes("ls")][0]; | ||
// expect(ls.getFullName().isEqual(new StringName("/usr/bin/ls", '/'))); | ||
}); | ||
}); | ||
|
||
function createBuggySetup(): RootNode { | ||
let rn: RootNode = new RootNode(); | ||
|
||
let usr: Directory = new Directory("usr", rn); | ||
let bin: Directory = new Directory("bin", usr); | ||
let ls: File = new BuggyFile("ls", bin); | ||
let code: File = new BuggyFile("code", bin); | ||
|
||
let media: Directory = new Directory("media", rn); | ||
|
||
let home: Directory = new Directory("home", rn); | ||
let riehle: Directory = new Directory("riehle", home); | ||
let bashrc: File = new BuggyFile(".bashrc", riehle); | ||
let wallpaper: File = new BuggyFile("wallpaper.jpg", riehle); | ||
let projects: Directory = new Directory("projects", riehle); | ||
|
||
return rn; | ||
} | ||
|
||
describe("Buggy setup test", () => { | ||
it("test finding files", () => { | ||
// let threwException: boolean = false; | ||
// try { | ||
// let fs: RootNode = createBuggySetup(); | ||
// fs.findNodes("ls"); | ||
// } catch(er) { | ||
// threwException = true; | ||
// let ex: Exception = er as Exception; | ||
// expect(ex instanceof ServiceFailureException); | ||
// expect(ex.hasTrigger()); | ||
// let tx: Exception = ex.getTrigger(); | ||
// expect(tx instanceof InvalidStateException); | ||
// } | ||
// expect(threwException); | ||
}); | ||
}); |