Skip to content
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 by Bors] - Fix doc tests and add CI check #2606

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jobs:
uses: taiki-e/install-action@nextest
- name: Test with nextest
run: cargo nextest run --profile ci --cargo-profile ci --features intl
- name: Test docs
run: cargo test --doc --profile ci --features intl

misc:
name: Misc
Expand Down
3 changes: 2 additions & 1 deletion boa_engine/src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
//! Native classes are implemented through the [`Class`][class-trait] trait.
//! ```
//! # use boa_engine::{
//! # NativeFunction,
//! # property::Attribute,
//! # class::{Class, ClassBuilder},
//! # Context, JsResult, JsValue,
//! # builtins::JsArgs,
//! # JsArgs,
//! # };
//! # use boa_gc::{Finalize, Trace};
//! #
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/context/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use super::intrinsics::Intrinsics;
/// }
/// }
/// let hooks = Hooks; // Can have additional state.
/// let context = &mut ContextBuilder::new().host_hooks(&hooks).build();
/// let context = &mut ContextBuilder::new().host_hooks(&hooks).build().unwrap();
/// let result = context.eval_script(Source::from_bytes(r#"eval("let a = 5")"#));
/// assert_eq!(result.unwrap_err().to_string(), "TypeError: eval calls not available");
/// ```
Expand Down
3 changes: 2 additions & 1 deletion boa_engine/src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,12 @@ impl Context<'_> {
result
}

// TODO: remove `ignore` after we implement module execution
/// Evaluates the given module `src` by compiling down to bytecode, then interpreting the
/// bytecode into a value.
///
/// # Examples
/// ```
/// ```ignore
/// # use boa_engine::{Context, Source};
/// let mut context = Context::default();
///
Expand Down
2 changes: 2 additions & 0 deletions boa_engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ mod tests;
pub mod prelude {
pub use crate::{
error::{JsError, JsNativeError, JsNativeErrorKind},
native_function::NativeFunction,
object::JsObject,
Context, JsBigInt, JsResult, JsString, JsValue,
};
Expand All @@ -149,6 +150,7 @@ pub use crate::{
bigint::JsBigInt,
context::Context,
error::{JsError, JsNativeError, JsNativeErrorKind},
native_function::NativeFunction,
string::JsString,
symbol::JsSymbol,
value::JsValue,
Expand Down
10 changes: 8 additions & 2 deletions boa_engine/src/object/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2037,12 +2037,18 @@ impl<'ctx, 'host> FunctionObjectBuilder<'ctx, 'host> {
/// # Examples
///
/// ```
/// # use boa_engine::{Context, JsValue, object::ObjectInitializer, property::Attribute};
/// # use boa_engine::{
/// # Context,
/// # JsValue,
/// # NativeFunction,
/// # object::ObjectInitializer,
/// # property::Attribute
/// # };
/// let mut context = Context::default();
/// let object = ObjectInitializer::new(&mut context)
/// .property("hello", "world", Attribute::all())
/// .property(1, 1, Attribute::all())
/// .function(|_, _, _| Ok(JsValue::undefined()), "func", 0)
/// .function(NativeFunction::from_fn_ptr(|_, _, _| Ok(JsValue::undefined())), "func", 0)
/// .build();
/// ```
///
Expand Down