root/branches/release-40/t/49-tagsplit.t @ 2562

Revision 2562, 0.7 kB (checked in by bchoate, 18 months ago)

Test suite cleanup. Use MT::Test to force t/ based configuration file for all tests. Fixed several tests that had incorrect expected values.

  • Property svn:keywords set to Id Revision
Line 
1#!/usr/bin/perl
2use strict;
3use warnings;
4use lib 't/lib', 'extlib', 'lib', '../lib', '../extlib';
5use Test::More;
6use MT::Test;
7use JSON qw(jsonToObj);
8use MT::Tag;
9
10my $file = '<t/49-tagsplit.dat';
11open TEST, $file or die "Can't open $file: $!";
12local $/ = undef;
13my $test_data = <TEST>;
14close TEST;
15my $tests = jsonToObj($test_data);
16plan tests => scalar(keys %$tests) * 2;
17
18foreach my $delim (',', ' ') {
19    foreach my $test (sort keys %$tests) {
20        my @tags = MT::Tag->split($delim, $test);
21        my %tags = map { $_ => 1 } @tags;
22        is(scalar keys %tags, $tests->{$test}{$delim},
23            "$test ($delim): $tests->{$test}{$delim} tags");
24    }
25}
Note: See TracBrowser for help on using the browser.