Gave all modules own directory; added test CI pipeline
ci/woodpecker/push/arch unknown status Details
ci/woodpecker/push/docker unknown status Details
ci/woodpecker/push/lint Pipeline failed Details
ci/woodpecker/push/build Pipeline was successful Details
ci/woodpecker/push/test Pipeline was successful Details

pull/127/head
Jef Roosens 2022-04-10 16:48:37 +02:00
parent 6d60ea1538
commit f92a20fcf8
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
8 changed files with 27 additions and 8 deletions

View File

@ -0,0 +1,15 @@
matrix:
PLATFORM:
- linux/amd64
- linux/arm64
platform: ${PLATFORM}
pipeline:
test:
image: 'chewingbever/vlang:latest'
pull: true
commands:
- make test
when:
event: push

View File

@ -5,7 +5,7 @@ import datatypes
import time import time
struct ScheduledBuild { struct ScheduledBuild {
repo git.GitRepo repo git.GitRepo
timestamp time.Time timestamp time.Time
} }
@ -27,6 +27,6 @@ pub fn cron(conf Config) ? {
// } // }
// println(queue) // println(queue)
exp := "10/2 5 *" exp := '10/2 5 *'
println(parse_expression(exp) ?) println(parse_expression(exp) ?)
} }

View File

@ -4,8 +4,8 @@ import math
struct CronExpression { struct CronExpression {
minutes []u32 minutes []u32
hours []u32 hours []u32
days []u32 days []u32
} }
// parse_range parses a given string into a range of integers, if possible. // parse_range parses a given string into a range of integers, if possible.
@ -22,7 +22,7 @@ fn parse_range(s string, min u32, max u32) ?[]u32 {
} }
// Here, s solely consists of a number, so that's the only value we // Here, s solely consists of a number, so that's the only value we
// should return. // should return.
else{ else {
return [exps[0].u32()] return [exps[0].u32()]
} }
@ -44,7 +44,7 @@ fn parse_expression(exp string) ?CronExpression {
parts := exp.split(' ') parts := exp.split(' ')
if parts.len != 3 { if parts.len != 3 {
return error("Expression must contain 5 space-separated parts.") return error('Expression must contain 5 space-separated parts.')
} }
return CronExpression{ return CronExpression{

View File

@ -1,5 +1,9 @@
module cron module cron
fn test_parse_star_range() { fn test_parse_star_range() ? {
assert parse_range('*', 0, 5) == [0, 1, 2, 3, 4, 5] assert parse_range('*', 0, 5) ? == [u32(0), 1, 2, 3, 4, 5]
}
fn test_parse_number() ? {
assert parse_range('4', 0, 5) ? == [u32(4)]
} }

View File