実際のリポジトリ上のURL http://svn.openpear.org/HatenaSyntax/trunk/test/lib/HatenaSyntax/Quote.php

repository browser : package HatenaSyntax

revision
1914
author
anatoo
path
/HatenaSyntax/trunk/test/lib/HatenaSyntax
last modified
2010/06/16 09:04:20

Fixed strange assersion.

source

<?php
include_once dirname(__FILE__) . '/../../t.php';

$t = new lime_test;

$p = new HatenaSyntax_Quote(PEG::anything());
$c = PEG::context(array(
    '>>',
    'a',
    '<<'
));

$t->is(
    $p->parse($c),
    array(
        false,
        array('a')
    ));


$c = PEG::context(array(
    '>http://google.com>',
    'a',
    '<<'
));

$result = $p->parse($c);
$t->is($result[1], array('a'));
$t->is($result[0]->at('href'), 'http://google.com');
$t->is($result[0]->at('title'), false);


$c = PEG::context(array(
    '>http://google.com:title>',
    'a',
    '<<'
));

$result = $p->parse($c);
$t->is($result[1], array('a'));
$t->is($result[0]->at('href'), 'http://google.com');
$t->is($result[0]->at('title'), '');


$c = PEG::context(array(
    '>http://google.com:title=hoge>',
    'a',
    '<<'
));

$result = $p->parse($c);
$t->is($result[1], array('a'));
$t->is($result[0]->at('href'), 'http://google.com');
$t->is($result[0]->at('title'), 'hoge');