All Projects → stoeffel → Elm Verify Examples

stoeffel / Elm Verify Examples

Licence: bsd-3-clause

Programming Languages

elm
856 projects

Labels

Projects that are alternatives of or similar to Elm Verify Examples

Keys
Key management is hard
Stars: ✭ 733 (+398.64%)
Mutual labels:  verify
Verify
Stars: ✭ 70 (-52.38%)
Mutual labels:  verify
Qa Checks V4
PowerShell scripts to ensure consistent and reliable build quality and configuration for your servers
Stars: ✭ 94 (-36.05%)
Mutual labels:  verify
Rverify.js
✅❎ A lightweight image rotation verification plugin.
Stars: ✭ 33 (-77.55%)
Mutual labels:  verify
Simplenikeaccountcreator
A simple nike account creator I made using puppeteer and request in node js
Stars: ✭ 47 (-68.03%)
Mutual labels:  verify
Vonage Dotnet Sdk
Nexmo REST API client for .NET, ASP.NET, ASP.NET MVC written in C#. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Stars: ✭ 76 (-48.3%)
Mutual labels:  verify
Uber Apk Signer
A cli tool that helps signing and zip aligning single or multiple Android application packages (APKs) with either debug or provided release certificates. It supports v1, v2 and v3 Android signing scheme has an embedded debug keystore and auto verifies after signing.
Stars: ✭ 677 (+360.54%)
Mutual labels:  verify
Hibp
A composer package to verify if a password was previously used in a breach using Have I Been Pwned API.
Stars: ✭ 126 (-14.29%)
Mutual labels:  verify
Idtoken Verifier
Lightweight RSA JWT verification
Stars: ✭ 52 (-64.63%)
Mutual labels:  verify
Directorylister
📂 Directory Lister is the easiest way to expose the contents of any web-accessible folder for browsing and sharing.
Stars: ✭ 1,261 (+757.82%)
Mutual labels:  verify
Nexmo Node Code Snippets
NodeJS code examples for using Nexmo
Stars: ✭ 36 (-75.51%)
Mutual labels:  verify
Jose
Universal "JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK with no dependencies
Stars: ✭ 1,029 (+600%)
Mutual labels:  verify
Vonage Java Sdk
Vonage Server SDK for Java. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Stars: ✭ 75 (-48.98%)
Mutual labels:  verify
Vue express session nodb
这是一个带有express session验证的vue项目,其中server适用于其他任何前端框架,开发者可以根据自己的需求进行更改;另外session存储不涉及数据库存储,使用的是内存存储。
Stars: ✭ 24 (-83.67%)
Mutual labels:  verify
Piracychecker
An Android library that prevents your app from being pirated / cracked using Google Play Licensing (LVL), APK signature protection and more. API 14+ required.
Stars: ✭ 1,359 (+824.49%)
Mutual labels:  verify
Awesome bot
✅ Validate links in awesome projects
Stars: ✭ 697 (+374.15%)
Mutual labels:  verify
Server Qa Checks
A bunch of QA checks to run against one or more servers to make sure they are built to a specific standard.
Stars: ✭ 72 (-51.02%)
Mutual labels:  verify
Paseto
PASETO (Platform-Agnostic SEcurity TOkens) for Node.js with no dependencies
Stars: ✭ 134 (-8.84%)
Mutual labels:  verify
Signify
OpenBSD tool to signs and verify signatures on files. Portable version.
Stars: ✭ 122 (-17.01%)
Mutual labels:  verify
Is Google
Verify that a request is from Google crawlers using Google's DNS verification steps
Stars: ✭ 82 (-44.22%)
Mutual labels:  verify

elm-verify-examples Build Status

Verify examples in your docs.

ℹ️ This was formerly known as elm-doc-test.

⚠️ This is not a replacement for tests, this tool should be used for improving your documentation.

Install

$ npm i elm-test -g
$ npm i elm-verify-examples -g
$ elm-test init

