extern mod std;

#[test]
fn test_tokenize() {
    assert tokenize( ~"(1 2 3)" ) == ~[~"(", ~"1", ~"2", ~"3", ~")"];
}

#[test]
fn test_tokenize_empty() {
    assert tokenize( ~"" ) == ~[];
}

#[test]
fn test_tokenize_no_spaces() {
    assert tokenize( ~"one" ) == ~[~"one"];
}

#[test]
fn test_pad_parentheses() {
    assert pad_parentheses( ~"(1 2 3)" ) == ~" ( 1 2 3 ) "
}

#[test]
fn test_pad_parentheses_empty() {
    assert pad_parentheses( ~"" ) == ~""
}

#[test]
fn test_pad_parentheses_one() {
    assert pad_parentheses( ~"(" ) == ~" ( ";
    assert pad_parentheses( ~")" ) == ~" ) ";
}

fn pad_parentheses( input:&str ) -> ~str {
    str::replace(str::replace(input, ")", " ) "), "(", " ( ")
}

fn tokenize( input:&str ) -> ~[~str] {
    str::words(pad_parentheses(input))
}

enum Expression {
    Value(int),
    Symbol(~str),
    List(~[Expression])
    }

fn main() {
    let Blah:Expression = List(~[Value(1), List(~[Value(1), Symbol(~"xyz")])]);
    io::println( "(begin 1 2)" )
}

extern mod std;

#[test]
fn test_tokenize() {
    assert tokenize( ~"(1 2 3)" ) == ~[~"(", ~"1", ~"2", ~"3", ~")"];
}

#[test]
fn test_tokenize_empty() {
    assert tokenize( ~"" ) == ~[];
}

#[test]
fn test_tokenize_no_spaces() {
    assert tokenize( ~"one" ) == ~[~"one"];
}

#[test]
fn test_addspaces() {
    assert addspaces( ~"(1 2 3)" ) == ~" ( 1 2 3 ) "
}

fn addspaces( input:&str ) -> ~str {
    str::replace(str::replace(input, ")", " ) "), "(", " ( ")
}

fn tokenize( input:&str ) -> ~[~str] {
    str::words(addspaces(input))
}

enum Expression {
    Value(int),
    Symbol(~str),
    List(~[Expression])
    }

fn main() {
    let Blah:Expression = List(~[Value(1), List(~[Value(1), Symbol(~"xyz")])]);
    io::println( "(begin 1 2)" )
}

--- 
+++ 
@@ -16,16 +16,27 @@
 }
 
 #[test]
-fn test_addspaces() {
-    assert addspaces( ~"(1 2 3)" ) == ~" ( 1 2 3 ) "
+fn test_pad_parentheses() {
+    assert pad_parentheses( ~"(1 2 3)" ) == ~" ( 1 2 3 ) "
 }
 
-fn addspaces( input:&str ) -> ~str {
+#[test]
+fn test_pad_parentheses_empty() {
+    assert pad_parentheses( ~"" ) == ~""
+}
+
+#[test]
+fn test_pad_parentheses_one() {
+    assert pad_parentheses( ~"(" ) == ~" ( ";
+    assert pad_parentheses( ~")" ) == ~" ) ";
+}
+
+fn pad_parentheses( input:&str ) -> ~str {
     str::replace(str::replace(input, ")", " ) "), "(", " ( ")
 }
 
 fn tokenize( input:&str ) -> ~[~str] {
-    str::words(addspaces(input))
+    str::words(pad_parentheses(input))
 }
 
 enum Expression {
Rename addspaces to pad_parentheses and add tests
