Skip to content

Commit

Permalink
Improve tokenization tests on primary_attr blocks
Browse files Browse the repository at this point in the history
Increases the number and kind of tests run on tokenizing Primary Attribute
blocks.
  • Loading branch information
sirosen committed Jul 28, 2014
1 parent 2cbc5ca commit 736f968
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/unit/reader/files/valid4.manifest
@@ -0,0 +1,5 @@
# a single file block with a primary attr

file "/d/e/f/g" {
source /a/b/c
}
8 changes: 8 additions & 0 deletions tests/unit/reader/files/valid5.manifest
@@ -0,0 +1,8 @@
# primary_attr block, followed by non-primary_attr block

manifest "man man"

file {
source "potato"
target "mango"
}
9 changes: 9 additions & 0 deletions tests/unit/reader/files/valid6.manifest
@@ -0,0 +1,9 @@
# multiple Primary Attribute style blocks

manifest "man man"

file "bat man"

directory "super man"

manifest "wo man"
3 changes: 3 additions & 0 deletions tests/unit/reader/files/valid7.manifest
@@ -0,0 +1,3 @@
# primary attr block with empty body

manifest "man man" {}
15 changes: 15 additions & 0 deletions tests/unit/reader/tokenize_test.py
Expand Up @@ -188,6 +188,21 @@ def primary_attr_block_series():
assert tokens[7].ty == tokenize.Token.types.TEMPLATE


@istest
def primary_attr_block_empty_body():
"""
Unit: Tokenizer Primary Attribute Block Empty Body
Verifies that tokenization proceeds correctly when a "Primary Attribute"
style block is given a "{}" body
"""
tokens = tokenize_filename(get_full_path('valid7.manifest'))
assert len(tokens) == 4
assert tokens[0].ty == tokenize.Token.types.IDENTIFIER
assert tokens[1].ty == tokenize.Token.types.TEMPLATE
assert tokens[2].ty == tokenize.Token.types.BLOCK_START
assert tokens[3].ty == tokenize.Token.types.BLOCK_END


@istest
def token_to_string():
"""
Expand Down

0 comments on commit 736f968

Please sign in to comment.