Skip to content

Commit

Permalink
Merge pull request #42 from dlang/test-with-depracations
Browse files Browse the repository at this point in the history
Various improvements
  • Loading branch information
PetarKirov authored Dec 16, 2020
2 parents 56cddfc + f15525a commit d06aaa5
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 23 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Cross platform GitHub Actions CI for undeaD

name: Testsuite

# Only triggers on pushes to master & stable, as well as PR to master and stable
# Sometimes reverts appear in the upstream repository (e.g. when the revert button
# is clicked by a contributor with commit access), this should be tested as PR).
#
# Also note that Github actions does not retrigger on target branch changes,
# hence the check on push.
on:
pull_request:
branches:
- master
- stable
push:
branches:
- master
- stable
# Use this branch name in your fork to test changes
- github-actions

jobs:
main:
name: Run
strategy:
# Default, disable if you want to debug
fail-fast: false
matrix:
# Latest stable version, update at will
os: [ macOS-10.15, ubuntu-20.04, windows-2019 ]
dc: [ dmd-latest, ldc-latest, dmd-master, ldc-master ]

runs-on: ${{ matrix.os }}
steps:

- name: Install D compiler - ${{ matrix.dc }}
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}

- name: Checkout
uses: actions/checkout@v2

- name: 'Build and Test'
shell: bash
run: |
$DC --version
dub build --compiler=$DC
dub test --compiler=$DC -v
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

9 changes: 0 additions & 9 deletions dub.json

This file was deleted.

10 changes: 10 additions & 0 deletions dub.sdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name "undead"
description "Obsolete Phobos modules, back from the dead"
homepage "https://github.com/dlang/undeaD"
authors "various"
license "BSL-1.0"
targetType "library"
targetPath "bin"
buildType "unittest" {
buildOptions "debugMode" "debugInfo" "unittests" "deprecationErrors" "warningsAsErrors"
}
7 changes: 7 additions & 0 deletions examples/hello-from-the-dead/dub.sdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name "hello-from-the-dead"
description "A test program that uses undeaD"
authors "Petar Kirov"
copyright "Copyright © 2020, Petar Kirov"
license "BSL-1.0"
dependency "undead" version="*" path="../.."
targetPath "bin"
25 changes: 25 additions & 0 deletions examples/hello-from-the-dead/source/app.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
static import std.string;

void main()
{
import undead.regexp : RegExp, sub;
import std.stdio : writeln;

string foo(RegExp r) { return "ss"; }

auto r = sub("hello", "ll", delegate string(RegExp r) { return "ss"; });
assert(r == "hesso");

r = sub("hello", "l", delegate string(RegExp r) { return "l"; }, "g");
assert(r == "hello");

auto s = sub("Strap a rocket engine on a chicken.",
"[ar]",
delegate string (RegExp m)
{
return std.string.toUpper(m[0]);
},
"g");
assert(s == "StRAp A Rocket engine on A chicken.");
s.writeln;
}

0 comments on commit d06aaa5

Please sign in to comment.