diff options
| author | Joshua Peek <josh@joshpeek.com> | 2012-07-24 11:51:54 -0500 |
|---|---|---|
| committer | Joshua Peek <josh@joshpeek.com> | 2012-07-24 11:51:54 -0500 |
| commit | 4a06d2ea7ed28c55879be8a2894ff2b07ab5808e (patch) | |
| tree | a35674484c0bc2c721423e57fedc591b5294e10e /test | |
| parent | ade20e4b46e7699d9646df573e3503756b880fc7 (diff) | |
| parent | 22efcf7affc349269388dafe3f186416c06e0903 (diff) | |
Merge branch 'jeanSapristi-master'
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_language.rb | 3 | ||||
| -rw-r--r-- | test/test_tokenizer.rb | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/test/test_language.rb b/test/test_language.rb index 1ca7116..f94acf3 100644 --- a/test/test_language.rb +++ b/test/test_language.rb @@ -165,7 +165,7 @@ class TestLanguage < Test::Unit::TestCase assert_equal 'ruby', Language['Ruby'].search_term assert_equal 'common-lisp', Language['Common Lisp'].search_term assert_equal 'html+erb', Language['HTML+ERB'].search_term - assert_equal 'max/msp', Language['Max/MSP'].search_term + assert_equal 'max/msp', Language['Max'].search_term assert_equal 'puppet', Language['Puppet'].search_term assert_equal 'pure-data', Language['Pure Data'].search_term @@ -310,7 +310,6 @@ class TestLanguage < Test::Unit::TestCase assert_equal 'C%2B%2B', Language['C++'].escaped_name assert_equal 'Objective-C', Language['Objective-C'].escaped_name assert_equal 'Common%20Lisp', Language['Common Lisp'].escaped_name - assert_equal 'Max%2FMSP', Language['Max/MSP'].escaped_name end def test_error_without_name diff --git a/test/test_tokenizer.rb b/test/test_tokenizer.rb index 644a2c3..d57726c 100644 --- a/test/test_tokenizer.rb +++ b/test/test_tokenizer.rb @@ -20,12 +20,17 @@ class TestTokenizer < Test::Unit::TestCase assert_equal %w(print), tokenize("print 'Josh'") assert_equal %w(print), tokenize('print "Hello \"Josh\""') assert_equal %w(print), tokenize("print 'Hello \\'Josh\\''") + assert_equal %w(print), tokenize("print \"Hello\", \"Josh\"") + assert_equal %w(print), tokenize("print 'Hello', 'Josh'") + assert_equal %w(print), tokenize("print \"Hello\", \"\", \"Josh\"") + assert_equal %w(print), tokenize("print 'Hello', '', 'Josh'") end def test_skip_number_literals assert_equal %w(+), tokenize('1 + 1') assert_equal %w(add \( \)), tokenize('add(123, 456)') assert_equal %w(|), tokenize('0x01 | 0x10') + assert_equal %w(*), tokenize('500.42 * 1.0') end def test_skip_comments @@ -77,13 +82,17 @@ class TestTokenizer < Test::Unit::TestCase def test_objective_c_tokens assert_equal %w(#import <Foundation/Foundation.h> @interface Foo NSObject { } @end), tokenize(:"Objective-C/Foo.h") assert_equal %w(#import @implementation Foo @end), tokenize(:"Objective-C/Foo.m") - assert_equal %w(#import <Cocoa/Cocoa.h> int main \( int argc char *argv \) { NSLog \( @ \) ; return ; }), tokenize(:"Objective-C/hello.m") + assert_equal %w(#import <Cocoa/Cocoa.h> int main \( int argc char *argv [ ] \) { NSLog \( @ \) ; return ; }), tokenize(:"Objective-C/hello.m") end def test_javascript_tokens assert_equal %w( \( function \( \) { console.log \( \) ; } \) .call \( this \) ;), tokenize(:"JavaScript/hello.js") end + def test_json_tokens + assert_equal %w( { [ ] { } } ), tokenize(:"JSON/product.json") + end + def test_ruby_tokens assert_equal %w(module Foo end), tokenize(:"Ruby/foo.rb") assert_equal %w(# /usr/bin/env ruby puts), tokenize(:"Ruby/script.rb") |
