Tests, doc-coverage, dependencies

This commit is contained in:
Georges Dupéron 2017-01-07 23:00:17 +01:00
parent 07b1af11d2
commit 54f951bb8b
7 changed files with 47 additions and 18 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
.DS_Store
compiled/
/doc/
/coverage/

View File

@ -51,8 +51,10 @@ before_script:
# packages without it getting stuck on a confirmation prompt.
script:
- raco test -x -p tr-immutable
- if test $RACKET_VERSION != 6.0 -a $RACKET_VERSION != 6.1; then raco setup --check-pkg-deps --pkgs tr-immutable; fi
- raco pkg install --deps search-auto doc-coverage
- raco doc-coverage tr-immutable
- raco pkg install --deps search-auto cover cover-codecov
- raco cover -s doc -s test -s main -f codecov -d $TRAVIS_BUILD_DIR/coverage .
after_success:
- raco setup --check-pkg-deps --pkgs tr-immutable
- raco pkg install --deps search-auto cover cover-coveralls
- raco cover -b -f coveralls -d $TRAVIS_BUILD_DIR/coverage .

View File

@ -1,8 +1,12 @@
#lang info
(define collection "tr-immutable")
(define deps '("base"
"rackunit-lib"))
(define build-deps '("scribble-lib" "racket-doc"))
"rackunit-lib"
"typed-racket-lib"
"typed-racket-more"))
(define build-deps '("scribble-lib"
"racket-doc"
"typed-racket-doc"))
(define scribblings '(("scribblings/tr-immutable.scrbl" ())))
(define pkg-desc "Description Here")
(define version "0.0")

View File

@ -1,15 +1,14 @@
#lang typed/racket/base
(module unsafe racket/base
;; TODO: make this a vector in the implementation, but make TR think it's a
;; list (via a contract?)
(provide (struct-out ivector))
(struct ivector (v) #:mutable)
)
(require typed/racket/unsafe)
(unsafe-require/typed 'unsafe
[#:struct (A) ivector ([v : (Listof A)])
#:type-name IVector])
(make-predicate (IVector Integer))
(provide IVectorof
(rename-out [new-ivector ivector]))
(unsafe-require/typed tr-immutable/private/unsafe
[#:struct (A) ivector ([v : (Listof A)])
#:type-name IVectorof])
(: new-ivector ( (A) ( A * (IVectorof A))))
(define (new-ivector . vs)
(ivector vs))

6
private/unsafe.rkt Normal file
View File

@ -0,0 +1,6 @@
#lang racket/base
;; TODO: make this a vector in the implementation, but make TR think it's a
;; list (via a contract?)
(provide (struct-out ivector))
(struct ivector (v) #:mutable)

View File

@ -1,10 +1,22 @@
#lang scribble/manual
@require[@for-label[tr-immutable
racket/base]]
typed/racket/base]]
@title{tr-immutable}
@author{georges}
@defmodule[tr-immutable]
Package Description Here
This library implements immutable wrappers for @racket[vector] and
@racket[box], in a way that @racketmodname[typed/racket] is able to recognise.
This makes it possible to write @racket[(make-predicate (IVectorof Integer))]
in current versions of Typed/Racket.
@defform[#:kind "type"
(IVectorof A)]{
The type for immutable vectors containing elements of type @racket[A].
}
@defproc[(ivector [v : A] ...) (IVectorof A)]{
The type for immutable vectors containing elements of type @racket[A].
}

5
test/test-vector.rkt Normal file
View File

@ -0,0 +1,5 @@
#lang typed/racket
(require tr-immutable
typed/rackunit)
(check-pred (make-predicate (IVectorof Positive-Byte)) (ivector 1 2 3))