Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Advanced tests #390

Merged
merged 2 commits into from

2 participants

@jnavila
Collaborator

Add tests to check that:

  • the titles are correctly formatted
  • the declarations for figure inclusion are not outnumbering the actual figure number
@jnavila jnavila Check that titles are correctly formatted
In Markdown, the sharps at the end of the title line can be elided
but they may not be followed by spaces. Otherwise, the sharps are
rendered in the title.
b8b947d
@GArik

Looks good :)

@jnavila jnavila Check the number of declared figures in each chapter
If the number of declared figures is greater that the number of available
figures, processing errors occur while converting to html or pdf. The error
messages are not obvious, so it is safer to catch the mistake before.
4fca7ca
@jnavila jnavila merged commit 88d28ac into master
@jnavila jnavila deleted the advanced_tests branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2013
  1. @jnavila

    Check that titles are correctly formatted

    jnavila authored
    In Markdown, the sharps at the end of the title line can be elided
    but they may not be followed by spaces. Otherwise, the sharps are
    rendered in the title.
Commits on Mar 27, 2013
  1. @jnavila

    Check the number of declared figures in each chapter

    jnavila authored
    If the number of declared figures is greater that the number of available
    figures, processing errors occur while converting to html or pdf. The error
    messages are not obvious, so it is safer to catch the mistake before.
This page is out of date. Refresh to see the latest.
Showing with 34 additions and 1 deletion.
  1. +33 −0 Rakefile
  2. +1 −1  ko/07-customizing-git/01-chapter7.markdown
View
33 Rakefile
@@ -176,6 +176,16 @@ namespace :ci do
langs -= excluded_langs
end
error_code = false
+ chapter_figure = {
+ "01-introduction" => 7,
+ "02-git-basics" => 2,
+ "03-git-branching" => 39,
+ "04-git-server" => 15,
+ "05-distributed-git" => 27,
+ "06-git-tools" => 1,
+ "07-customizing-git" => 3,
+ "08-git-and-other-scms" => 0,
+ "09-git-internals" => 4}
langs.each do |lang|
print "processing #{lang} "
mark = ''
@@ -184,6 +194,29 @@ namespace :ci do
mk_file = File.open(mk_filename, 'r') do |mk|
mark+= mk.read.encode("UTF-8")
end
+ src_file = File.open(mk_filename, 'r')
+ figure_count = 0
+ until src_file.eof?
+ line = src_file.readline
+ matches = line.match /^#/
+ if matches
+ if line.match /^(#+).*#[[:blank:]]+$/
+ print "\nBadly formatted title in #{mk_filename}: #{line}\n"
+ error_code = true
+ end
+ end
+ if line.match /^\s*Insert\s(.*)/
+ figure_count = figure_count + 1
+ end
+ end
+ # This extraction is a bit contorted, because the pl translation renamed
+ # the files, so the match is done on the directories.
+ tab_fig_count = chapter_figure[File.basename(File.dirname(mk_filename))]
+ expected_figure_count = tab_fig_count ? tab_fig_count:0
+ if figure_count > expected_figure_count
+ print "\nToo many figures declared in #{mk_filename}\n"
+ error_code = true
+ end
end
begin
code = Maruku.new(mark, :on_error => :raise)
View
2  ko/07-customizing-git/01-chapter7.markdown
@@ -557,7 +557,7 @@ Git도 다른 버전 관리 시스템처럼 어떤 이벤트가 생겼을 때
클라이언트 훅은 매우 다양하다. 이 절에서는 클라이언트 훅을 커밋 Workflow 훅, E-mail Workflow 훅, 그리고 나머지로 분류해서 설명한다.
-#### 커밋 Workflow 훅 ####
+#### 커밋 Workflow 훅 ####
먼저 커밋과 관련된 훅을 살펴보자. 커밋과 관련된 훅은 모두 네 가지다. `pre-commit` 훅은 커밋할 때 가장 먼저 호출되는 훅으로 커밋 메시지를 작성하기 전에 호출된다. 이 훅에서 커밋하는 Snapshot을 점검한다. 빠트린 것은 없는지, 테스트는 확실히 했는지 등을 검사한다. 커밋할 때 꼭 확인해야 할 게 있으면 이 훅으로 확인한다. 그리고 이 훅의 Exit 코드가 0이 아니면 커밋은 취소된다. 물론 `git commit --no-verify`라고 실행하면 이 훅을 일시적으로 생략할 수 있다. lint 같은 프로그램으로 코드 스타일을 검사하거나, 줄 끝의 공백 문자를 검사하거나(예제로 들어 있는 `pre-commit` 훅이 하는 게 이 일이다), 코드에 주석을 달았는지 검사하는 일은 이 훅으로 하는 것이 좋다.
Something went wrong with that request. Please try again.