Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Dockerfile.code
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ MAINTAINER Peter Bui <[email protected]>

ENV DEBIAN_FRONTEND noninteractive

# Repository configuration for Zig
RUN echo 'deb https://dl.bintray.com/dryzig/zig-ubuntu bionic main' | sudo tee -a /etc/apt/sources.list

RUN apt update -y

# Run-time dependencies
RUN apt install -y python3-tornado python3-requests python3-yaml curl

# Language Support: C, C++, Python3, Bash, Ruby, Nodejs, Java, golang, Guile, Perl6, Haskell
RUN apt install -y gcc g++ python3 bash ruby nodejs default-jdk-headless golang guile-2.0 perl6 ghc
# Language Support: C, C++, Python3, Bash, Ruby, Nodejs, Java, golang, Guile, Perl6, Haskell, Zig
RUN apt install -y gcc g++ python3 bash ruby nodejs default-jdk-headless golang guile-2.0 perl6 ghc zig

# Language Support: rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y && mv /root/.cargo/bin/* /usr/local/bin/
Expand Down
5 changes: 5 additions & 0 deletions scripts/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ def usage(exit_code=0):
'./{executable}',
('.rs',)
),
Language('Zig',
'',
'zig run {source}',
('.zig',)
),
)

def get_language_from_source(source, language_name=None):
Expand Down
34 changes: 34 additions & 0 deletions tests/test_code_echo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,40 @@ echo -n "Testing Haskell ... "
curl -F source=@$SOURCE localhost:9206/code/test-echo
rm -f $SOURCE

# Zig
SOURCE=$(mktemp -t dredd_XXXXXXX.zig)
cat > $SOURCE <<EOF
const std = @import("std");
const io = std.io;
const warn = std.debug.warn;

pub fn main() !void {
const stdout = io.getStdOut().outStream();
const stdin = io.getStdIn();

var line_buf: [1024 * 4]u8 = undefined;


while(true) {
const bytes_read = stdin.read(line_buf[0..]) catch |err| {
warn("Unable to read from stream: {}\n", .{@errorName(err)});
return err;
};

if (bytes_read == 0) {
break;
}

stdout.writeAll(line_buf[0..bytes_read]) catch |err| {
warn("Unable to write to stdout: {}\n", .{@errorName(err)});
return err;
};
}
}
EOF
echo
echo -n "Testing Zig ... "
curl -F source=@$SOURCE localhost:9206/code/test-echo

# # Brainfuck
#
Expand Down