Skip to content

Commit 83d5d72

Browse files
committed
Add support for OCaml
1 parent 3dfd45c commit 83d5d72

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

Dockerfile.code

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ RUN apt update -y
88
# Run-time dependencies
99
RUN apt install -y python3-tornado python3-requests python3-yaml curl ca-certificates gnupg
1010

11-
# Language Support: C, C++, Python3, Bash, Ruby, Java, golang, Guile, Haskell, Common Lisp, C#
12-
RUN apt install -y gcc g++ python3 bash ruby default-jdk-headless golang guile-2.2 ghc sbcl mono-complete
11+
# Language Support: C, C++, Python3, Bash, Ruby, Java, golang, Guile, Haskell, Common Lisp, C#, OCaml
12+
RUN apt install -y gcc g++ python3 bash ruby default-jdk-headless golang guile-2.2 ghc sbcl mono-complete ocaml
1313

1414
# Language Support: rust
1515
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y && mv /root/.cargo/bin/* /usr/local/bin/

dredd/handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ def get(self, path):
4848
- Golang 1.18
4949
- Bash 5.1
5050
- Guile 2.2
51-
- Rust 1.69
51+
- Rust 1.72
5252
- GHC 8.8.4
5353
- SBCL 2.1.11
5454
- Mono 6.8.0.105
5555
- Swift 5.8
56+
- OCaml 4.13.1
5657
''')
5758

5859
# Code Handler ----------------------------------------------------------------

scripts/run.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ def usage(exit_code=0):
122122
'./{executable}',
123123
('.swift',)
124124
),
125+
Language('OCaml',
126+
'ocamlc -o {executable} {source}',
127+
'./{executable}',
128+
('.ml',)
129+
),
125130
)
126131

127132
def get_language_from_source(source, language_name=None):

scripts/sandbox.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ IMAGE=pbui/dredd-code:20211126
2020
IMAGE=pbui/dredd-code:20220812
2121
IMAGE=pbui/dredd-code:20220910
2222
IMAGE=pbui/dredd-code:20230522
23+
IMAGE=pbui/dredd-code:20230827
2324

2425
if [ ! -d "$SANDBOX_PATH" ]; then
2526
mkdir -p "$SANDBOX_PATH"

tests/test_code_echo.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,25 @@ echo -n "Testing Swift ... "
261261
curl -F source=@$SOURCE localhost:9206/code/test-echo
262262
rm -f $SOURCE
263263

264+
# OCaml
265+
SOURCE=$(mktemp -t dredd_XXXXXXX.ml)
266+
cat > $SOURCE <<EOF
267+
let rec read_lines () =
268+
try
269+
let line = input_line stdin in
270+
print_endline line;
271+
read_lines ()
272+
with
273+
| End_of_file -> ()
274+
275+
let () =
276+
read_lines ()
277+
EOF
278+
echo
279+
echo -n "Testing OCaml ... "
280+
curl -F source=@$SOURCE localhost:9206/code/test-echo
281+
rm -f $SOURCE
282+
264283
# # Brainfuck
265284
#
266285
# SOURCE=$(mktemp -t dredd_XXXXXXX.bf)

0 commit comments

Comments
 (0)