-
Notifications
You must be signed in to change notification settings - Fork 15
test: add tests for getters #3
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
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3a820ad
test: add tests for getters
anonrig 0d970bc
feat: add setter functions
anonrig 5d0b8a1
feat: add validation functions
anonrig 99bf04c
update ada to `main` branch
anonrig 6de4b4b
feat: reduce string allocations
anonrig 43c569f
doc: add documentatin for parse and can_parse
anonrig 0186583
build: use nightly for check
anonrig a8476d4
fix: windows build
Brooooooklyn fe2ca64
test: use criterion to run benchmark
Brooooooklyn 3443fb7
fix: remove ada_set_origin
anonrig 9b7076c
refactor: change the position of unsafe wrapper
anonrig 75238eb
fix: uncomment ada_get_origin
anonrig 66fdc43
docs: update readme
anonrig 80de245
fix: handle origin property
anonrig 4a46a42
build: stop installing nightly for check
anonrig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ada-url" | ||
authors = ["Yagiz Nizipli <[email protected]>", "Daniel Lemire <[email protected]>"] | ||
authors = ["Yagiz Nizipli <[email protected]>", "Daniel Lemire <[email protected]>", "LongYinan <[email protected]>"] | ||
version = "0.1.0" | ||
edition = "2021" | ||
description = "Fast WHATWG Compliant URL parser" | ||
|
@@ -9,8 +9,22 @@ repository = "https://github.com/ada-url/rust" | |
license = "MIT AND APACHE-2.0" | ||
exclude = [".github"] | ||
|
||
[[bench]] | ||
name = "parse" | ||
path = "bench/parse.rs" | ||
harness = false | ||
|
||
[features] | ||
# pass `cpp_set_stdlib("c++")` to `cc` | ||
libcpp = [] | ||
|
||
[dependencies] | ||
thiserror = "1" | ||
|
||
[dev-dependencies] | ||
criterion = "0.4" | ||
url = "2" # Used by benchmarks | ||
|
||
[build-dependencies] | ||
cc = { version = "1.0", features = ["parallel"] } | ||
link_args = "0.6" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
## Rust bindings for Ada | ||
|
||
Fast [WHATWG specification](https://url.spec.whatwg.org) compliant URL parser for Rust. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use ada_url::Url; | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
|
||
const URL: &[&str] = &[ | ||
"https://www.google.com/", | ||
"webhp?hl=en&ictx=2&sa=X&ved=0ahUKEwil_", | ||
"oSxzJj8AhVtEFkFHTHnCGQQPQgI", | ||
"https://support.google.com/websearch/", | ||
"?p=ws_results_help&hl=en-CA&fg=1", | ||
"https://en.wikipedia.org/wiki/Dog#Roles_with_humans", | ||
"https://www.tiktok.com/@aguyandagolden/video/7133277734310038830", | ||
"https://business.twitter.com/en/help/troubleshooting/", | ||
"how-twitter-ads-work.html?ref=web-twc-ao-gbl-adsinfo&utm_source=twc&utm_", | ||
"medium=web&utm_campaign=ao&utm_content=adsinfo", | ||
"https://images-na.ssl-images-amazon.com/images/I/", | ||
"41Gc3C8UysL.css?AUIClients/AmazonGatewayAuiAssets", | ||
"https://www.reddit.com/?after=t3_zvz1ze", | ||
"https://www.reddit.com/login/?dest=https%3A%2F%2Fwww.reddit.com%2F", | ||
"postgresql://other:9818274x1!!@localhost:5432/", | ||
"otherdb?connect_timeout=10&application_name=myapp", | ||
"http://192.168.1.1", // ipv4 | ||
"http://[2606:4700:4700::1111]", // ipv6 | ||
]; | ||
|
||
fn bench_url_parse(b: &mut Criterion) { | ||
b.benchmark_group("url_parse") | ||
.bench_function("ada_parse", |b| { | ||
b.iter(|| { | ||
URL.iter().for_each(|url| { | ||
let _ = Url::parse(black_box(url), None); | ||
}); | ||
}) | ||
}) | ||
.bench_function("servo_parse", |b| { | ||
b.iter(|| { | ||
URL.iter().for_each(|url| { | ||
let _ = url::Url::parse(black_box(url)); | ||
}); | ||
}) | ||
}); | ||
} | ||
|
||
criterion_group!(benches, bench_url_parse); | ||
criterion_main!(benches); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@Brooooooklyn @Boshen can you add your names to
authors
attribute inCargo.toml
?