dshell_prebuilt

A small library to help write D shell-like test scripts.

Public Imports

core.stdc.stdlib
public import core.stdc.stdlib : exit;
core.time
public import core.time;
core.thread
public import core.thread;
std.meta
public import std.meta;
std.exception
public import std.exception;
std.array
public import std.array;
std.string
public import std.string;
std.format
public import std.format;
std.path
public import std.path;
std.file
public import std.file;
std.regex
public import std.regex;
std.stdio
public import std.stdio;
std.process
public import std.process;

Members

Functions

dshellPrebuiltInit
void dshellPrebuiltInit(string testDir, string testName)

called from the dshell module to initialize environment

filterCompilerOutput
string filterCompilerOutput(string output)

remove \r and the compiler debug header from the given string.

grep
GrepResult grep(string file, string pattern)
GrepResult grep(GrepResult lastResult, string pattern)

grep the given file for the given pattern.

mkdirFor
void mkdirFor(string filename)

Make all parent directories needed to create the given filename

parseCommand
string[] parseCommand(string s)

Parse the given string s as a command. Performs BASH-like variable expansion.

rm
void rm(scope const(char[])[] args...)

Remove one or more files

run
void run(scope const(char[])[] args, File stdout = std.stdio.stdout, File stderr = std.stdio.stderr, string[string] env = null)
void run(string cmd, File stdout = std.stdio.stdout, File stderr = std.stdio.stderr, string[string] env = null)

Run the given command. The tryRun variants return the exit code, whereas the run variants will assert on a non-zero exit code.

shellExpand
string shellExpand(const(char)[] s)

Expand the given string using BASH-like variable expansion.

tryRun
auto tryRun(scope const(char[])[] args, File stdout = std.stdio.stdout, File stderr = std.stdio.stderr, string[string] env = null)

Run the given command. The tryRun variants return the exit code, whereas the run variants will assert on a non-zero exit code.

Manifest constants

DISABLED
enum DISABLED;

Exit code to return if the test is disabled for the current platform

Structs

Vars
struct Vars

Emulates bash environment variables. Variables set here will be availble for BASH-like expansion.

Meta