From a4eb4738d7f8abdb088a389bec91846b65c28eb8 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Thu, 28 Jul 2011 11:24:30 -0700 Subject: [PATCH] Detect Parrot assembly and bytecode individually, and add some tests --- lib/linguist/languages.yml | 18 ++++++++++++++++-- test/fixtures/hello.pasm | 5 +++++ test/fixtures/hello.pbc | Bin 0 -> 912 bytes test/fixtures/hello.pir | 5 +++++ test/test_blob.rb | 6 ++++++ 5 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/hello.pasm create mode 100644 test/fixtures/hello.pbc create mode 100644 test/fixtures/hello.pir diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index cb7033de..d3dffa66 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -643,16 +643,30 @@ PHP: - .phpt Parrot Internal Representation: + type: programming lexer: Text only search_term: pir aliases: - pir primary_extension: .pir extensions: - - .pasm - - .pbc - .pir +Parrot Assembly: + type: programming + lexer: Text only + search_term: pasm + primary_extension: .pasm + extensions: + - .pasm + +Parrot Bytecode: + type: data + search_term: pbc + primary_extension: .pbc + extensions: + - .pbc + Perl: type: programming overrides: diff --git a/test/fixtures/hello.pasm b/test/fixtures/hello.pasm new file mode 100644 index 00000000..6f2efaac --- /dev/null +++ b/test/fixtures/hello.pasm @@ -0,0 +1,5 @@ +#!/usr/bin/env parrot + +.pcc_sub :main main: + say "Hello!" + end diff --git a/test/fixtures/hello.pbc b/test/fixtures/hello.pbc new file mode 100644 index 0000000000000000000000000000000000000000..b30393e107e3c7e54fc67da849e61b61bc40fdbf GIT binary patch literal 912 zcmaiyy9&ZU5JlG~8nF?yu(Poezre;s!Ab?wScM=$6g46GQGTT_yr&rnZgX;H=FZOU z=CSsJw%7L>&Qzt*j^j$#?YOZ^L=8n$4qRe>$b(?2vyGL*;v7Sp@il z)p8R~m!b7fR5%i=7{#vmyMHwE-?>D2PXx?^hW32Ki|&u}kl&^GK1#DIKKj)Oi1-L6 zYCs?2kn^L9SW|*Nko^~*=NY_b2c9F3nk_C*&FKlA+~eeC~1oVl0>lBd7bF9g3flK=n! literal 0 HcmV?d00001 diff --git a/test/fixtures/hello.pir b/test/fixtures/hello.pir new file mode 100644 index 00000000..6cb35c1f --- /dev/null +++ b/test/fixtures/hello.pir @@ -0,0 +1,5 @@ +#!/usr/bin/env parrot + +.sub 'main' :main + say "Hello!" +.end diff --git a/test/test_blob.rb b/test/test_blob.rb index 08d65be5..0e0b0112 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -82,6 +82,7 @@ class TestBlob < Test::Unit::TestCase assert blob("linguist.gem").binary? assert blob("octocat.ai").binary? assert blob("octocat.png").binary? + assert blob("hello.pbc").binary? assert !blob("README").binary? assert !blob("file.txt").binary? assert !blob("foo.rb").binary? @@ -317,6 +318,11 @@ class TestBlob < Test::Unit::TestCase # https://github.com/olabini/ioke assert_equal Language['Ioke'], blob("hello.ik").language + + # https://github.com/parrot/parrot + assert_equal Language['Parrot Internal Representation'], blob("hello.pir").language + assert_equal Language['Parrot Assembly'], blob("hello.pasm").language + assert_equal Language['Parrot Bytecode'], blob("hello.pbc").language end def test_lexer