Setup

$ touch tests/elm-verify-examples.json

elm-verify-examples.json contains information on which files contain verified examples and where to find them.

{
  "root": "../src",
  "tests": ["Mock", "Mock.Foo.Bar.Moo", "./README.md"]
}

It's recommended to add ./tests/VerifyExamples to your .gitignore.

Writing Verified Examples

Verified examples look like normal code examples in doc-comments.
Code needs to be indented by 4 spaces. You can specify the expected result of an expression, by adding a comment --> (the > is important) and an expected expression.

{-| returns the sum of two int.

    -- You can write the expected result on the next line,

    add 41 1
    --> 42

    -- or on the same line.

    add 3 3 --> 6

-}


add : Int -> Int -> Int
add =
    (+)

Multiline Examples

You can write examples on multiple lines.

{-| reverses the list

    rev
        [ 41
        , 1
        ]
    --> [ 1
    --> , 41
    --> ]

    rev [1, 2, 3]
        |> List.map toString
        |> String.concat
    --> "321"

-}


rev : List a -> List a
rev =
    List.reverse

Imports

You can specify imports, if you want to use a module or a special test util.

{-|

    import Dict

    myWeirdFunc (Dict.fromList [(1, "a"), (2, "b")]) [2, 1]
    --> "ba"

-}

Intermediate Definitions

You can use intermediate definitions in your example. :information: Unused functions don't get added to the test. This is useful if you wanna add incomplete examples to your docs. ⚠️ Intermediate definitions need a type signature!

{-|

    isEven : Int -> Bool
    isEven n =
        remainderBy 2 n == 0

    List.Extra.filterNot isEven [1,2,3,4] --> [1,3]

-}


filterNot : (a -> Bool) -> List a -> List a

Types in Examples

You can define union types and type aliases in your examples.

{-| With a union type in the example.
type Animal
= Dog
| Cat

    double Dog
    --> (Dog, Dog)

-}


double : a -> ( a, a )
double a =
    ( a, a )
{-| With a type alias in the example.

    customTypeAlias defaultUser "?"
    --> "?Luke"

    type alias User =
        { id: Int -- ID
        , name: String
        }

    defaultUser : User
    defaultUser =
        { id = 1
        , name = "Luke"
        }

    customTypeAlias defaultUser "_"
    --> "_Luke"

-}


customTypeAlias : { a | name : String } -> String -> String
customTypeAlias { name } prefix =
    prefix ++ name

Examples in markdown files

You can also verify code example in markdown files (such as your README). To do so, add the file's path to your elm-verify-examples.json file and write your example using the sames rules as above (no need for 4-space indentation here).

This is my README!
It explains how the `Documented` module works:

```elm
import Documented

Documented.two --> 2
```

Verify Examples

elm-verify-examples converts your verify-examples into elm-tests, and optionally runs them using elm-test. To only generate the test files in tests/VerifyExamples/:

$ elm-verify-examples

This is useful if you want to run your tests using different runner than elm-test, e.g. elm-coverage. If you also want to run the generated tests:

$ elm-verify-examples --run-tests

Note that this way the test files will be removed after they are ran.

By default, this command looks for the config file at tests/elm-verify-examples.json. If you want it to load a specific config file use the --config argument (e.g. elm-verify-examples --config my/custom/path/elm-verify-examples.json will read the config from my/custom/path/elm-verify-examples.json).

You can run elm-verify-examples for one or more modules explicitly. They don't have to be specified in tests/elm-verify-examples.json.

$ elm-verify-examples ./src/Foo.elm ./src/Foo/Bar.elm

You can pass a custom path to elm-test if necessary.

$ elm-verify-examples --elm-test=./node_modules/.bin/elm-test
$ # or add it to your elm-verify-examples.json `elmTest: "../node....`
$ # you can also pass arguments to elm-test with --elm-test-args

It will use the elm-test installed with this package.

Examples

You can run the examples using:

npm start

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].