-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add examples to some modules #213
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
docs/src/examples/format/example.md
Outdated
|
||
### Formatting decimals | ||
|
||
This example shows how to use the `{uint:dx}` placeholder to format numbers with decimals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should mention something about shorthand variations (u:d18)
function test() external { | ||
RequestClient memory client = request.create(); | ||
|
||
Response memory jsonRes = client.post("https://httpbin.org/post").json("{ \"foo\": \"bar\" }").send().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Response memory jsonRes = client.post("https://httpbin.org/post").json("{ \"foo\": \"bar\" }").send().unwrap(); | |
Response memory jsonRes = client.post("https://httpbin.org/post").json('{ "foo": "bar" }').send().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cannot be done. The contract parser fails when using single quotes for strings
docs/src/examples/expect/example.md
Outdated
## Examples | ||
### Use different matchers | ||
|
||
This example shows how to use the `expect` function and its different matchers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the "This example shows blah blah" From ALL examples, feels repetitive and doesn't really add information.
This one, for example could become:
Use the expect
function and its different matchers to assert conditions.
|
||
import {Test, expect, request, Response} from "vulcan/test.sol"; | ||
|
||
contract RequestExample01 is Test { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the suffix number from the example, doesn't seem necessary
|
||
contract ExpectExample01 is Test { | ||
function test() external { | ||
expect(string("foo")).toEqual(string("foo")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it is better to store the variable, otherwise users might think that you always need to cast it.
expect(string("foo")).toEqual(string("foo")); | |
string memory foo = "foo"; | |
expect(foo).toEqual("foo"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I think the casting is not necessary in the matcher, as matchers are different for each expect(...)
* chore!: update forge-std to v1.7.1 This is a breaking change because v.1.7.0 introduced a breaking change. Details here foundry-rs/forge-std#458 * chore: remove ad-hoc SerializeJson interface * chore: update functions mutability
No description provided.