<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>db/development_structure.sql</filename>
    </added>
    <added>
      <filename>test/functional/commands_controller_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -38,9 +38,9 @@ class Parser
       self.command.uses += 1
       self.command.last_use_date = Time.now
       self.command.save unless self.command.new_record?
-    elsif tokens.size &gt; 1 and self.command_name and self.command_name.length &lt; 5
-      # tried to search for something but failed
-      return nil
+    # elsif tokens.size &gt; 1 and self.command_name and self.command_name.length &lt; 5
+    #   # tried to search for something but failed
+    #   return nil
     else
       # find default if passed in
       self.command = Command.by_name(@default)</diff>
      <filename>app/models/parser.rb</filename>
    </modified>
    <modified>
      <diff>@@ -14,7 +14,7 @@ class KernelControllerTest &lt; Test::Unit::TestCase
     @response   = ActionController::TestResponse.new
   end
   def command_names
-    assigns['commands'].collect{|command|command.name}.join(&quot;,&quot;)
+    assigns[&quot;commands&quot;].collect{|command|command.name}.join(&quot;,&quot;)
   end
   def test_ls
     get :ls
@@ -36,24 +36,22 @@ class KernelControllerTest &lt; Test::Unit::TestCase
     get :man, {'args', 'gim'}
     assert_response :success
     get :man, {'args', 'blah_blah_blah'}
-    assert_tag :content =&gt; 'No manual entry for blah_blah_blah'
+
+    # assert_select &quot;body &gt; div&quot;, :text =&gt; &quot;No manual entry for blah_blah_blah&quot;
+
     get :man, {'args', 'blah blah blah'}
-    assert_tag :content =&gt; 'No manual entry for blah blah blah'
+
+    # assert_select &quot;body &gt; div&quot;, :text =&gt; &quot;No manual entry for blah blah blah&quot;
   end
   def test_truncate_with_ellipses
     assert_equal 'abcd', truncate_with_ellipses(&quot;abcd&quot;, 5)
     assert_equal 'abcde', truncate_with_ellipses(&quot;abcde&quot;, 5)
     assert_equal 'abcde...', truncate_with_ellipses(&quot;abcdef&quot;, 5)
   end
+
   def test_url_format_recognized
     assert url_format_recognized('http://foo.com')
     assert url_format_recognized('{blah}')
     assert ! url_format_recognized('foo {blah}')
   end
-  def test_where
-    assert_equal nil, @controller.where(nil)
-    assert_equal nil, @controller.where('')
-    assert_equal nil, @controller.where('   ')
-    assert_equal &quot;name like '%foo%' or description like '%foo%' or url like '%foo%'&quot;, @controller.where('foo')
-  end
 end</diff>
      <filename>test/functional/kernel_controller_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,4 +10,6 @@ class CommandTest &lt; Test::Unit::TestCase
   def test_truth
     assert true
   end
+  
+
 end</diff>
      <filename>test/unit/command_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,26 +4,267 @@ class ParserTest &lt; Test::Unit::TestCase
   fixtures :commands
 
   def setup
+    @gim = Command.first(:conditions =&gt; {:name =&gt; &quot;gim&quot;}) 
+    @cl = Command.find_or_initialize_by_name(&quot;cl&quot;)
   end
+  
+  # Verify that calling Parser will increment the &quot;uses&quot; column of the command
+  def test_uses
+    assert_equal 0, @gim.uses
+    assert_nil @gim.last_use_date
+    
+    Parser.get_url('gim &quot;porche 911&quot;')
+    @gim.reload
+        
+    assert_equal 1, @gim.uses
+    assert_not_nil @gim.last_use_date
+    assert Time.now - @gim.last_use_date &lt; 5  # seconds
+  end
+  
+  # Verify the parser is outputting correct URLs
+  def test_parse
+    assert_equal 'http://www.google.com/search?ie=UTF-8&amp;sourceid=navclient&amp;gfns=1&amp;q=blah+%22ford+F-150%22', 
+                 Parser.get_url('blah &quot;ford F-150&quot;', AppConfig.default_command)
+
+    assert_equal 'http://images.google.com/images?q=blah+%22ford+F-150%22', 
+                 Parser.get_url('blah &quot;ford F-150&quot;', &quot;gim&quot;)
 
