Skip to content

Commit

Permalink
- Remove 'depth' test
Browse files Browse the repository at this point in the history
- Add 'level' test
  • Loading branch information
naokazuterada committed Sep 30, 2017
1 parent c7d6501 commit c13aed8
Showing 1 changed file with 35 additions and 25 deletions.
60 changes: 35 additions & 25 deletions tests/depth.py → tests/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import sublime
import sys

class TestDepth(TestBase):
"""Test of attributes 'depth'"""
class TestLevel(TestBase):
"""Test of attributes 'level'"""

# for debug
# def tearDown(self):
# pass

depth_text = \
level_text = \
"""
<!-- MarkdownTOC {0} -->
Expand All @@ -22,61 +22,71 @@ class TestDepth(TestBase):
### heading 3
#### heading 4
##### heading 5
###### heading 6
"""
def test_depth_default(self):
"""Default Depth is 2"""
toc_txt = self.commonSetup(self.depth_text.format(''))
self.assert_In('- heading 1', toc_txt)
self.assert_In('- heading 2', toc_txt)
self.assert_NotIn('- heading 3', toc_txt)
self.assert_NotIn('- heading 4', toc_txt)
self.assert_NotIn('- heading 5', toc_txt)

def test_depth_0(self):
"""Depth 0 means no limit"""
toc_txt = self.commonSetup(self.depth_text.format('depth=0'))
def appear_all_headings(self, toc_txt):
self.assert_In('- heading 1', toc_txt)
self.assert_In('- heading 2', toc_txt)
self.assert_In('- heading 3', toc_txt)
self.assert_In('- heading 4', toc_txt)
self.assert_In('- heading 5', toc_txt)
self.assert_In('- heading 6', toc_txt)
def test_level_default(self):
"""Default is no limit"""
toc_txt = self.commonSetup(self.level_text.format(''))
self.appear_all_headings(toc_txt)

def test_depth_1(self):
toc_txt = self.commonSetup(self.depth_text.format('depth=1'))
def test_level_1(self):
"""level="1" shows h1 """
toc_txt = self.commonSetup(self.level_text.format('level="1"'))
self.assert_In('- heading 1', toc_txt)
self.assert_NotIn('- heading 2', toc_txt)
self.assert_NotIn('- heading 3', toc_txt)
self.assert_NotIn('- heading 4', toc_txt)
self.assert_NotIn('- heading 5', toc_txt)
self.assert_NotIn('- heading 6', toc_txt)

def test_depth_2(self):
toc_txt = self.commonSetup(self.depth_text.format('depth=2'))
def test_level_1_2(self):
"""level="1,2" shows h1,h2 """
toc_txt = self.commonSetup(self.level_text.format('level="1,2"'))
self.assert_In('- heading 1', toc_txt)
self.assert_In('- heading 2', toc_txt)
self.assert_NotIn('- heading 3', toc_txt)
self.assert_NotIn('- heading 4', toc_txt)
self.assert_NotIn('- heading 5', toc_txt)
self.assert_NotIn('- heading 6', toc_txt)

def test_depth_3(self):
toc_txt = self.commonSetup(self.depth_text.format('depth=3'))
def test_level_1_2_3(self):
"""level="1,2,3" shows h1,h2,h3 """
toc_txt = self.commonSetup(self.level_text.format('level="1,2,3"'))
self.assert_In('- heading 1', toc_txt)
self.assert_In('- heading 2', toc_txt)
self.assert_In('- heading 3', toc_txt)
self.assert_NotIn('- heading 4', toc_txt)
self.assert_NotIn('- heading 5', toc_txt)
self.assert_NotIn('- heading 6', toc_txt)

def test_depth_4(self):
toc_txt = self.commonSetup(self.depth_text.format('depth=4'))
def test_level_1_2_3_4(self):
"""level="1,2,3,4" shows h1,h2,h3,h4 """
toc_txt = self.commonSetup(self.level_text.format('level="1,2,3,4"'))
self.assert_In('- heading 1', toc_txt)
self.assert_In('- heading 2', toc_txt)
self.assert_In('- heading 3', toc_txt)
self.assert_In('- heading 4', toc_txt)
self.assert_NotIn('- heading 5', toc_txt)
self.assert_NotIn('- heading 6', toc_txt)

def test_depth_5(self):
toc_txt = self.commonSetup(self.depth_text.format('depth=5'))
def test_level_1_2_3_4_5(self):
"""level="1,2,3,4,5" shows h1,h2,h3,h4,h5 """
toc_txt = self.commonSetup(self.level_text.format('level="1,2,3,4,5"'))
self.assert_In('- heading 1', toc_txt)
self.assert_In('- heading 2', toc_txt)
self.assert_In('- heading 3', toc_txt)
self.assert_In('- heading 4', toc_txt)
self.assert_In('- heading 5', toc_txt)
self.assert_NotIn('- heading 6', toc_txt)

def test_level_1_2_3_4_5_6(self):
"""level="1,2,3,4,5" shows h1,h2,h3,h4,h5 """
toc_txt = self.commonSetup(self.level_text.format('level="1,2,3,4,5,6"'))
self.appear_all_headings(toc_txt)

0 comments on commit c13aed8

Please sign in to comment.