XU XUv0.16.0

#testing/fstest

import: #testing/fstest

counts: 2 functions, 5 methods, 2 types, 0 constants, 0 method sets

In-memory MapFS and a consistency check.

struct MapFile

XuAPI
pub struct MapFile {
    pub name string
    pub body string
    pub dir bool
}

Purpose

Structure encapsulating name, body, dir.

Public fields

name string
name
body string
body
dir bool
directory

struct MapFS

XuAPI
pub struct MapFS {
    pub files []MapFile
}

Purpose

Structure encapsulating files.

Public fields

files []MapFile
field ([]MapFile)

map_fs

XuAPI
pub fn map_fs() MapFS

Purpose

Construct an in-memory MapFS virtual test filesystem.

Parameters

No arguments are required.

Returns

MapFS — a value of this type

($&MapFS) add

XuAPI
pub fn (fs $&MapFS) add(name string, body string)

Purpose

Operation on $&MapFS: add.

Parameters

fs $&MapFS
The MapFS instance used by this call (exclusive borrow).
name string
name (string)
body string
body (string)

Returns

This call does not return a value.

($&MapFS) add_dir

XuAPI
pub fn (fs $&MapFS) add_dir(name string)

Purpose

Operation on $&MapFS: add directory.

Parameters

fs $&MapFS
The MapFS instance used by this call (exclusive borrow).
name string
name (string)

Returns

This call does not return a value.

(MapFS) read_file

XuAPI
pub fn (fs MapFS) read_file(name string) string

Purpose

Operation on MapFS: read file. Throws on failure; handle the error or propagate it to the caller.

Parameters

fs MapFS
The MapFS instance used by this call (value receiver).
name string
name (string)

Returns

string — result string

(MapFS) stat_dir

XuAPI
pub fn (fs MapFS) stat_dir(name string) bool

Purpose

Operation on MapFS: stat directory.

Parameters

fs MapFS
The MapFS instance used by this call (value receiver).
name string
name (string)

Returns

bool — true or false

(MapFS) has

XuAPI
pub fn (fs MapFS) has(name string) bool

Purpose

Execute has on MapFS.

Parameters

fs MapFS
The MapFS instance used by this call (value receiver).
name string
name (string)

Returns

bool — true or false

test

XuAPI
pub fn test(fs &MapFS) int

Purpose

Execute test. Throws on failure; handle the error or propagate it to the caller.

Parameters

fs &MapFS
fs (read-only borrow; caller keeps the original; type &MapFS)

Returns

int — a value of this type