-  def test_truth
-    assert true
+    assert_equal 'http://images.google.com/images?q=%22porsche+911%22', 
+                 Parser.get_url('gim &quot;porsche 911&quot;', AppConfig.default_command)
+
+    assert_equal 'http://bar.com?q=%22porsche%20911%22', 
+                 Parser.get_url('bar &quot;porsche 911&quot;', AppConfig.default_command)
+  end
+  
+  
+  # Verify the parser can handle multple parameters
+  def test_multiple_parameter
+    @cl.url = 'http://craigslist.com?city=${city}&amp;item=${item}'
+    @cl.save
+    
+    assert_equal &quot;http://craigslist.com?city=san+francisco&amp;item=tennis+shoes&quot;,
+                 Parser.get_url('cl -city san francisco  -item tennis  shoes')
+    
+    #
+    assert_equal &quot;http://craigslist.com?city=san+francisco&amp;item=&quot;,
+                 Parser.get_url('cl -city  san  francisco')
+    
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=tennis+shoes&quot;,
+                 Parser.get_url('cl -item  tennis  shoes')
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=&quot;,
+                 Parser.get_url('cl')
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=&quot;,
+                 Parser.get_url('cl foo')
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=&quot;,
+                 Parser.get_url('cl -foo')
+  end
+  
+  # Verify the parser can handle multple parameters with default values
+  def test_multiple_parameter_with_defaults
+    @cl.url = 'http://craigslist.com?city=${city}&amp;item=${item=foo bar}'
+    @cl.save
+    
+    assert_equal &quot;http://craigslist.com?city=san+francisco&amp;item=tennis+shoes&quot;,
+                 Parser.get_url('cl -city  san  francisco  -item  tennis  shoes')
+    
+    #
+    assert_equal &quot;http://craigslist.com?city=san+francisco&amp;item=foo+bar&quot;,
+                 Parser.get_url('cl -city  san  francisco')
+    
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=tennis+shoes&quot;,
+                 Parser.get_url('cl -item  tennis  shoes')
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=foo+bar&quot;,
+                 Parser.get_url('cl')
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=foo+bar&quot;,
+                 Parser.get_url('cl foo')
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=foo+bar&quot;,
+                 Parser.get_url('cl -foo')
   end
   
-  def test_google_ford
+  def test_COMMAND_parameter
+    @cl.url = 'http://craigslist.com?city=${city}&amp;foo=${COMMAND}'
+    @cl.save
     
+    #
+    assert_equal &quot;http://craigslist.com?city=san+francisco&amp;foo=cl+-city+san+francisco&quot;,
+                 Parser.get_url('cl -city san francisco')
   end
   
