-
Notifications
You must be signed in to change notification settings - Fork 5
Conform Semver and Range to fmt::Display #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Also you may want to put the code in different files? I tried, but |
Also I'm assuming you want these, but you don’t have to. |
i want this a lot. i just need to add tests so coveralls doesn't make me look bad. |
not presently working, because i don't understand the code in `at()`
Since we're rendering |
and make it easy to run with docker
ok, I think I solved it. import SemVer, { Range } from "./src/utils/semver.ts";
const a = new SemVer("1.2.3")!;
const b = new SemVer("1.2.4")!;
const r = new Range([[a, b]]);
console.log("a:", a);
console.log("b:", b);
console.log("r:", r); [1.2, 1.3] isn't @1.2, but [1.2.2.2, 1.2.2.3] is @1.2.2.2..... sooooo, ok. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mxcl: please confirm this conforms to your understanding of @
:
#[test]
fn test_at() -> Result<()> {
let ra = Range::parse(">=1.0<1.1")?;
assert_eq!(format!("{ra}"), "~1");
let rb = Range::parse("=1.1")?;
assert_eq!(format!("{rb}"), "=1.1");
let rc = Range::parse(">=1.1.0<1.1.1")?;
assert_eq!(format!("{rc}"), "@1.1.0");
let rd = Range::parse("=1.1.1")?;
assert_eq!(format!("{rd}"), "=1.1.1");
let re = Range::parse(">=1.1.1.0<1.1.1.1")?;
assert_eq!(format!("{re}"), "@1.1.1.0");
let rf = Range::parse("=1.1.1.0")?;
assert_eq!(format!("{rf}"), "=1.1.1.0");
let rg = Range::parse(">=1.1<1.1.1.1.1")?;
assert_eq!(format!("{rg}"), ">=1.1<1.1.1.1.1");
let rh = Range::parse(">=1.1.1<1.1.3")?;
assert_eq!(format!("{rh}"), ">=1.1.1<1.1.3");
let ri = Range::parse(">=1.1.1<1.2.2")?;
assert_eq!(format!("{ri}"), ">=1.1.1<1.2.2");
Ok(())
}
went ahead here: 454ad14 |
Pull Request Test Coverage Report for Build 12613833404Details
💛 - Coveralls |
Yes this is correct IMO. Thank you! |
I imagine this is horrendous and maybe even dangerous.
It also isn’t quite how libpkgx behaves since we keep a “pretty” string around for rendering purposes but let’s find out if we need that later.