blob: 74a74fe484c36727e8ed98db1d180385ef32b7e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/usr/bin/env sloth
## Making sure all your imports are correct and lint rules are being followed is
## important. You can do this in sloth using the `--check` flag.
##
## Examples:
## sloth --check file.sloth
## Testing is important when trying to write resiliant, bug free software. Sloth
## comes with a full featured testing framework built in. In order to test your
## projects you can use the `--test` flag.
##
## Examples:
## sloth --test file.sloth
## Benchmarking is important to make sure our software is fast. Sloth comes with
## a full featured micro-benchmarking framework built in. In order to benchmark
## your project you can use the `--bench` flag.
##
## With our benchmarking framework you will get 3 responses:
## - cold :: execution time before any code was JIT compiled
## - warm :: execution time after some code was JIT compiled
## - hot :: execution time after all code that can be JIT compiled is JIT
## compiled
##
## Examples:
## sloth --bench file.sloth
## Maintaining the same code style accross an entire project is important while
## collaborating with others. In order to help with maintining these code styles
## sloth has a built in formatter that can be ran with the `--format` flag.
##
## In addition you can use `--format-mode check` in order to only check if the
## styles are valid, this is useful for CI pipelines.
##
## Examples:
## slock --format file.sloth
## slock --format --format-mode check file.sloth
## Dealing with dependencies can be a bit of a pain, in order to make it a bit
## easier you can automatically update all dependencies in a project using the
## `--update` flag. This will scan through your project looking for looking for
## any `use extern` statements with an outdated version specified and update them.
##
## Examples:
## slock --update file.sloth
## In order to push to canopy (the package repository) your dependencies must
## be locked to a specific version. In order to do this easily you can use the
## `--lock` flag. This will scan through your project looking for any `use extern`
## statements without a version specified and automatically specify the latest
## version.
##
## Examples:
## sloth --lock file.sloth
## Publishing sloth packages to canopy can be done in 3 days, from the site by
## uploading a zip, from the site from a git repo or using the CLI. It can be
## done through the CLI using the `--publish` flag.
##
## Examples:
## sloth --publish file.sloth
## If you wish to ahead of time compile your sloth code you can do so with the
## `--aot` flag. By default this will ahead of time compile to your platform
## however you can optionally specify one using the `--aot-target` flag.
##
## Limitations:
## - AOT compilation requires strict mode
##
## Examples:
## sloth --aot file.sloth
## sloth --aot --aot-target wasm file.sloth
# Easily write tests with the test and assert keywords
test "add function" {
assert add(5, 5) == 10;
assert add(10, 5) == 15;
assert add(10, 5) != 10;
}
# Easily write benchmarks with the bench & prepare keyword
bench "add function" {
# Use the `prepare` keyword to exclude code from the benchmark
prepare client = WebClient::new();
client.get("https://example.com");
}
|