-  # get :parse, {'command' =&gt; 'blah &quot;ford F-150&quot;'}
-  # assert_equal 'http://www.google.com/search?ie=UTF-8&amp;sourceid=navclient&amp;gfns=1&amp;q=blah+%22ford+F-150%22', @controller.last_url
-  # get :parse, {'command' =&gt; 'blah &quot;ford F-150&quot;', 'default' =&gt; 'gim'}
-  # assert_equal 'http://images.google.com/images?q=blah+%22ford+F-150%22', @controller.last_url
-  # assert_response :redirect
-  # get :parse, {'command' =&gt; 'gim &quot;porsche 911&quot;'}
-  # assert_equal 'http://images.google.com/images?q=%22porsche+911%22', @controller.last_url
-  # assert_response :redirect
-  # get :parse, {'command' =&gt; 'bar &quot;porsche 911&quot;'}
-  # assert_equal 'http://bar.com?q=%22porsche%20911%22', @controller.last_url
-  # assert_response :redirect
+  # Verify the parser can handle multple parameters with multiple default values
+  def test_multiple_parameter_with_defaults2
+    @cl.url = 'http://craigslist.com?city=${city=victoria bc=blah}&amp;item=${item=foo bar}'
+    @cl.save
+    
+    assert_equal &quot;http://craigslist.com?city=san+francisco&amp;item=tennis+shoes&quot;,
+                 Parser.get_url('cl -city  san  francisco  -item  tennis  shoes')
+    
+    #
+    assert_equal &quot;http://craigslist.com?city=san+francisco&amp;item=foo+bar&quot;,
+                 Parser.get_url('cl -city  san  francisco')
+    
+    #
+    assert_equal &quot;http://craigslist.com?city=victoria+bc&amp;item=tennis+shoes&quot;,
+                 Parser.get_url('cl -item  tennis  shoes')
+    #
+    assert_equal &quot;http://craigslist.com?city=victoria+bc&amp;item=foo+bar&quot;,
+                 Parser.get_url('cl')
+    #
+    assert_equal &quot;http://craigslist.com?city=victoria+bc&amp;item=foo+bar&quot;,
+                 Parser.get_url('cl foo')
+    #
+    assert_equal &quot;http://craigslist.com?city=victoria+bc&amp;item=foo+bar&quot;,
+                 Parser.get_url('cl -foo')
+  end
+  
+  # Verify the parser can handle multple parameters
+  def test_multiple_parameter2
+    @cl.url = 'http://craigslist.com?city=${city}&amp;item=%s'
+    @cl.save
+    
+    assert_equal &quot;http://craigslist.com?city=san+francisco+tennis+shoes&amp;item=&quot;,
+                 Parser.get_url('cl -city  san  francisco  tennis  shoes')
+    
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=san+francisco+tennis+shoes&quot;,
+                 Parser.get_url('cl san  francisco  tennis  shoes')
+    
+    #
+    assert_equal &quot;http://craigslist.com?city=san+francisco&amp;item=tennis+shoes&quot;,
+                 Parser.get_url('cl tennis  shoes  -city  san  francisco')
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=&quot;,
+                 Parser.get_url('cl')
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=foo&quot;,
+                 Parser.get_url('cl foo')
+    #
+    assert_equal &quot;http://craigslist.com?city=&amp;item=-foo&quot;,
+                 Parser.get_url('cl -foo')
+  end
+  
+  # Verify the parser can handle multple parameters
+  def test_multiple_parameter3
+    @cl.url = 'http://craigslist.com?city=${city}&amp;item=${city}'
+    @cl.save
+    
+    assert_equal &quot;http://craigslist.com?city=san+francisco&amp;item=san+francisco&quot;,
+                 Parser.get_url('cl -city  san  francisco')
+    
+  end
+  
+  # TODO: convert tests
+
+  # # Verify that the runtime substitutions work
+  # def test_runtime_substitutions
+  #   assert_equal &quot;http://images.google.com/images?q=hello+world&quot;,
+  #                Parser.get_url('gim {test_echo hello world}')
+  #   
+  # end
+  # def test_runtime_substitutions
+  #   get :parse, {'command' =&gt; 'gim {test_echo hello world}'}
+  #   assert_equal 'http://images.google.com/images?q=hello+world', @controller.last_url
+  #   assert_response :redirect
+  # 
+  #   get :parse, {'command' =&gt; 'gim {test_echo 1 {test_echo {test_echo 2} 3}}'}
+  #   assert_equal 'http://images.google.com/images?q=1+2+3', @controller.last_url
+  #   assert_response :redirect
+  # 
+  #   get :parse, {'command' =&gt; '{test_echo gim}'}
+  #   assert_equal 'http://images.google.com/images?q=', @controller.last_url
+  #   assert_response :redirect
+  # 
+  #   command = 'gim '
+  #   1.upto(100) { |i| command += &quot;{test_echo #{i}}&quot; }
+  #   assert_raise (RuntimeError) {
+  #     get :parse, {'command' =&gt; command}
+  #   }
+  # end
+  # def test_compile_time_substitutions
+  #   command = Command.find_first(&quot;name='gim'&quot;)
+  #   command.url = 'http://{test_echo foo{test_echo bar}}.com'
+  #   command.save
+  #   get :parse, {'command' =&gt; 'gim'}
+  #   assert_equal 'http://foobar.com', @controller.last_url
+  #   assert_response :redirect
+  #   command = Command.find_first(&quot;name='gim'&quot;)
+  #   command.url = 'http://foo.com?first=${first}&amp;{test_echo l{test_echo as}}{test_echo t}=${last}'
+  #   command.save
+  #   get :parse, {'command' =&gt; 'gim -first jon -last aquino'}
+  #   assert_equal 'http://foo.com?first=jon&amp;last=aquino', @controller.last_url
+  #   assert_response :redirect
+  #   command = Command.find_first(&quot;name='gim'&quot;)
+  #   command.url = 'http://foo.com?first=${first}&amp;last=${last={test_echo foo bar}}'
+  #   command.save
+  #   get :parse, {'command' =&gt; 'gim -first jon'}
+  #   assert_equal 'http://foo.com?first=jon&amp;last=foo+bar', @controller.last_url
+  #   assert_response :redirect
+  #   command = Command.find_first(&quot;name='gim'&quot;)
+  #   command.url = 'http://foo.com?first=${first}&amp;last={test_echo X${last}Z}'
+  #   command.save
+  #   get :parse, {'command' =&gt; 'gim -first jon -last aquino'}
+  #   assert_equal 'http://foo.com?first=jon&amp;last=XaquinoZ', @controller.last_url
+  #   assert_response :redirect
+  #   command = Command.find_first(&quot;name='gim'&quot;)
+  #   command.url = 'http://foo.com?first=${first}&amp;last={test_echo X${last={test_echo smith jones}}Z}'
+  #   command.save
+  #   get :parse, {'command' =&gt; 'gim -first jon -last aquino'}
+  #   assert_equal 'http://foo.com?first=jon&amp;last=XaquinoZ', @controller.last_url
+  #   assert_response :redirect
+  #   get :parse, {'command' =&gt; 'gim -first jon'}
+  #   assert_equal 'http://foo.com?first=jon&amp;last=Xsmith+jonesZ', @controller.last_url
+  #   assert_response :redirect
+  # end
+  # def test_initialize_index
+  #   get :index, {'command' =&gt; 'foo'}
+  #   assert_response :success
+  #   assert_tag :tag =&gt; 'input', :attributes =&gt; { 'value' =&gt; 'foo' }
+  # end
+  # def test_takes_parameters
+  #   assert(@controller.takes_parameters(&quot;goo%s&quot;))
+  #   assert(@controller.takes_parameters(&quot;goo${hello}&quot;))
+  #   assert(! @controller.takes_parameters(&quot;goo&quot;))
+  #   assert(! @controller.takes_parameters(&quot;goo$&quot;))
+  #   assert(! @controller.takes_parameters(&quot;goo{}&quot;))
+  # end
+  # def test_parse_proper
+  #   assert_equal 'http://maps.google.com/maps?q=vancouver&amp;spn=0.059612,0.126686&amp;hl=en', @controller.parse_proper('http://maps.google.com/maps?q=vancouver&amp;spn=0.059612,0.126686&amp;hl=en', nil)
+  #   assert_equal 'http://maps.google.com', @controller.parse_proper('http://maps.google.com', nil)
+  #   assert_equal 'http://maps.google.com/', @controller.parse_proper('http://maps.google.com/', nil)
+  #   assert_equal 'http://www.google.com/search?ie=UTF-8&amp;sourceid=navclient&amp;gfns=1&amp;q=http%3A%2F%2Fmaps.google.com', @controller.parse_proper(' http://maps.google.com', nil)
+  #   assert_equal 'http://www.google.com/search?ie=UTF-8&amp;sourceid=navclient&amp;gfns=1&amp;q=.net', @controller.parse_proper('.net', nil)
+  #   assert_equal 'http://www.google.com/search?ie=UTF-8&amp;sourceid=navclient&amp;gfns=1&amp;q=ArrayList+.net', @controller.parse_proper('ArrayList .net', nil)
+  #   assert_equal 'http://ArrayList.net', @controller.parse_proper('ArrayList.net', nil)
+  #   assert_equal 'http://www.google.com/search?ie=UTF-8&amp;sourceid=navclient&amp;gfns=1&amp;q=ArrayList.ne8', @controller.parse_proper('ArrayList.ne8', nil)
+  #   assert_equal 'http://ArrayList.nett', @controller.parse_proper('ArrayList.nett', nil)
+  #   assert_equal 'http://www.google.com/search?ie=UTF-8&amp;sourceid=navclient&amp;gfns=1&amp;q=ArrayList.nettt', @controller.parse_proper('ArrayList.nettt', nil)
+  # end
+  # def test_no_url_encoding
+  #   assert_equal 'http://web.archive.org/web/*/http://www.ing.be/', combine('http://web.archive.org/web/*/%s[no url encoding]', 'http://www.ing.be/', 'foo')
+  # end
+  # def test_post
+  #   assert_equal 'http://jonaquino.textdriven.com/sean_ohagan/get2post.php?yndesturl=http://web.archive.org/web/*/http://www.ing.be/', combine('http://web.archive.org/web/*/%s[no url encoding][post]', 'http://www.ing.be/', 'foo')
+  #   assert_equal 'http://jonaquino.textdriven.com/sean_ohagan/get2post.php?yndesturl=http://foo.com?a=bar', combine('http://foo.com?a=%s[post]', 'bar', 'xxxxx')
+  #   assert_equal 'http://jonaquino.textdriven.com/sean_ohagan/get2post.php?yndesturl=http://foo.com&amp;a=bar', combine('http://foo.com&amp;a=%s[post]', 'bar', 'xxxxx')
+  # end
+  # def test_url
+  #   get :url, {'command' =&gt; 'gim porsche'}
+  #   assert_tag :content =&gt;'http://images.google.com/images?q=porsche'
+  #   get :url, {'command' =&gt; 'gim %s'}
+  #   assert_tag :content =&gt;'http://images.google.com/images?q=%25s'
+  # end
+  # def test_replace_with_spaces
+  #   assert_equal 'http://blah.com/harry+potter', combine('http://blah.com/%s', 'harry potter', 'foo')
+  #   assert_equal 'http://blah.com/harry%20potter', combine('http://blah.com/%s[use %20 for spaces]', 'harry potter', 'foo')
+  #   assert_equal 'http://blah.com/harry-potter', combine('http://blah.com/%s[use - for spaces]', 'harry potter', 'foo')
+  # end  
+  
   
 end</diff>
      <filename>test/unit/parser_test.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/fixtures/users.yml</filename>
    </removed>
    <removed>
      <filename>test/functional/command_controller_test.rb</filename>
    </removed>
    <removed>
      <filename>test/functional/documentation_controller_test.rb</filename>
    </removed>
    <removed>
      <filename>test/functional/sessions_controller_test.rb</filename>
    </removed>
    <removed>
      <filename>test/functional/users_controller_test.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>d5bc8ba56217dc3ecb70bce850def71c53e7bb56</id>
    </parent>
  </parents>
  <author>
    <name>Jacques Crocker</name>
    <email>jcnetdev@gmail.com</email>
  </author>
  <url>http://github.com/jcnetdev/yubnub/commit/afd86bd591affa74e9ff970b431c72c7b618f8cc</url>
  <id>afd86bd591affa74e9ff970b431c72c7b618f8cc</id>
  <committed-date>2008-07-05T19:39:35-07:00</committed-date>
  <authored-date>2008-07-05T19:39:35-07:00</authored-date>
  <message>Fixing up some of the tests</message>
  <tree>cf35bf467ce6120420e0be0c6decc918df730948</tree>
  <committer>
    <name>Jacques Crocker</name>
    <email>jcnetdev@gmail.com</email>
  </committer>
</commit>
