Skip to content

Commit

Permalink
Fix tests for nix 2.17 (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
oxalica authored Aug 2, 2023
2 parents 59bcad0 + cf44cd1 commit 6f20ed4
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,11 @@ jobs:
uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixos-unstable
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.channel }}
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Build
run: cargo build --all
run: nix develop .#full --command cargo build --all
- name: Test
run: cargo test --all -- --include-ignored
run: nix develop .#full --command cargo test --all -- --include-ignored

nix-flake:
name: Flake package
Expand Down
37 changes: 34 additions & 3 deletions crates/ide/src/ide/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,19 @@ mod tests {
`bool`
`builtins.true`
(No documentation from Nix)
Primitive value.
It can be returned by
[comparison operators](@docroot@/language/operators.md#Comparison)
and used in
[conditional expressions](@docroot@/language/constructs.md#Conditionals).
The name `true` is not special, and can be shadowed:
```nix-repl
nix-repl> let true = 1; in true
1
```
"#]],
);
check(
Expand Down Expand Up @@ -419,7 +431,19 @@ mod tests {
`bool`
`builtins.true`
(No documentation from Nix)
Primitive value.
It can be returned by
[comparison operators](@docroot@/language/operators.md#Comparison)
and used in
[conditional expressions](@docroot@/language/constructs.md#Conditionals).
The name `true` is not special, and can be shadowed:
```nix-repl
nix-repl> let true = 1; in true
1
```
"#]],
);

Expand All @@ -434,7 +458,14 @@ mod tests {
`{ abort: string → ?, add: float → float → float, addErrorContext: string → ? → ?, all: (? → bool) → [?] → bool, … }`
`builtins.builtins`
(No documentation from Nix)
Contains all the [built-in functions](@docroot@/language/builtins.md) and values.
Since built-in functions were added over time, [testing for attributes](./operators.md#has-attribute) in `builtins` can be used for graceful fallback on older Nix installations:
```nix
# if hasContext is not available, we assume `s` has a context
if builtins ? hasContext then builtins.hasContext s else true
```
"#]],
);
}
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6f20ed4

Please sign in to comment.