Skip to content

Commit 1b0db27

Browse files
committed
[mix-messy-docs] Add simple tests
1 parent df7f6e5 commit 1b0db27

File tree

3 files changed

+118
-2
lines changed

3 files changed

+118
-2
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Empty commit
6+
id: start
7+
- type: new-file
8+
filename: conflict.txt
9+
contents: |
10+
Hello world
11+
- type: add
12+
files:
13+
- conflict.txt
14+
- type: commit
15+
message: Expected branch point
16+
- type: tag
17+
tag-name: v1.0
18+
19+
- type: branch
20+
branch-name: feature-search
21+
- type: edit-file
22+
filename: conflict.txt
23+
contents: |
24+
Hello world!
25+
- type: add
26+
files:
27+
- conflict.txt
28+
- type: commit
29+
message: Feature search changes
30+
- type: checkout
31+
branch-name: main
32+
33+
- type: branch
34+
branch-name: feature-delete
35+
- type: edit-file
36+
filename: conflict.txt
37+
contents: |
38+
Hello world?
39+
- type: add
40+
files:
41+
- conflict.txt
42+
- type: commit
43+
message: Feature delete changes
44+
- type: checkout
45+
branch-name: main
46+
47+
- type: branch
48+
branch-name: feature-list
49+
- type: commit
50+
empty: true
51+
message: Feature list changes
52+
53+
- type: checkout
54+
branch-name: main
55+
- type: branch
56+
branch-name: development
57+
- type: commit
58+
empty: true
59+
message: Commit on development
60+
- type: merge
61+
branch-name: feature-search
62+
no-ff: true
63+
- type: bash
64+
runs: |
65+
# Controlling everything through Bash to simplify workflow
66+
(git merge feature-delete || true) > /dev/null
67+
echo 'New contents' > conflict.txt
68+
git add conflict.txt
69+
(git commit --no-edit) > /dev/null
70+
71+
- type: new-file
72+
filename: features.md
73+
contents: |
74+
# Features
75+
76+
## Create Book
77+
78+
Allows creating one book at a time.
79+
80+
## Searching for Books
81+
82+
Allows searching for books by keywords.
83+
Works only for book titles.
84+
85+
## Deleting Books
86+
87+
Allows deleting books.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Empty commit
6+
id: start
7+
- type: branch
8+
branch-name: development
9+
- type: commit
10+
empty: true
11+
message: Commit on development
12+
- type: checkout
13+
branch-name: main
14+
- type: commit
15+
empty: true
16+
message: Expected branch point
17+
- type: tag
18+
tag-name: v1.0
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from git_autograder import GitAutograderTestLoader
1+
from git_autograder import GitAutograderStatus, GitAutograderTestLoader
2+
from git_autograder.test_utils import assert_output
23

3-
from ..verify import verify
4+
from ..verify import WRONG_BRANCH_POINT, verify
45

56
REPOSITORY_NAME = "mix-messy-docs"
67

@@ -10,3 +11,13 @@
1011
def test_base():
1112
with loader.load("specs/base.yml", "start"):
1213
pass
14+
15+
16+
def test_wrong_branch_point():
17+
with loader.load("specs/wrong_branch_point.yml") as output:
18+
assert_output(output, GitAutograderStatus.UNSUCCESSFUL, [WRONG_BRANCH_POINT])
19+
20+
21+
def test_right_order():
22+
with loader.load("specs/right_order.yml") as output:
23+
assert_output(output, GitAutograderStatus.SUCCESSFUL)

0 commit comments

Comments
 (0)