Skip to content

Commit

Permalink
chore(ops): Update README with #[smi] support (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Jul 25, 2023
1 parent 482ffcf commit bd4d478
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
28 changes: 28 additions & 0 deletions ops/op2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ Uint32, Int32, Number, BigInt
<tr>
<td>

```rust
#[smi] ResourceId
```

</td><td>
</td><td>
Uint32, Int32, Number, BigInt
</td><td>

</td></tr>
<tr>
<td>

```rust
#[bigint] i64
```
Expand Down Expand Up @@ -782,6 +796,20 @@ Uint32
<tr>
<td>

```rust
#[smi] ResourceId
```

</td><td>
</td><td>
Int32
</td><td>

</td></tr>
<tr>
<td>

```rust
#[bigint] i64
```
Expand Down
16 changes: 6 additions & 10 deletions ops/op2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ deno_ops_compile_test_runner::prelude!();";
let md = include_str!("valid_args.md");
let separator = "\n<!-- START ARGS -->\n";
let end_separator = "\n<!-- END ARGS -->\n";
let (header, remainder) =
split_readme(include_str!("README.md"), separator, end_separator);
let readme = std::fs::read_to_string("op2/README.md").unwrap();
let (header, remainder) = split_readme(&readme, separator, end_separator);

let mut actual = format!("{header}{separator}<table><tr><th>Rust</th><th>Fastcall</th><th>v8</th></tr>\n");

Expand Down Expand Up @@ -517,10 +517,8 @@ deno_ops_compile_test_runner::prelude!();";
std::fs::write("op2/README.md", actual)
.expect("Failed to write expectation file");
} else {
let expected = std::fs::read_to_string("op2/README.md")
.expect("Failed to read expectation file");
assert_eq!(
expected, actual,
readme, actual,
"Failed to match expectation. Use UPDATE_EXPECTED=1."
);
}
Expand All @@ -533,8 +531,8 @@ deno_ops_compile_test_runner::prelude!();";
let md = include_str!("valid_retvals.md");
let separator = "\n<!-- START RV -->\n";
let end_separator = "\n<!-- END RV -->\n";
let (header, remainder) =
split_readme(include_str!("README.md"), separator, end_separator);
let readme = std::fs::read_to_string("op2/README.md").unwrap();
let (header, remainder) = split_readme(&readme, separator, end_separator);
let mut actual = format!("{header}{separator}<table><tr><th>Rust</th><th>Fastcall</th><th>v8</th></tr>\n");

parse_md(md, |line, components| {
Expand Down Expand Up @@ -578,10 +576,8 @@ deno_ops_compile_test_runner::prelude!();";
std::fs::write("op2/README.md", actual)
.expect("Failed to write expectation file");
} else {
let expected = std::fs::read_to_string("op2/README.md")
.expect("Failed to read expectation file");
assert_eq!(
expected, actual,
readme, actual,
"Failed to match expectation. Use UPDATE_EXPECTED=1."
);
}
Expand Down
1 change: 1 addition & 0 deletions ops/op2/valid_args.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
| X | u16 | X | Uint32, Int32, Number, BigInt | |
| X | i32 | X | Uint32, Int32, Number, BigInt | |
| X | u32 | X | Uint32, Int32, Number, BigInt | |
| X | #[smi] ResourceId | X | Uint32, Int32, Number, BigInt | |
| X | #[bigint] i64 | X | Uint32, Int32, Number, BigInt | |
| X | #[bigint] u64 | X | Uint32, Int32, Number, BigInt | |
| X | #[bigint] isize | X | Uint32, Int32, Number, BigInt | |
Expand Down
1 change: 1 addition & 0 deletions ops/op2/valid_retvals.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
| X | u16 | X | Uint32 | |
| X | i32 | X | Int32 | |
| X | u32 | X | Uint32 | |
| X | #[smi] ResourceId | X | Int32 | |
| X | #[bigint] i64 | | BigInt | |
| X | #[bigint] u64 | | BigInt | |
| X | #[bigint] isize | | BigInt | |
Expand Down

0 comments on commit bd4d478

Please sign in to comment.