Skip to content

unit tests for error.rs - #586

Merged
gkorland merged 3 commits into
masterfrom
gkorland-unittest-error
Dec 23, 2021
Merged

gkorland merged 3 commits into
masterfrom
gkorland-unittest-error

Conversation

@gkorland

Copy link
Copy Markdown
Contributor

No description provided.

@gkorland
gkorland requested a review from oshadmi December 23, 2021 15:00
Comment thread src/error.rs
let err: Error = "error from str".into();
assert_eq!(err.msg, "error from str");
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding

Suggested change
}
#[test]
fn test_from_error_to_redis_error() {
let err: Error = String::from("error from String").into();
let redis_err: RedisError = err.into();
if let RedisError::String(s) = redis_err {
assert_eq!(s, "error from String");
}
}
#[test]
fn test_from_redis_error_to_error() {
let redis_err = RedisError::String(String::from("redis error from String"));
let err: Error = redis_err.into();
assert_eq!(err.msg, "ERR redis error from String");
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oshadmi I don't get the suggestion, it seems like you suggest to delete on }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gkorland Suggested adding 2 tests at the end
(the closing bracket } is removed, but also added with 2 additional tests)

@gkorland
gkorland merged commit 89f6675 into master Dec 23, 2021
@gkorland
gkorland deleted the gkorland-unittest-error branch December 23, 2021 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants