Skip to content

Commit

Permalink
Fix bug in clearing previously-set keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
afranchuk committed Dec 14, 2021
1 parent f2757dc commit 9f0d1f3
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 10 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion ergo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ergo"
version = "1.0.0-rc.2"
version = "1.0.0-rc.3"
authors = ["Alex Franchuk <afranchuk@caci.com>"]
edition = "2021"

Expand Down
5 changes: 5 additions & 0 deletions ergo/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ergo changelog

## 1.0.0-rc.3 -- 2021-12-14
* Properly remove previously-set keys when a key is set to `unset`.
* With the recent modification to how unset values are removed this case was
missed.

## 1.0.0-rc.2 -- 2021-12-13
* Remove `Unset` keyed arguments to commands just like they are removed from
maps.
Expand Down
1 change: 1 addition & 0 deletions ergo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,4 @@ scripts reside.
* Maybe don't have a fallback doc string if there is no documentation set.
* Progress spinner
* Improve sources of capture bindings.
* `std:Iter:partition`
2 changes: 1 addition & 1 deletion ergo_runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ergo_runtime"
version = "1.0.0-rc.2"
version = "1.0.0-rc.3"
authors = ["Alex Franchuk <afranchuk@caci.com>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion ergo_runtime_macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ergo_runtime_macro"
version = "1.0.0-rc.2"
version = "1.0.0-rc.3"
authors = ["Alex Franchuk <afranchuk@caci.com>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion ergo_script/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ergo_script"
version = "1.0.0-rc.2"
version = "1.0.0-rc.3"
authors = ["Alex Franchuk <afranchuk@caci.com>"]
edition = "2021"

Expand Down
2 changes: 2 additions & 0 deletions ergo_script/src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ impl Evaluator {

if !v.is_type::<types::Unset>() {
env.insert(k, v.clone());
} else {
env.remove(&k);
}
if let Some(cap) = cap {
captures.resolve(cap, v);
Expand Down
10 changes: 10 additions & 0 deletions ergo_script/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,16 @@ mod test {
)
}

#[test]
fn set_and_unset() -> Result<(), String> {
script_eval_to("{a = 1, a = :unset}", SRMap(&[]))
}

#[test]
fn merge_and_unset() -> Result<(), String> {
script_eval_to("m = {a = 1}, {^:m, a = :unset}", SRMap(&[]))
}

#[test]
fn forced_function_capture() -> Result<(), String> {
script_eval_to("b = {a = 1}; f = !(fn :x -> b::x); f a", SRString("1"))
Expand Down
2 changes: 1 addition & 1 deletion ergo_std/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ergo_std"
version = "1.0.0-rc.2"
version = "1.0.0-rc.3"
authors = ["Alex Franchuk <afranchuk@caci.com>"]
edition = "2021"

Expand Down
3 changes: 3 additions & 0 deletions ergo_std/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ergo_std changelog

## 1.0.0-rc.3 -- 2021-12-14
* No changes.

## 1.0.0-rc.2 -- 2021-12-13
* Add `std:io:is-terminal` to check whether a stream is connected to a terminal.
* Add `std:fs:file-type` to get the file type of a path.
Expand Down

0 comments on commit 9f0d1f3

Please sign in to comment.