Skip to content

Commit

Permalink
feat: Add consts
Browse files Browse the repository at this point in the history
  • Loading branch information
sorairolake committed Sep 21, 2024
1 parent a1d9bc3 commit c4a7da6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ All notable changes to this project will be documented in this file.
The format is based on https://keepachangelog.com/[Keep a Changelog], and this
project adheres to https://semver.org/[Semantic Versioning].

== {compare-url}/v0.2.8\...HEAD[Unreleased]

=== Added

* Add `base` and `max` constants ({pull-request-url}/51[#51])

== {compare-url}/v0.2.7\...v0.2.8[0.2.8] - 2024-04-08

=== Changed
Expand Down
28 changes: 28 additions & 0 deletions src/exitcode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,34 @@ config = 0x4e
config
end

"""
base
The base value for `ExitCode`.
# Examples
```jldoctest
julia> Sysexits.base == Sysexits.usage
true
```
"""
const base = usage

"""
max
The maximum value for `ExitCode`.
# Examples
```jldoctest
julia> Sysexits.max == Sysexits.config
true
```
"""
const max = config

"""
issuccess(code::ExitCode) -> Bool
Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ end
@test UInt8(Sysexits.config) == 78
end

@testset "base value" begin
@test Sysexits.base == Sysexits.usage
end

@testset "maximum value" begin
@test Sysexits.max == Sysexits.config
end

@testset "issuccess for successful termination" begin
@test issuccess(Sysexits.ok)
end
Expand Down

0 comments on commit c4a7da6

Please sign in to comment.