this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Basic test running

Louis Pilfold 3b49f737

+140
+23
.github/workflows/test.yml
··· 1 + # name: test 2 + 3 + # on: 4 + # push: 5 + # branches: 6 + # - master 7 + # - main 8 + # pull_request: 9 + 10 + # jobs: 11 + # test: 12 + # runs-on: ubuntu-latest 13 + # steps: 14 + # - uses: actions/checkout@v2.0.0 15 + # - uses: gleam-lang/setup-erlang@v1.1.2 16 + # with: 17 + # otp-version: 23.2 18 + # - uses: gleam-lang/setup-gleam@v1.0.2 19 + # with: 20 + # gleam-version: 0.18.0 21 + # - run: gleam format --check src test 22 + # - run: gleam deps download 23 + # - run: gleam test
+3
.gitignore
··· 1 + *.beam 2 + *.ez 3 + build
+21
README.md
··· 1 + # gleeunit 2 + 3 + A Gleam project 4 + 5 + ## Quick start 6 + 7 + ```sh 8 + gleam run # Run the project 9 + gleam test # Run the tests 10 + gleam shell # Run an Erlang shell 11 + ``` 12 + 13 + ## Installation 14 + 15 + If available on Hex this package can be installed by adding `gleeunit` 16 + to your `gleam.toml` dependencies: 17 + 18 + ```erlang 19 + [dependencies] 20 + gleeunit = "~> 0.1.0" 21 + ```
+8
gleam.toml
··· 1 + name = "gleeunit" 2 + version = "0.1.0" 3 + 4 + [dependencies] 5 + gleam_stdlib = "~> 0.17.1" 6 + 7 + [dev-dependencies] 8 + # some_test_package = "~> 1.0.0"
+9
manifest.toml
··· 1 + # This file was generated by Gleam 2 + # You typically do not need to edit this file 3 + 4 + [requirements] 5 + gleam_stdlib = "~> 0.17.1" 6 + 7 + [packages] 8 + gleam_stdlib = "0.17.1" 9 + gleeunit = "0.1.0"
+33
src/gleeunit.gleam
··· 1 + import gleam/list 2 + import gleam/string 3 + import gleam/dynamic.{Dynamic} 4 + 5 + pub fn discover_and_run_tests() { 6 + find_files(matching: "**/*.{erl,gleam}", in: "test") 7 + |> list.map(remove_extension) 8 + |> list.map(dangerously_convert_string_to_atom) 9 + |> run_eunit([Verbose]) 10 + } 11 + 12 + fn remove_extension(path: String) -> String { 13 + path 14 + |> string.replace(".gleam", "") 15 + |> string.replace(".erl", "") 16 + |> string.replace("/", "@") 17 + } 18 + 19 + external fn find_files(matching: String, in: String) -> List(String) = 20 + "gleeunit_ffi" "find_files" 21 + 22 + external type Atom 23 + 24 + external fn dangerously_convert_string_to_atom(String) -> Atom = 25 + "erlang" "binary_to_atom" 26 + 27 + type EunitOption { 28 + Verbose 29 + } 30 + 31 + // NoTty 32 + external fn run_eunit(List(Atom), List(EunitOption)) -> Dynamic = 33 + "eunit" "test"
+7
src/gleeunit_ffi.erl
··· 1 + -module(gleeunit_ffi). 2 + 3 + -export([find_files/2]). 4 + 5 + find_files(Pattern, In) -> 6 + Results = filelib:wildcard(binary_to_list(Pattern), binary_to_list(In)), 7 + lists:map(fun list_to_binary/1, Results).
+7
test/another_test_module.gleam
··· 1 + pub fn example_div_test() { 2 + assert 1 = 2 / 2 3 + } 4 + 5 + pub fn example_mult_test() { 6 + assert 4 = 2 * 2 7 + }
+9
test/erlang_test_module.erl
··· 1 + -module(erlang_test_module). 2 + 3 + -export([one_test/0, two_test/0]). 4 + 5 + one_test() -> 6 + 1 = 1. 7 + 8 + two_test() -> 9 + 2 = 2.
+13
test/gleeunit_test.gleam
··· 1 + import gleeunit 2 + 3 + pub fn main() { 4 + gleeunit.discover_and_run_tests() 5 + } 6 + 7 + pub fn some_test() { 8 + assert 2 = 1 + 1 9 + } 10 + 11 + pub fn some_other_test() { 12 + assert 1 = 1 - 0 13 + }
+7
test/nesting/nested.gleam
··· 1 + pub fn nested_1_test() { 2 + assert 1 = 1 3 + } 4 + 5 + pub fn nested_2_test() { 6 + assert 3 = 2 + 1 7 + }