Skip to content

Commit

Permalink
Merge pull request #2 from prfiredragon/master
Browse files Browse the repository at this point in the history
3.3.0
  • Loading branch information
prfiredragon authored Apr 16, 2024
2 parents 4c7aa8e + b5c79bb commit b6f55e9
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 5 deletions.
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

0 comments on commit b6f55e9

Please sign in to comment.