Skip to content
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

3.3.0 #1

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/devskim.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: DevSkim

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '22 22 * * 3'

jobs:
lint:
name: DevSkim
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Run DevSkim scanner
uses: microsoft/DevSkim-Action@v1

- name: Upload DevSkim scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: devskim-results.sarif
22 changes: 22 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Rust

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Rust](https://github.com/prfiredragon/version/actions/workflows/rust.yml/badge.svg)](https://github.com/prfiredragon/version/actions/workflows/rust.yml)

# version
`version` is a very simple library who's job is to return the version of your crate if you're building with Cargo.

Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,16 @@ pub fn from_version(_a: &Version, test: Cmp, _b: &Version) -> bool{
#[test]
fn string_test() {
// Bad test is bad.
assert_eq!( version!(), "3.0.0" );
assert_eq!( version!(), "3.3.0" );
}
#[test]
fn version_struct_test() {
let ver = FromStr::from_str( &version!() );
assert_eq!( ver, Ok( Version { major: 3, minor: 0, patch: 0 } ) );
assert_eq!( ver, Ok( Version { major: 3, minor: 3, patch: 0 } ) );
}
#[test]
fn invalid_test() {
let invalids = [ "nope", "1.0", "1.0.x", "1.x.0", "x.0.1", "x.x.x" ];
let invalids = [ "nope", "x.0", "1.0.x", "1.x.0", "x.0.1", "x.x.x" ];

for invalid in &invalids {
let invv : Result<Version, String> = FromStr::from_str( invalid );
Expand All @@ -173,14 +173,14 @@ fn mayor_test() {
#[test]
fn minor_test() {
let mut test_ret = false;
if version!() < "3.0.1" {test_ret = true;}
if version!() < "3.3.1" {test_ret = true;}

assert_eq!( true, test_ret );
}
#[test]
fn equal_test() {
let mut test_ret = false;
if version!() == "3.0.0" {test_ret = true;}
if version!() == "3.3.0" {test_ret = true;}

assert_eq!( true, test_ret );
}
Expand Down
Loading