Skip to content
Merged
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
15 changes: 15 additions & 0 deletions test/private/tokenizer.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
(define-lex-abbrev rest-of-line
(concatenation (complement (concatenation any-string #\newline any-string)) #\newline))

(define-lex-abbrev comment-line (concatenation "//" rest-of-line))

(define-lex-abbrev dash-line (concatenation (repetition 3 +inf.0 #\-) #\newline))
(define-lex-abbrev equals-line (concatenation (repetition 3 +inf.0 #\=) #\newline))
(define-lex-abbrev pipe-dash-line (concatenation "|" dash-line))
Expand Down Expand Up @@ -83,6 +85,7 @@
(define initial-lexer
(lexer-src-pos
[whitespace (return-without-pos (initial-lexer input-port))]
[comment-line (return-without-pos (initial-lexer input-port))]
[":" (token-COLON)]
["@" (token-AT-SIGN)]
[".." (token-DOUBLE-DOT)]
Expand Down Expand Up @@ -166,6 +169,18 @@
(position-token (token-CODE-LINE "#lang racket\n") (position 11 2 2) (position 24 3 0))))
(check-equal? (tokenize-until-eof tokenizer) expected-tokens))

(test-case "comments between statements"
(define input (open-input-string "header:\n// a comment\n- #lang racket\n"))
(port-count-lines! input)
(define tokenizer (make-refactoring-test-tokenizer input))
(define expected-tokens
(list
(position-token (token-IDENTIFIER 'header) (position 1 1 0) (position 7 1 6))
(position-token (token-COLON) (position 7 1 6) (position 8 1 7))
(position-token (token-SINGLE-DASH) (position 22 3 0) (position 24 3 2))
(position-token (token-CODE-LINE "#lang racket\n") (position 24 3 2) (position 37 4 0))))
(check-equal? (tokenize-until-eof tokenizer) expected-tokens))

(test-case "code blocks"
(define input (open-input-string "---\n#lang racket/base\n(void)\n---\n"))
(port-count-lines! input)
Expand Down
1 change: 1 addition & 0 deletions test/testing-lang-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
header: - #lang resyntax/test


// Comments are allowed between statements (see issue #350).
test: "unnecessary multi-line code blocks in tests refactorable to single-line code blocks"
|-------------------
| test: "foo"
Expand Down
Loading