-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add some tests and bench generate site
- Loading branch information
Showing
18 changed files
with
172 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,6 +210,8 @@ nav { | |
.middle { | ||
width: 50%; | ||
text-align: center; | ||
} | ||
nav .middle { | ||
margin-top: 10px; | ||
} | ||
.right { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<rss version="2.0"><channel><title>Ø value</title><description></description><link>http://localhost</link><lastBuildDate>13 Jul 13 23:02 -0400</lastBuildDate><generator>trofaf</generator><item><title>Ce blogue a déménagé sur GitHub</title><link>http://localhost/010-demenagement</link><description>Suite à l'annonce de la fermeture de Calepin.co, j'ai déménagé ce blogue sur http://hypermegatop.github.com. Veuillez mettre à jour vos favoris!</description><author>Martin Angers</author><category></category><pubDate>30 Apr 12 00:00 +0000</pubDate></item><item><title>Je suis venu te dire que je m'en vais</title><link>http://localhost/009-je-men-vais</link><description>Ou plutôt, "je suis venu te dire qu'on m'évince", mais ça "punch" moins... En effet, mon coup de foudre pour le blogiciel Calepin aura finalement été son baiser de la mort. Sur Twitter la semaine dernière, via le canal officiel du site, on apprenait que c'était la fin des haricots.</description><author>Martin Angers</author><category></category><pubDate>23 Apr 12 00:00 +0000</pubDate></item><item><title>Propriétés calculées avec Backbone</title><link>http://localhost/008-backbone-computed-properties</link><description>La beauté de l'univers du code libre est que lorsqu'il manque une fonctionnalité, on peut se retrousser les manches, ouvrir le code et l'ajouter. Voici ma petite histoire des propriétés calculées avec Backbone.</description><author>Martin Angers</author><category></category><pubDate>13 Apr 12 00:00 +0000</pubDate></item><item><title>implement.js: typage fort et Javascript</title><link>http://localhost/007-implement-js</link><description>L'injection de dépendance avec Javascript a comme conséquence de ne pouvoir assumer que les fonctionnalités offertes par l'instance reçue seront celles attendues.</description><author>Martin Angers</author><category></category><pubDate>02 Apr 12 00:00 +0000</pubDate></item><item><title>Expérimentations sur l'injection de dépendance avec node.js</title><link>http://localhost/006-dependency-injection</link><description>L'injection de dépendance permet de découpler les différentes composantes d'une application pour en faciliter l'entretien, la testabilité, circonscrire l'impact des changements, mais aussi pour imposer une façon d'aborder la création de l'application en une aggrégation de pièces simples, à la responsabilité ciblée, et à l'API bien défini.</description><author>Martin Angers</author><category></category><pubDate>27 Mar 12 00:00 +0000</pubDate></item></channel></rss> | ||
<rss version="2.0"><channel><title></title><description></description><link></link><lastBuildDate>14 Jul 13 19:43 -0400</lastBuildDate><generator>trofaf</generator><item><title>Ce blogue a déménagé sur GitHub</title><link>/010-demenagement</link><description>Suite à l'annonce de la fermeture de Calepin.co, j'ai déménagé ce blogue sur http://hypermegatop.github.com. Veuillez mettre à jour vos favoris!</description><author>Martin Angers</author><category></category><pubDate>30 Apr 12 00:00 +0000</pubDate></item><item><title>Je suis venu te dire que je m'en vais</title><link>/009-je-men-vais</link><description>Ou plutôt, "je suis venu te dire qu'on m'évince", mais ça "punch" moins... En effet, mon coup de foudre pour le blogiciel Calepin aura finalement été son baiser de la mort. Sur Twitter la semaine dernière, via le canal officiel du site, on apprenait que c'était la fin des haricots.</description><author>Martin Angers</author><category></category><pubDate>23 Apr 12 00:00 +0000</pubDate></item><item><title>Propriétés calculées avec Backbone</title><link>/008-backbone-computed-properties</link><description>La beauté de l'univers du code libre est que lorsqu'il manque une fonctionnalité, on peut se retrousser les manches, ouvrir le code et l'ajouter. Voici ma petite histoire des propriétés calculées avec Backbone.</description><author>Martin Angers</author><category></category><pubDate>13 Apr 12 00:00 +0000</pubDate></item><item><title>implement.js: typage fort et Javascript</title><link>/007-implement-js</link><description>L'injection de dépendance avec Javascript a comme conséquence de ne pouvoir assumer que les fonctionnalités offertes par l'instance reçue seront celles attendues.</description><author>Martin Angers</author><category></category><pubDate>02 Apr 12 00:00 +0000</pubDate></item><item><title>Expérimentations sur l'injection de dépendance avec node.js</title><link>/006-dependency-injection</link><description>L'injection de dépendance permet de découpler les différentes composantes d'une application pour en faciliter l'entretien, la testabilité, circonscrire l'impact des changements, mais aussi pour imposer une façon d'aborder la création de l'application en une aggrégation de pièces simples, à la responsabilité ciblée, et à l'API bien défini.</description><author>Martin Angers</author><category></category><pubDate>27 Mar 12 00:00 +0000</pubDate></item></channel></rss> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
extends layout | ||
|
||
block content | ||
if Post.ShortPost.Lang | ||
article[lang=Post.ShortPost.Lang] | ||
#{unescaped(Post.Content)} | ||
else | ||
article | ||
#{unescaped(Post.Content)} | ||
article | ||
[lang=Post.ShortPost.Lang] ? len(Post.ShortPost.Lang) > 0 | ||
| #{unescaped(Post.Content)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"io/ioutil" | ||
"log" | ||
"sort" | ||
"testing" | ||
"time" | ||
) | ||
|
||
func mustParse(s string) time.Time { | ||
t, err := time.Parse("2006-01-02", s) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return t | ||
} | ||
|
||
func TestSort(t *testing.T) { | ||
ps := make(sortableLongPost, 5) | ||
ps[0] = &LongPost{ | ||
ShortPost: &ShortPost{ | ||
Title: "a", | ||
PubTime: mustParse("2012-01-07"), | ||
}, | ||
} | ||
ps[1] = &LongPost{ | ||
ShortPost: &ShortPost{ | ||
Title: "b", | ||
PubTime: mustParse("2012-04-22"), | ||
}, | ||
} | ||
ps[2] = &LongPost{ | ||
ShortPost: &ShortPost{ | ||
Title: "c", | ||
PubTime: mustParse("2012-01-01"), | ||
}, | ||
} | ||
ps[3] = &LongPost{ | ||
ShortPost: &ShortPost{ | ||
Title: "d", | ||
PubTime: mustParse("2011-11-30"), | ||
}, | ||
} | ||
ps[4] = &LongPost{ | ||
ShortPost: &ShortPost{ | ||
Title: "e", | ||
PubTime: mustParse("2012-12-01"), | ||
}, | ||
} | ||
sort.Sort(ps) | ||
|
||
buf := bytes.NewBuffer(nil) | ||
for _, p := range ps { | ||
buf.WriteString(p.Title) | ||
} | ||
if buf.String() != "dcabe" { | ||
t.Errorf("expected 'dcabe', got %s", buf.String()) | ||
} | ||
} | ||
|
||
func BenchmarkGenerateSite(b *testing.B) { | ||
b.StopTimer() | ||
log.SetOutput(ioutil.Discard) | ||
Options.RecentPostsCount = 5 | ||
PublicDir = "./example/public" | ||
PostsDir = "./example/posts" | ||
TemplatesDir = "./example/templates" | ||
b.StartTimer() | ||
|
||
for i := 0; i < b.N; i++ { | ||
err := generateSite() | ||
if err != nil { | ||
b.Fatal(err) | ||
} | ||
} | ||
} |
Oops, something went wrong.