add the standard help to the prelude as std help ... (#8794)

Related to #8505.

# Description
as #8505 has been landed, this PR fixes the prelude TODO and uses the
`help` commands from the standard library in the prelude.

# User-Facing Changes
can now access `std help ...` to use the `help` implementations from the
standard library

# Tests + Formatting
```
$nothing
```

# After Submitting
```
$nothing
```
This commit is contained in:
Antoine Stevan 2023-04-07 20:04:51 +02:00 committed by GitHub
parent a3ea0c304a
commit d881481758
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 23 deletions

View file

@ -79,16 +79,13 @@ fn load_standard_library(
report_error(&working_set, err); report_error(&working_set, err);
} }
// TODO: change this when #8505 is merged
// NOTE: remove the assert and uncomment the `help`s
let prelude = vec![ let prelude = vec![
("assert", "assert"), ("std help", "help"),
// ("help", "help"), ("std help commands", "help commands"),
// ("help commands", "help commands"), ("std help aliases", "help aliases"),
// ("help aliases", "help aliases"), ("std help modules", "help modules"),
// ("help modules", "help modules"), ("std help externs", "help externs"),
// ("help externs", "help externs"), ("std help operators", "help operators"),
// ("help operators", "help operators"),
]; ];
load_prelude(&mut working_set, prelude, &module); load_prelude(&mut working_set, prelude, &module);

View file

@ -10,26 +10,15 @@ fn library_loaded() -> TestResult {
#[test] #[test]
fn prelude_loaded() -> TestResult { fn prelude_loaded() -> TestResult {
run_test( run_test("std help commands | where name == open | length", "1")
"help assert | lines | first 1 | to text",
"Universal assert command",
)
}
#[test]
fn prelude_run() -> TestResult {
run_test("assert true; print 'it works'", "it works")
} }
#[test] #[test]
fn not_loaded() -> TestResult { fn not_loaded() -> TestResult {
fail_test("help log info", "") fail_test("log info", "")
} }
#[test] #[test]
fn use_command() -> TestResult { fn use_command() -> TestResult {
run_test( run_test("use std assert; assert true; print 'it works'", "it works")
"use std 'log info'; log info 'this is some information'",
"",
)
} }