Skip to content

Commit 7bd4cbf

Browse files
committed
Improve tests
1 parent cf528e8 commit 7bd4cbf

File tree

13 files changed

+279
-9
lines changed

13 files changed

+279
-9
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
build
22
dist
3-
test-output
3+
test-output-*
44
*.egg-info
55
__pycache__
66
docs/.doctrees

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ test:
1212
pip install pep8 pylint
1313
pep8 sphinx_tabs/tabs.py
1414
pylint --rcfile=pylint.cfg sphinx_tabs/tabs.py
15-
sphinx-build -E -n -W test test-output
15+
test/run.sh
1616

1717
docs:
1818
rm -rf docs
19-
sphinx-build -E -n -W test docs
19+
sphinx-build -E -n -W example docs
2020
echo "" > docs/.nojekyll
2121

2222
clean:
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
project = 'Tabs Examples'
2-
version = ''
3-
release = '0.2'
4-
copyright = '2017, djungelorm'
5-
1+
project = 'sphinx-tabs demo'
62
master_doc = 'index'
73
source_suffix = '.rst'
84
extensions = ['sphinx_tabs.tabs']
9-
105
pygments_style = 'sphinx'

example/index.rst

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
Fruits
2+
========================================
3+
4+
.. tabs::
5+
6+
.. tab:: Apples
7+
8+
Apples are green, or sometimes red.
9+
10+
.. tab:: Pears
11+
12+
Pears are green.
13+
14+
.. tab:: Oranges
15+
16+
Oranges are orange.
17+
18+
Luminaries
19+
========================================
20+
21+
.. tabs::
22+
23+
.. tab:: Sun
24+
25+
The sun is a star.
26+
27+
.. tab:: Moon
28+
29+
The moon is not a star.
30+
31+
Code Tabs
32+
========================================
33+
34+
.. tabs::
35+
36+
.. code-tab:: c
37+
38+
C Main Function
39+
40+
.. code-tab:: c++
41+
42+
C++ Main Function
43+
44+
.. code-tab:: py
45+
46+
Python Main Function
47+
48+
.. code-tab:: java
49+
50+
Java Main Function
51+
52+
.. code-tab:: julia
53+
54+
Julia Main Function
55+
56+
.. code-tab:: fortran
57+
58+
Fortran Main Function
59+
60+
.. tabs::
61+
62+
.. code-tab:: c
63+
64+
int main(const int argc, const char **argv) {
65+
return 0;
66+
}
67+
68+
.. code-tab:: c++
69+
70+
int main(const int argc, const char **argv) {
71+
return 0;
72+
}
73+
74+
.. code-tab:: py
75+
76+
def main():
77+
return
78+
79+
.. code-tab:: java
80+
81+
class Main {
82+
public static void main(String[] args) {
83+
}
84+
}
85+
86+
.. code-tab:: julia
87+
88+
function main()
89+
end
90+
91+
.. code-tab:: fortran
92+
93+
PROGRAM main
94+
END PROGRAM main
95+
96+
Group Tabs
97+
========================================
98+
99+
.. tabs::
100+
101+
.. group-tab:: Linux
102+
103+
Linux Line 1
104+
105+
.. group-tab:: Mac OSX
106+
107+
Mac OSX Line 1
108+
109+
.. group-tab:: Windows
110+
111+
Windows Line 1
112+
113+
.. tabs::
114+
115+
.. group-tab:: Linux
116+
117+
Linux Line 2
118+
119+
.. group-tab:: Mac OSX
120+
121+
Mac OSX Line 2
122+
123+
.. group-tab:: Windows
124+
125+
Windows Line 2

test/basic/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
project = 'sphinx-tabs test'
2+
master_doc = 'index'
3+
source_suffix = '.rst'
4+
extensions = ['sphinx_tabs.tabs']
5+
pygments_style = 'sphinx'

test/basic/index.rst

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
Fruits
2+
========================================
3+
4+
.. tabs::
5+
6+
.. tab:: Apples
7+
8+
Apples are green, or sometimes red.
9+
10+
.. tab:: Pears
11+
12+
Pears are green.
13+
14+
.. tab:: Oranges
15+
16+
Oranges are orange.
17+
18+
Luminaries
19+
========================================
20+
21+
.. tabs::
22+
23+
.. tab:: Sun
24+
25+
The sun is a star.
26+
27+
.. tab:: Moon
28+
29+
The moon is not a star.
30+
31+
Code Tabs
32+
========================================
33+
34+
.. tabs::
35+
36+
.. code-tab:: c
37+
38+
C Main Function
39+
40+
.. code-tab:: c++
41+
42+
C++ Main Function
43+
44+
.. code-tab:: py
45+
46+
Python Main Function
47+
48+
.. code-tab:: java
49+
50+
Java Main Function
51+
52+
.. code-tab:: julia
53+
54+
Julia Main Function
55+
56+
.. code-tab:: fortran
57+
58+
Fortran Main Function
59+
60+
.. tabs::
61+
62+
.. code-tab:: c
63+
64+
int main(const int argc, const char **argv) {
65+
return 0;
66+
}
67+
68+
.. code-tab:: c++
69+
70+
int main(const int argc, const char **argv) {
71+
return 0;
72+
}
73+
74+
.. code-tab:: py
75+
76+
def main():
77+
return
78+
79+
.. code-tab:: java
80+
81+
class Main {
82+
public static void main(String[] args) {
83+
}
84+
}
85+
86+
.. code-tab:: julia
87+
88+
function main()
89+
end
90+
91+
.. code-tab:: fortran
92+
93+
PROGRAM main
94+
END PROGRAM main
95+
96+
Group Tabs
97+
========================================
98+
99+
.. tabs::
100+
101+
.. group-tab:: Linux
102+
103+
Linux Line 1
104+
105+
.. group-tab:: Mac OSX
106+
107+
Mac OSX Line 1
108+
109+
.. group-tab:: Windows
110+
111+
Windows Line 1
112+
113+
.. tabs::
114+
115+
.. group-tab:: Linux
116+
117+
Linux Line 2
118+
119+
.. group-tab:: Mac OSX
120+
121+
Mac OSX Line 2
122+
123+
.. group-tab:: Windows
124+
125+
Windows Line 2

test/conditionalassets/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
project = 'sphinx-tabs test'
2+
master_doc = 'index'
3+
source_suffix = '.rst'
4+
extensions = ['sphinx_tabs.tabs']
5+
pygments_style = 'sphinx'
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/notabs/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
project = 'sphinx-tabs test'
2+
master_doc = 'index'
3+
source_suffix = '.rst'
4+
extensions = ['sphinx_tabs.tabs']
5+
pygments_style = 'sphinx'

test/notabs/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
There are no tabs here...
2+
3+
sphinx-tabs should not add the css/js assets to the build output.

test/run.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -ev
4+
5+
sphinx-build -E -n -W test/basic test-output-basic
6+
sphinx-build -E -n -W test/notabs test-output-notabs
7+
sphinx-build -E -n -W test/conditionalassets test-output-conditionalassets

0 commit comments

Comments
 (0)