1. New build system
All checks were successful
build-dsl-smoke / Build judge (push) Successful in 12s
build-dsl-smoke / debug / clang / linux (push) Successful in 6s
build-dsl-smoke / debug / gcc / linux (push) Successful in 8s
build-dsl-smoke / release / clang / linux (push) Successful in 8s
build-dsl-smoke / release / gcc / linux (push) Successful in 6s
build-dsl-smoke / sanitized / clang / linux (push) Successful in 8s
build-dsl-smoke / sanitized / gcc / linux (push) Successful in 7s
build-dsl-smoke / debug / clang / windows (push) Successful in 13s
build-dsl-smoke / debug-valgrind / gcc / linux (push) Successful in 14s
build-dsl-smoke / release / clang / windows (push) Successful in 16s
build-dsl-smoke / debug / msvc / windows (push) Successful in 18s
build-dsl-smoke / release / msvc / windows (push) Successful in 17s
build-dsl-smoke / SUMMARY (push) Successful in 4s
Release / Build & publish (push) Successful in 48s
All checks were successful
build-dsl-smoke / Build judge (push) Successful in 12s
build-dsl-smoke / debug / clang / linux (push) Successful in 6s
build-dsl-smoke / debug / gcc / linux (push) Successful in 8s
build-dsl-smoke / release / clang / linux (push) Successful in 8s
build-dsl-smoke / release / gcc / linux (push) Successful in 6s
build-dsl-smoke / sanitized / clang / linux (push) Successful in 8s
build-dsl-smoke / sanitized / gcc / linux (push) Successful in 7s
build-dsl-smoke / debug / clang / windows (push) Successful in 13s
build-dsl-smoke / debug-valgrind / gcc / linux (push) Successful in 14s
build-dsl-smoke / release / clang / windows (push) Successful in 16s
build-dsl-smoke / debug / msvc / windows (push) Successful in 18s
build-dsl-smoke / release / msvc / windows (push) Successful in 17s
build-dsl-smoke / SUMMARY (push) Successful in 4s
Release / Build & publish (push) Successful in 48s
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
59
example/showcase/06-files.jdg
Normal file
59
example/showcase/06-files.jdg
Normal file
@@ -0,0 +1,59 @@
|
||||
// Тесты, которые общаются через файлы, а не через stdin/stdout.
|
||||
// file("name") = "content" — файл кладётся в рабочую директорию теста
|
||||
// перед запуском программы.
|
||||
// outFile("name") = "content" — после запуска содержимое файла сравнивается
|
||||
// с ожидаемым (точное совпадение с учётом
|
||||
// normalize_crlf / trim_trailing_ws).
|
||||
|
||||
toolchains {
|
||||
gcc { platforms = "linux" }
|
||||
}
|
||||
|
||||
build "release" {
|
||||
language = "c"
|
||||
standard = "c11"
|
||||
sources = "solution.c"
|
||||
output = "solution"
|
||||
profile = release
|
||||
}
|
||||
|
||||
normalize_crlf = true
|
||||
trim_trailing_ws = true
|
||||
|
||||
group("io") {
|
||||
weight = 1.0
|
||||
|
||||
// Программа читает input.txt, пишет output.txt.
|
||||
test("copy") {
|
||||
args = "input.txt" "output.txt"
|
||||
file("input.txt") = "hello world\n"
|
||||
outFile("output.txt") = "hello world\n"
|
||||
}
|
||||
|
||||
// Несколько входных и выходных файлов сразу — удобно для задач
|
||||
// вроде «посчитать сумму по каждой строке и записать в отдельный
|
||||
// файл».
|
||||
test("multi-file") {
|
||||
args = "a.txt" "b.txt" "result.txt"
|
||||
file("a.txt") = "1 2 3\n"
|
||||
file("b.txt") = "10 20 30\n"
|
||||
outFile("result.txt") = "11 22 33\n"
|
||||
}
|
||||
|
||||
// Вложенные пути тоже работают — создаются автоматически.
|
||||
test("nested") {
|
||||
args = "data/in.txt" "data/out.txt"
|
||||
file("data/in.txt") = "payload\n"
|
||||
outFile("data/out.txt") = "PAYLOAD\n"
|
||||
}
|
||||
|
||||
// Можно комбинировать с stdin/stdout и переменными окружения.
|
||||
test("combined") {
|
||||
stdin = "42\n"
|
||||
args = "config.ini"
|
||||
env("MODE") = "strict"
|
||||
file("config.ini") = "threshold=10\n"
|
||||
stdout = "ok\n"
|
||||
outFile("log.txt") = "processed 42\n"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user