Skip to content

Commit

Permalink
Fix tests output.
Browse files Browse the repository at this point in the history
  • Loading branch information
schungx committed Feb 2, 2024
1 parent 52e2677 commit da040a9
Show file tree
Hide file tree
Showing 35 changed files with 113 additions and 122 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Version 1.18.0
Deprecated API's
----------------

* The plugin macros `register_exported_fn!`, `set_exported_fn!` and `set_exported_global_fn!` are deprecated because they do not add value over existing direct API's.
* The plugin macros `export_fn`, `register_exported_fn!`, `set_exported_fn!` and `set_exported_global_fn!` are deprecated because they do not add value over existing direct API's.

Enhancements
------------
Expand Down
6 changes: 2 additions & 4 deletions codegen/ui_tests/export_fn_bad_attr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

#[derive(Clone)]
Expand All @@ -12,10 +13,7 @@ pub fn test_fn(input: Point) -> bool {
}

fn main() {
let n = Point {
x: 0.0,
y: 10.0,
};
let n = Point { x: 0.0, y: 10.0 };
if test_fn(n) {
println!("yes");
} else {
Expand Down
12 changes: 6 additions & 6 deletions codegen/ui_tests/export_fn_bad_attr.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: unknown attribute 'unknown'
--> ui_tests/export_fn_bad_attr.rs:9:13
|
9 | #[export_fn(unknown = "thing")]
| ^^^^^^^
--> ui_tests/export_fn_bad_attr.rs:10:13
|
10 | #[export_fn(unknown = "thing")]
| ^^^^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_bad_attr.rs:19:8
--> ui_tests/export_fn_bad_attr.rs:17:8
|
19 | if test_fn(n) {
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 2 additions & 4 deletions codegen/ui_tests/export_fn_bad_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

#[derive(Clone)]
Expand All @@ -12,10 +13,7 @@ pub fn test_fn(input: Point) -> bool {
}

fn main() {
let n = Point {
x: 0.0,
y: 10.0,
};
let n = Point { x: 0.0, y: 10.0 };
if test_fn(n) {
println!("yes");
} else {
Expand Down
12 changes: 6 additions & 6 deletions codegen/ui_tests/export_fn_bad_value.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: expecting string literal
--> ui_tests/export_fn_bad_value.rs:9:20
|
9 | #[export_fn(name = true)]
| ^^^^
--> ui_tests/export_fn_bad_value.rs:10:20
|
10 | #[export_fn(name = true)]
| ^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_bad_value.rs:19:8
--> ui_tests/export_fn_bad_value.rs:17:8
|
19 | if test_fn(n) {
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 2 additions & 4 deletions codegen/ui_tests/export_fn_cfg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

#[derive(Clone)]
Expand All @@ -13,10 +14,7 @@ pub fn test_fn(input: Point) -> bool {
}

fn main() {
let n = Point {
x: 0.0,
y: 10.0,
};
let n = Point { x: 0.0, y: 10.0 };
if test_fn(n) {
println!("yes");
} else {
Expand Down
12 changes: 6 additions & 6 deletions codegen/ui_tests/export_fn_cfg.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: `cfg` attributes are not allowed for `export_fn`
--> ui_tests/export_fn_cfg.rs:9:1
|
9 | #[cfg(not(feature = "foo"))]
| ^
--> ui_tests/export_fn_cfg.rs:10:1
|
10 | #[cfg(not(feature = "foo"))]
| ^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_cfg.rs:20:8
--> ui_tests/export_fn_cfg.rs:18:8
|
20 | if test_fn(n) {
18 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 2 additions & 4 deletions codegen/ui_tests/export_fn_extra_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

#[derive(Clone)]
Expand All @@ -12,10 +13,7 @@ pub fn test_fn(input: Point) -> bool {
}

fn main() {
let n = Point {
x: 0.0,
y: 10.0,
};
let n = Point { x: 0.0, y: 10.0 };
if test_fn(n) {
println!("yes");
} else {
Expand Down
12 changes: 6 additions & 6 deletions codegen/ui_tests/export_fn_extra_value.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: extraneous value
--> ui_tests/export_fn_extra_value.rs:9:26
|
9 | #[export_fn(return_raw = "yes")]
| ^^^^^
--> ui_tests/export_fn_extra_value.rs:10:26
|
10 | #[export_fn(return_raw = "yes")]
| ^^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_extra_value.rs:19:8
--> ui_tests/export_fn_extra_value.rs:17:8
|
19 | if test_fn(n) {
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 2 additions & 4 deletions codegen/ui_tests/export_fn_junk_arg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

#[derive(Clone)]
Expand All @@ -12,10 +13,7 @@ pub fn test_fn(input: Point) -> bool {
}

fn main() {
let n = Point {
x: 0.0,
y: 10.0,
};
let n = Point { x: 0.0, y: 10.0 };
if test_fn(n) {
println!("yes");
} else {
Expand Down
12 changes: 6 additions & 6 deletions codegen/ui_tests/export_fn_junk_arg.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: expecting identifier
--> ui_tests/export_fn_junk_arg.rs:9:13
|
9 | #[export_fn("wheeeee")]
| ^^^^^^^^^
--> ui_tests/export_fn_junk_arg.rs:10:13
|
10 | #[export_fn("wheeeee")]
| ^^^^^^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_junk_arg.rs:19:8
--> ui_tests/export_fn_junk_arg.rs:17:8
|
19 | if test_fn(n) {
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 2 additions & 4 deletions codegen/ui_tests/export_fn_missing_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

#[derive(Clone)]
Expand All @@ -12,10 +13,7 @@ pub fn test_fn(input: Point) -> bool {
}

fn main() {
let n = Point {
x: 0.0,
y: 10.0,
};
let n = Point { x: 0.0, y: 10.0 };
if test_fn(n) {
println!("yes");
} else {
Expand Down
12 changes: 6 additions & 6 deletions codegen/ui_tests/export_fn_missing_value.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: requires value
--> ui_tests/export_fn_missing_value.rs:9:13
|
9 | #[export_fn(name)]
| ^^^^
--> ui_tests/export_fn_missing_value.rs:10:13
|
10 | #[export_fn(name)]
| ^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_missing_value.rs:19:8
--> ui_tests/export_fn_missing_value.rs:17:8
|
19 | if test_fn(n) {
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 2 additions & 4 deletions codegen/ui_tests/export_fn_path_attr.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

#[derive(Clone)]
Expand All @@ -12,10 +13,7 @@ pub fn test_fn(input: Point) -> bool {
}

fn main() {
let n = Point {
x: 0.0,
y: 10.0,
};
let n = Point { x: 0.0, y: 10.0 };
if test_fn(n) {
println!("yes");
} else {
Expand Down
12 changes: 6 additions & 6 deletions codegen/ui_tests/export_fn_path_attr.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: expecting attribute name
--> ui_tests/export_fn_path_attr.rs:9:13
|
9 | #[export_fn(rhai::name = "thing")]
| ^^^^
--> ui_tests/export_fn_path_attr.rs:10:13
|
10 | #[export_fn(rhai::name = "thing")]
| ^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_path_attr.rs:19:8
--> ui_tests/export_fn_path_attr.rs:17:8
|
19 | if test_fn(n) {
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 2 additions & 4 deletions codegen/ui_tests/export_fn_raw_noreturn.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

#[derive(Clone)]
Expand All @@ -12,10 +13,7 @@ pub fn test_fn(input: &mut Point) {
}

fn main() {
let n = Point {
x: 0.0,
y: 10.0,
};
let n = Point { x: 0.0, y: 10.0 };
test_fn(&mut n);
if n.x >= 10.0 {
println!("yes");
Expand Down
12 changes: 6 additions & 6 deletions codegen/ui_tests/export_fn_raw_noreturn.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: functions marked with 'return_raw' must return Result<T, Box<EvalAltResult>>
--> ui_tests/export_fn_raw_noreturn.rs:9:13
|
9 | #[export_fn(return_raw)]
| ^^^^^^^^^^
--> ui_tests/export_fn_raw_noreturn.rs:10:13
|
10 | #[export_fn(return_raw)]
| ^^^^^^^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_raw_noreturn.rs:19:5
--> ui_tests/export_fn_raw_noreturn.rs:17:5
|
19 | test_fn(&mut n);
17 | test_fn(&mut n);
| ^^^^^^^ not found in this scope
6 changes: 2 additions & 4 deletions codegen/ui_tests/export_fn_raw_return.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

#[derive(Clone)]
Expand All @@ -12,10 +13,7 @@ pub fn test_fn(input: Point) -> bool {
}

fn main() {
let n = Point {
x: 0.0,
y: 10.0,
};
let n = Point { x: 0.0, y: 10.0 };
if test_fn(n) {
println!("yes");
} else {
Expand Down
6 changes: 3 additions & 3 deletions codegen/ui_tests/export_fn_raw_return.stderr
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
error[E0599]: `bool` is not an iterator
--> ui_tests/export_fn_raw_return.rs:10:33
--> ui_tests/export_fn_raw_return.rs:11:33
|
9 | #[export_fn(return_raw)]
10 | #[export_fn(return_raw)]
| ------------------------ in this procedural macro expansion
10 | pub fn test_fn(input: Point) -> bool {
11 | pub fn test_fn(input: Point) -> bool {
| ^^^^ `bool` is not an iterator
|
= note: the following trait bounds were not satisfied:
Expand Down
1 change: 1 addition & 0 deletions codegen/ui_tests/first_shared_ref.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

struct NonClonable {
Expand Down
8 changes: 4 additions & 4 deletions codegen/ui_tests/first_shared_ref.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: references from Rhai in this position must be mutable
--> ui_tests/first_shared_ref.rs:11:23
--> ui_tests/first_shared_ref.rs:12:23
|
11 | pub fn test_fn(input: &NonClonable) -> bool {
12 | pub fn test_fn(input: &NonClonable) -> bool {
| ^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/first_shared_ref.rs:22:8
--> ui_tests/first_shared_ref.rs:23:8
|
22 | if test_fn(n) {
23 | if test_fn(n) {
| ^^^^^^^ not found in this scope
1 change: 1 addition & 0 deletions codegen/ui_tests/non_clonable.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

struct NonClonable {
Expand Down
8 changes: 4 additions & 4 deletions codegen/ui_tests/non_clonable.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error[E0277]: the trait bound `NonClonable: Clone` is not satisfied
--> ui_tests/non_clonable.rs:11:23
--> ui_tests/non_clonable.rs:12:23
|
11 | pub fn test_fn(input: NonClonable) -> bool {
12 | pub fn test_fn(input: NonClonable) -> bool {
| ^^^^^^^^^^^
| |
| the trait `Clone` is not implemented for `NonClonable`
Expand All @@ -14,6 +14,6 @@ note: required by a bound in `rhai::Dynamic::cast`
| ^^^^^ required by this bound in `Dynamic::cast`
help: consider annotating `NonClonable` with `#[derive(Clone)]`
|
3 + #[derive(Clone)]
4 | struct NonClonable {
4 + #[derive(Clone)]
5 | struct NonClonable {
|
1 change: 1 addition & 0 deletions codegen/ui_tests/non_clonable_second.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)]
use rhai::plugin::*;

struct NonClonable {
Expand Down
8 changes: 4 additions & 4 deletions codegen/ui_tests/non_clonable_second.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error[E0277]: the trait bound `NonClonable: Clone` is not satisfied
--> ui_tests/non_clonable_second.rs:11:27
--> ui_tests/non_clonable_second.rs:12:27
|
11 | pub fn test_fn(a: u32, b: NonClonable) -> bool {
12 | pub fn test_fn(a: u32, b: NonClonable) -> bool {
| ^^^^^^^^^^^
| |
| the trait `Clone` is not implemented for `NonClonable`
Expand All @@ -14,6 +14,6 @@ note: required by a bound in `rhai::Dynamic::cast`
| ^^^^^ required by this bound in `Dynamic::cast`
help: consider annotating `NonClonable` with `#[derive(Clone)]`
|
3 + #[derive(Clone)]
4 | struct NonClonable {
4 + #[derive(Clone)]
5 | struct NonClonable {
|
2 changes: 2 additions & 0 deletions codegen/ui_tests/return_mut_ref.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)]
#![allow(deprecated)]
use rhai::plugin::*;

#[derive(Clone)]
Expand Down
Loading

0 comments on commit da040a9

Please sign in to comment.