Merge branch 'master' into 2667-local

This commit is contained in:
Arfon Smith
2015-12-03 15:41:25 -06:00
104 changed files with 21495 additions and 639 deletions

17
.gitmodules vendored
View File

@@ -85,6 +85,9 @@
[submodule "vendor/grammars/language-shellscript"]
path = vendor/grammars/language-shellscript
url = https://github.com/atom/language-shellscript
[submodule "vendor/grammars/language-supercollider"]
path = vendor/grammars/language-supercollider
url = https://github.com/supercollider/language-supercollider
[submodule "vendor/grammars/language-yaml"]
path = vendor/grammars/language-yaml
url = https://github.com/atom/language-yaml
@@ -253,9 +256,6 @@
[submodule "vendor/grammars/SublimeXtend"]
path = vendor/grammars/SublimeXtend
url = https://github.com/staltz/SublimeXtend
[submodule "vendor/grammars/Stata.tmbundle"]
path = vendor/grammars/Stata.tmbundle
url = https://github.com/statatmbundle/Stata.tmbundle
[submodule "vendor/grammars/Vala-TMBundle"]
path = vendor/grammars/Vala-TMBundle
url = https://github.com/technosophos/Vala-TMBundle
@@ -649,7 +649,7 @@
url = https://github.com/SRI-CSL/SMT.tmbundle.git
[submodule "vendor/grammars/language-crystal"]
path = vendor/grammars/language-crystal
url = https://github.com/k2b6s9j/language-crystal
url = https://github.com/atom-crystal/language-crystal
[submodule "vendor/grammars/language-xbase"]
path = vendor/grammars/language-xbase
url = https://github.com/hernad/atom-language-harbour
@@ -674,6 +674,9 @@
[submodule "vendor/grammars/sublime-typescript"]
path = vendor/grammars/sublime-typescript
url = https://github.com/Microsoft/TypeScript-Sublime-Plugin
[submodule "vendor/grammars/sublime-pony"]
path = vendor/grammars/sublime-pony
url = https://github.com/CausalityLtd/sublime-pony
[submodule "vendor/grammars/X10"]
path = vendor/grammars/X10
url = git@github.com:x10-lang/x10-highlighting.git
@@ -683,3 +686,9 @@
[submodule "vendor/grammars/UrWeb-Language-Definition"]
path = vendor/grammars/UrWeb-Language-Definition
url = https://github.com/gwalborn/UrWeb-Language-Definition.git
[submodule "vendor/grammars/Stata.tmbundle"]
path = vendor/grammars/Stata.tmbundle
url = https://github.com/pschumm/Stata.tmbundle
[submodule "vendor/grammars/FreeMarker.tmbundle"]
path = vendor/grammars/FreeMarker.tmbundle
url = https://github.com/freemarker/FreeMarker.tmbundle

View File

@@ -1,6 +1,12 @@
language: ruby
sudo: false
addons:
apt:
packages:
- libicu-dev
- libicu48
before_install: script/travis/before_install
rvm:
- 1.9.3
- 2.0.0
- 2.1
- 2.2

View File

@@ -12,7 +12,7 @@ We try only to add new extensions once they have some usage on GitHub. In most c
To add support for a new extension:
0. Add your extension to the language entry in [`languages.yml`][languages].
0. Add your extension to the language entry in [`languages.yml`][languages], keeping the extensions in alphabetical order.
0. Add at least one sample for your extension to the [samples directory][samples] in the correct subdirectory.
0. Open a pull request, linking to a [GitHub search result](https://github.com/search?utf8=%E2%9C%93&q=extension%3Aboot+NOT+nothack&type=Code&ref=searchresults) showing in-the-wild usage.

View File

@@ -17,7 +17,7 @@ The Language stats bar displays languages percentages for the files in the repos
0. Click on the name of the language in the stats bar to see a list of the files that are identified as that language.
0. If you see files that you didn't write, consider moving the files into one of the [paths for vendored code](/lib/linguist/vendor.yml), or use the [manual overrides](#overrides) feature to ignore them.
0. If the files are being misclassified, search for [open issues][issues] to see if anyone else has already reported the issue. Any information you an add, especially links to public repositories, is helpful.
0. If the files are being misclassified, search for [open issues][issues] to see if anyone else has already reported the issue. Any information you can add, especially links to public repositories, is helpful.
0. If there are no reported issues of this misclassification, [open an issue][new-issue] and include a link to the repository or a sample of the code that is being misclassified.
## Overrides
@@ -33,9 +33,9 @@ $ cat .gitattributes
*.rb linguist-language=Java
```
Checking code you didn't write, such as JavaScript libraries, into your git repo is a common practice, but this often inflates your project's language stats and may even cause your project to be labeled as another language. By default, Linguist treats all of the paths defined in [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml) as vendored and therefore doesn't include them in the language statistics for a repository. Vendored files are also hidden by default in diffs on github.com.
Checking code you didn't write, such as JavaScript libraries, into your git repo is a common practice, but this often inflates your project's language stats and may even cause your project to be labeled as another language. By default, Linguist treats all of the paths defined in [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml) as vendored and therefore doesn't include them in the language statistics for a repository.
Use the `linguist-vendored` attribute to vendor or un-vendor paths. Please note, overriding the vendored (or un-vendored) status of a file only affects the language statistics for the repository and not the behavior in diffs on github.com.
Use the `linguist-vendored` attribute to vendor or un-vendor paths.
```
$ cat .gitattributes

View File

@@ -24,6 +24,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rake'
s.add_development_dependency 'yajl-ruby'
s.add_development_dependency 'color-proximity', '~> 0.2.1'
s.add_development_dependency 'licensee', '~> 4.7.4'
s.add_development_dependency 'licensee', '6.0.0b1'
end

View File

@@ -42,6 +42,8 @@ vendor/grammars/Docker.tmbundle:
- source.dockerfile
vendor/grammars/Elm.tmLanguage:
- source.elm
vendor/grammars/FreeMarker.tmbundle:
- text.html.ftl
vendor/grammars/G-Code/:
- source.LS
- source.MCPOST
@@ -92,7 +94,7 @@ vendor/grammars/Scalate.tmbundle:
- text.html.ssp
vendor/grammars/Slash.tmbundle:
- text.html.slash
vendor/grammars/Stata.tmbundle:
vendor/grammars/Stata.tmbundle/:
- source.mata
- source.stata
vendor/grammars/Stylus/:
@@ -180,6 +182,9 @@ vendor/grammars/assembly.tmbundle:
- source.x86asm
vendor/grammars/atom-fsharp/:
- source.fsharp
- source.fsharp.fsi
- source.fsharp.fsl
- source.fsharp.fsx
vendor/grammars/atom-language-purescript/:
- source.purescript
vendor/grammars/atom-salt:
@@ -299,8 +304,8 @@ vendor/grammars/io.tmbundle:
vendor/grammars/ioke-outdated:
- source.ioke
vendor/grammars/jade-tmbundle:
- source.jade
- source.pyjade
- text.jade
vendor/grammars/jasmin-sublime:
- source.jasmin
vendor/grammars/java.tmbundle:
@@ -352,6 +357,8 @@ vendor/grammars/language-python:
vendor/grammars/language-shellscript:
- source.shell
- text.shell-session
vendor/grammars/language-supercollider:
- source.supercollider
vendor/grammars/language-xbase:
- source.harbour
vendor/grammars/language-yaml:
@@ -512,6 +519,8 @@ vendor/grammars/sublime-nix:
vendor/grammars/sublime-opal/:
- source.opal
- source.opalsysdefs
vendor/grammars/sublime-pony:
- source.pony
vendor/grammars/sublime-robot-plugin:
- text.robot
vendor/grammars/sublime-rust:

73
lib/linguist/blob.rb Normal file
View File

@@ -0,0 +1,73 @@
require 'linguist/blob_helper'
module Linguist
# A Blob is a wrapper around the content of a file to make it quack
# like a Grit::Blob. It provides the basic interface: `name`,
# `data`, `path` and `size`.
class Blob
include BlobHelper
# Public: Initialize a new Blob.
#
# path - A path String (does not necessarily exists on the file system).
# content - Content of the file.
#
# Returns a Blob.
def initialize(path, content)
@path = path
@content = content
end
# Public: Filename
#
# Examples
#
# Blob.new("/path/to/linguist/lib/linguist.rb", "").path
# # => "/path/to/linguist/lib/linguist.rb"
#
# Returns a String
attr_reader :path
# Public: File name
#
# Returns a String
def name
File.basename(@path)
end
# Public: File contents.
#
# Returns a String.
def data
@content
end
# Public: Get byte size
#
# Returns an Integer.
def size
@content.bytesize
end
# Public: Get file extension.
#
# Returns a String.
def extension
extensions.last || ""
end
# Public: Return an array of the file extensions
#
# >> Linguist::Blob.new("app/views/things/index.html.erb").extensions
# => [".html.erb", ".erb"]
#
# Returns an Array
def extensions
basename, *segments = name.downcase.split(".")
segments.map.with_index do |segment, index|
"." + segments[index..-1].join(".")
end
end
end
end

View File

@@ -1,10 +1,11 @@
require 'linguist/blob_helper'
require 'linguist/blob'
module Linguist
# A FileBlob is a wrapper around a File object to make it quack
# like a Grit::Blob. It provides the basic interface: `name`,
# `data`, `path` and `size`.
class FileBlob
class FileBlob < Blob
include BlobHelper
# Public: Initialize a new FileBlob from a path
@@ -18,20 +19,6 @@ module Linguist
@path = base_path ? path.sub("#{base_path}/", '') : path
end
# Public: Filename
#
# Examples
#
# FileBlob.new("/path/to/linguist/lib/linguist.rb").path
# # => "/path/to/linguist/lib/linguist.rb"
#
# FileBlob.new("/path/to/linguist/lib/linguist.rb",
# "/path/to/linguist").path
# # => "lib/linguist.rb"
#
# Returns a String
attr_reader :path
# Public: Read file permissions
#
# Returns a String like '100644'
@@ -39,13 +26,6 @@ module Linguist
File.stat(@fullpath).mode.to_s(8)
end
# Public: File name
#
# Returns a String
def name
File.basename(@fullpath)
end
# Public: Read file contents.
#
# Returns a String.
@@ -59,26 +39,5 @@ module Linguist
def size
File.size(@fullpath)
end
# Public: Get file extension.
#
# Returns a String.
def extension
extensions.last || ""
end
# Public: Return an array of the file extensions
#
# >> Linguist::FileBlob.new("app/views/things/index.html.erb").extensions
# => [".html.erb", ".erb"]
#
# Returns an Array
def extensions
basename, *segments = name.downcase.split(".")
segments.map.with_index do |segment, index|
"." + segments[index..-1].join(".")
end
end
end
end

View File

@@ -71,7 +71,8 @@ module Linguist
generated_jni_header? ||
vcr_cassette? ||
generated_module? ||
generated_unity3d_meta?
generated_unity3d_meta? ||
generated_racc?
end
# Internal: Is the blob an Xcode file?
@@ -359,5 +360,18 @@ module Linguist
return false unless lines.count > 1
return lines[0].include?("fileFormatVersion: ")
end
# Internal: Is this a Racc-generated file?
#
# A Racc-generated file contains:
# # This file is automatically generated by Racc x.y.z
# on the third line.
#
# Return true or false
def generated_racc?
return false unless extname == '.rb'
return false unless lines.count > 2
return lines[2].start_with?("# This file is automatically generated by Racc")
end
end
end

View File

@@ -131,7 +131,7 @@ module Linguist
disambiguate ".for", ".f" do |data|
if /^: /.match(data)
Language["Forth"]
elsif /^([c*][^a-z]| (subroutine|program)\s|\s*!)/i.match(data)
elsif /^([c*][^abd-z]| (subroutine|program|end)\s|\s*!)/i.match(data)
Language["FORTRAN"]
end
end

View File

@@ -393,6 +393,7 @@ C#:
- csharp
extensions:
- .cs
- .cake
- .cshtml
- .csx
@@ -568,6 +569,7 @@ CoffeeScript:
extensions:
- .coffee
- ._coffee
- .cake
- .cjsx
- .cson
- .iced
@@ -720,7 +722,7 @@ Cython:
D:
type: programming
color: "#fcd46d"
color: "#ba595e"
extensions:
- .d
- .di
@@ -885,6 +887,8 @@ Elixir:
ace_mode: elixir
filenames:
- mix.lock
interpreters:
- elixir
Elm:
type: programming
@@ -1012,6 +1016,7 @@ Formatted:
type: data
extensions:
- .for
- .eam.fs
tm_scope: none
ace_mode: text
@@ -1029,6 +1034,16 @@ Forth:
- .fs
ace_mode: forth
FreeMarker:
type: programming
color: "#0050b2"
aliases:
- ftl
extensions:
- .ftl
tm_scope: text.html.ftl
ace_mode: ftl
Frege:
type: programming
color: "#00cafe"
@@ -1318,11 +1333,22 @@ HTML+Django:
- .mustache
- .jinja
aliases:
- django
- html+django/jinja
- html+jinja
- htmldjango
ace_mode: django
HTML+EEX:
type: markup
tm_scope: text.html.elixir
group: HTML
aliases:
- eex
extensions:
- .eex
ace_mode: text
HTML+ERB:
type: markup
tm_scope: text.html.erb
@@ -1332,7 +1358,7 @@ HTML+ERB:
extensions:
- .erb
- .erb.deface
ace_mode: html_ruby
ace_mode: text
HTML+PHP:
type: markup
@@ -1590,7 +1616,7 @@ Jade:
type: markup
extensions:
- .jade
tm_scope: source.jade
tm_scope: text.jade
ace_mode: jade
Jasmin:
@@ -1635,6 +1661,7 @@ JavaScript:
- .gs
- .jake
- .jsb
- .jscad
- .jsfl
- .jsm
- .jss
@@ -1681,6 +1708,7 @@ KiCad:
type: programming
extensions:
- .sch
- .brd
- .kicad_pcb
tm_scope: none
ace_mode: text
@@ -2015,6 +2043,8 @@ Mathematica:
Matlab:
type: programming
color: "#bb92ac"
aliases:
- octave
extensions:
- .matlab
- .m
@@ -2063,6 +2093,14 @@ Mercury:
tm_scope: source.mercury
ace_mode: prolog
Metal:
type: programming
color: "#8f14e9"
extensions:
- .metal
tm_scope: source.c++
ace_mode: c_cpp
MiniD: # Legacy
type: programming
searchable: false
@@ -2441,6 +2479,7 @@ PHP:
- .php3
- .php4
- .php5
- .phps
- .phpt
filenames:
- Phakefile
@@ -2457,6 +2496,7 @@ PLSQL:
color: "#dad8d8"
extensions:
- .pls
- .pck
- .pkb
- .pks
- .plb
@@ -2573,6 +2613,13 @@ Perl6:
tm_scope: source.perl.6
ace_mode: perl
Pickle:
type: data
extensions:
- .pkl
tm_scope: none
ace_mode: text
PicoLisp:
type: programming
extensions:
@@ -2617,6 +2664,13 @@ PogoScript:
tm_scope: source.pogoscript
ace_mode: text
Pony:
type: programming
extensions:
- .pony
tm_scope: source.pony
ace_mode: text
PostScript:
type: markup
extensions:
@@ -3108,7 +3162,7 @@ Sass:
Scala:
type: programming
ace_mode: scala
color: "#7dd3b0"
color: "#DC322F"
extensions:
- .scala
- .sbt
@@ -3297,9 +3351,12 @@ SuperCollider:
type: programming
color: "#46390b"
extensions:
- .scd
- .sc
tm_scope: none
- .scd
interpreters:
- sclang
- scsynth
tm_scope: source.supercollider
ace_mode: text
Swift:
@@ -3442,6 +3499,7 @@ TypeScript:
- ts
extensions:
- .ts
- .tsx
tm_scope: source.ts
ace_mode: typescript
@@ -3623,6 +3681,7 @@ XML:
- .ccxml
- .clixml
- .cproject
- .csl
- .csproj
- .ct
- .dita
@@ -3669,6 +3728,7 @@ XML:
- .tmSnippet
- .tmTheme
- .ts
- .tsx
- .ui
- .urdf
- .vbproj

View File

@@ -86,13 +86,13 @@ module Linguist
if s.peek(1) == "\""
s.getch
else
s.skip_until(/[^\\]"/)
s.skip_until(/(?<!\\)"/)
end
elsif s.scan(/'/)
if s.peek(1) == "'"
s.getch
else
s.skip_until(/[^\\]'/)
s.skip_until(/(?<!\\)'/)
end
# Skip number literals

View File

@@ -95,7 +95,7 @@
- jquery.fn.gantt.js
# jQuery fancyBox
- jquery.fancybox.js
- jquery.fancybox.(js|css)
# Fuel UX
- fuelux.js

View File

@@ -1,3 +1,3 @@
module Linguist
VERSION = "4.6.3"
VERSION = "4.7.2"
end

86
samples/C#/build.cake Normal file
View File

@@ -0,0 +1,86 @@
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var solutions = GetFiles("./**/*.sln");
var solutionPaths = solutions.Select(solution => solution.GetDirectory());
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(() =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});
Teardown(() =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASK DEFINITIONS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
// Clean solution directories.
foreach(var path in solutionPaths)
{
Information("Cleaning {0}", path);
CleanDirectories(path + "/**/bin/" + configuration);
CleanDirectories(path + "/**/obj/" + configuration);
}
});
Task("Restore")
.Does(() =>
{
// Restore all NuGet packages.
foreach(var solution in solutions)
{
Information("Restoring {0}...", solution);
NuGetRestore(solution);
}
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
// Build all solutions.
foreach(var solution in solutions)
{
Information("Building {0}", solution);
MSBuild(solution, settings =>
settings.SetPlatformTarget(PlatformTarget.MSIL)
.WithProperty("TreatWarningsAsErrors","true")
.WithTarget("Build")
.SetConfiguration(configuration));
}
});
///////////////////////////////////////////////////////////////////////////////
// TARGETS
///////////////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build");
///////////////////////////////////////////////////////////////////////////////
// EXECUTION
///////////////////////////////////////////////////////////////////////////////
RunTarget(target);

View File

@@ -0,0 +1,17 @@
fs = require 'fs'
{print} = require 'sys'
{spawn} = require 'child_process'
build = (callback) ->
coffee = spawn 'coffee', ['-c', '-o', '.', '.']
coffee.stderr.on 'data', (data) ->
process.stderr.write data.toString()
coffee.stdout.on 'data', (data) ->
print data.toString()
coffee.on 'exit', (code) ->
callback?() if code is 0
task 'build', 'Build from source', ->
build()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
<#import "layout.ftl" as layout>
<#assign results = [
{
"title": "Example Result",
"description": "Lorem ipsum dolor sit amet, pede id pellentesque, sollicitudin turpis sed in sed sed, libero dictum."
}
] />
<@layout.page title="FreeMarker Example">
<#if results?size == 0>
There were no results.
<#else>
<ul>
<#list results as result>
<li>
<strong>${result.title}</strong>
<p>${result.description}</p>
</li>
</#list>
</ul>
</#if>
<#-- This is a FreeMarker comment -->
<@currentTime />
</@layout.page>
<#macro currentTime>
${.now?string.full}
</#macro>

View File

@@ -0,0 +1,32 @@
<#ftl strip_text=true />
<#macro page title>
<!doctype html>
<html lang="${.lang}">
<head>
<title>${title}</title>
<@metaTags />
</head>
<body>
<#nested />
<@footer />
</body>
</html>
</#macro>
<#---
Default meta tags
-->
<#macro metaTags>
<#compress>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="format-detection" content="telephone=no">
</#compress>
</#macro>
<#macro footer>
<p>This page is using FreeMarker v${.version}</p>
</#macro>

View File

@@ -0,0 +1,26 @@
<h1>Listing Books</h1>
<table>
<tr>
<th>Title</th>
<th>Summary</th>
<th></th>
<th></th>
<th></th>
</tr>
<%= for book <- @books do %>
<tr>
<%# comment %>
<td><%= book.title %></td>
<td><%= book.content %></td>
<td><%= link "Show", to: book_path(@conn, :show, book) %></td>
<td><%= link "Edit", to: book_path(@conn, :edit, book) %></td>
<td><%= link "Delete", to: book_path(@conn, :delete, book), method: :delete, data: [confirm: "Are you sure?"] %></td>
</tr>
<% end %>
</table>
<br />
<%= link "New book", to: book_path(@conn, :new) %>

View File

@@ -0,0 +1,19 @@
// title : OpenJSCAD.org Logo
// author : Rene K. Mueller
// license : MIT License
// revision : 0.003
// tags : Logo,Intersection,Sphere,Cube
// file : logo.jscad
function main() {
return union(
difference(
cube({size: 3, center: true}),
sphere({r:2, center: true})
),
intersection(
sphere({r: 1.3, center: true}),
cube({size: 2.1, center: true})
)
).translate([0,0,1.5]).scale(10);
}

14069
samples/KiCad/tc14badge.brd Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,99 @@
// Copyright 2014 Isis Innovation Limited and the authors of InfiniTAM
#include <metal_stdlib>
#include "../../DeviceAgnostic/ITMSceneReconstructionEngine.h"
#include "../../DeviceAgnostic/ITMVisualisationEngine.h"
#include "ITMVisualisationEngine_Metal.h"
using namespace metal;
kernel void genericRaycastVH_device(DEVICEPTR(Vector4f) *pointsRay [[ buffer(0) ]],
const CONSTPTR(ITMVoxel) *voxelData [[ buffer(1) ]],
const CONSTPTR(typename ITMVoxelIndex::IndexData) *voxelIndex [[ buffer(2) ]],
const CONSTPTR(Vector2f) *minmaxdata [[ buffer(3) ]],
const CONSTPTR(CreateICPMaps_Params) *params [[ buffer(4) ]],
uint2 threadIdx [[ thread_position_in_threadgroup ]],
uint2 blockIdx [[ threadgroup_position_in_grid ]],
uint2 blockDim [[ threads_per_threadgroup ]])
{
int x = threadIdx.x + blockIdx.x * blockDim.x, y = threadIdx.y + blockIdx.y * blockDim.y;
if (x >= params->imgSize.x || y >= params->imgSize.y) return;
int locId = x + y * params->imgSize.x;
int locId2 = (int)floor((float)x / minmaximg_subsample) + (int)floor((float)y / minmaximg_subsample) * params->imgSize.x;
castRay<ITMVoxel, ITMVoxelIndex>(pointsRay[locId], x, y, voxelData, voxelIndex, params->invM, params->invProjParams,
params->voxelSizes.y, params->lightSource.w, minmaxdata[locId2]);
}
kernel void genericRaycastVGMissingPoints_device(DEVICEPTR(Vector4f) *forwardProjection [[ buffer(0) ]],
const CONSTPTR(int) *fwdProjMissingPoints [[ buffer(1) ]],
const CONSTPTR(ITMVoxel) *voxelData [[ buffer(2) ]],
const CONSTPTR(typename ITMVoxelIndex::IndexData) *voxelIndex [[ buffer(3) ]],
const CONSTPTR(Vector2f) *minmaxdata [[ buffer(4) ]],
const CONSTPTR(CreateICPMaps_Params) *params [[ buffer(5) ]],
uint2 threadIdx [[ thread_position_in_threadgroup ]],
uint2 blockIdx [[ threadgroup_position_in_grid ]],
uint2 blockDim [[ threads_per_threadgroup ]])
{
int pointId = threadIdx.x + blockIdx.x * blockDim.x;
if (pointId >= params->imgSize.z) return;
int locId = fwdProjMissingPoints[pointId];
int y = locId / params->imgSize.x, x = locId - y * params->imgSize.x;
int locId2 = (int)floor((float)x / minmaximg_subsample) + (int)floor((float)y / minmaximg_subsample) * params->imgSize.x;
castRay<ITMVoxel, ITMVoxelIndex>(forwardProjection[locId], x, y, voxelData, voxelIndex, params->invM, params->invProjParams,
params->voxelSizes.y, params->lightSource.w, minmaxdata[locId2]);
}
kernel void renderICP_device(const CONSTPTR(Vector4f) *pointsRay [[ buffer(0) ]],
DEVICEPTR(Vector4f) *pointsMap [[ buffer(1) ]],
DEVICEPTR(Vector4f) *normalsMap [[ buffer(2) ]],
DEVICEPTR(Vector4u) *outRendering [[ buffer(3) ]],
const CONSTPTR(CreateICPMaps_Params) *params [[ buffer(4) ]],
uint2 threadIdx [[ thread_position_in_threadgroup ]],
uint2 blockIdx [[ threadgroup_position_in_grid ]],
uint2 blockDim [[ threads_per_threadgroup ]])
{
int x = threadIdx.x + blockIdx.x * blockDim.x, y = threadIdx.y + blockIdx.y * blockDim.y;
if (x >= params->imgSize.x || y >= params->imgSize.y) return;
processPixelICP<false>(outRendering, pointsMap, normalsMap, pointsRay, params->imgSize.xy, x, y, params->voxelSizes.x, TO_VECTOR3(params->lightSource));
}
kernel void renderForward_device(DEVICEPTR(Vector4u) *outRendering [[ buffer(0) ]],
const CONSTPTR(Vector4f) *pointsRay [[ buffer(1) ]],
const CONSTPTR(CreateICPMaps_Params) *params [[ buffer(2) ]],
uint2 threadIdx [[ thread_position_in_threadgroup ]],
uint2 blockIdx [[ threadgroup_position_in_grid ]],
uint2 blockDim [[ threads_per_threadgroup ]])
{
int x = threadIdx.x + blockIdx.x * blockDim.x, y = threadIdx.y + blockIdx.y * blockDim.y;
if (x >= params->imgSize.x || y >= params->imgSize.y) return;
processPixelForwardRender<false>(outRendering, pointsRay, params->imgSize.xy, x, y, params->voxelSizes.x, TO_VECTOR3(params->lightSource));
}
kernel void forwardProject_device(DEVICEPTR(Vector4f) *forwardProjection [[ buffer(0) ]],
const CONSTPTR(Vector4f) *pointsRay [[ buffer(1) ]],
const CONSTPTR(CreateICPMaps_Params) *params [[ buffer(2) ]],
uint2 threadIdx [[ thread_position_in_threadgroup ]],
uint2 blockIdx [[ threadgroup_position_in_grid ]],
uint2 blockDim [[ threads_per_threadgroup ]])
{
int x = (threadIdx.x + blockIdx.x * blockDim.x), y = (threadIdx.y + blockIdx.y * blockDim.y);
if (x >= params->imgSize.x || y >= params->imgSize.y) return;
int locId = x + y * params->imgSize.x;
Vector4f pixel = pointsRay[locId];
int locId_new = forwardProjectPixel(pixel * params->voxelSizes.x, params->M, params->projParams, params->imgSize.xy);
if (locId_new >= 0) forwardProjection[locId_new] = pixel;
}

31
samples/PHP/mail.phps Normal file
View File

@@ -0,0 +1,31 @@
<?php
/**
* This example shows sending a message using PHP's mail() function.
*/
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@@ -0,0 +1,90 @@
create or replace package plsqlguide is
-- Author : Jared Petersen
-- Created : 9/22/2015 12:26:22 AM
-- Purpose : Basic PLSQL template/guide
/* Procedures */
procedure p_main;
end plsqlguide;
/
create or replace package body plsqlguide is
/* Main entry point (homepage) */
procedure p_main
is
begin
htp.prn('
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>PL/SQL Sample Application</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Static navbar -->
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">PL/SQL Sample Application</a>
</div>
</div>
</nav>
<div class="container">
<table class="table table-bordered">
<tr>
<th>#</th>
<th>Name</th>
<th>Description</th>
<th>Quantity</th>
<th>Price</th>
</tr>
');
-- Fill out the parts table
for row in (select * from parts) loop
htp.prn('
<tr>
<td>'||row.pid||'</td>
<td>'||row.name||'</td>
<td>'||row.description||'</td>
<td>'||row.quantity||'</td>
<td>'||row.price||'</td>
</tr>
');
end loop;
htp.prn('
</table>
</div> <!-- /container -->
<!-- jQuery (necessary for Bootstrap''s JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>
');
end p_main;
begin
-- Initialization
null;
end plsqlguide;
/

24
samples/Pickle/data.pkl Normal file
View File

@@ -0,0 +1,24 @@
(dp0
S'a'
p1
(lp2
I1
aF2.0
aI3
ac__builtin__
complex
p3
(F4.0
F6.0
tp4
Rp5
asS'c'
p6
NsS'b'
p7
(S'string'
p8
VUnicode string
p9
tp10
s.

File diff suppressed because one or more lines are too long

36
samples/Pickle/random.pkl Normal file
View File

@@ -0,0 +1,36 @@
cnumpy.core.multiarray
_reconstruct
p0
(cnumpy
ndarray
p1
(I0
tp2
S'b'
p3
tp4
Rp5
(I1
(I100
tp6
cnumpy
dtype
p7
(S'f8'
p8
I0
I1
tp9
Rp10
(I3
S'<'
p11
NNNI-1
I-1
I0
tp12
bI00
S'\x1cc~\xc3\xa7r\xed?\xe5${\xec\xd6\xcd\xed?\x809-\x02%\xa9\xa2?F\x0f\x1d\xe8\xef\xa3\xdb?\xfe\xd1\x0c\xb7\x83\x13\xef?\xe0<o\xa1\xa9^\xdf?CE\x96\x88/o\xe2?<\xd8\xa1\x96\xa2T\xce?\x152\x8e\xe5\xa8\x7f\xe8?\xe4\xb7\x9a\xe0$\x0f\xdc?\x90\xe4\xe2\xd4=\xce\xc3?Ix\xe3P\xc4C\xe1?\x16\xd17\xc1Y\xfc\xed?5\xd7\xae@4\xfa\xe8?\x0f\x87\x8d>\xfcO\xe5?Y\x97\xcb"\xa7%\xe7?\x9b\x8d\x16\xda\x97\xe1\xeb?T\x14\xbd\xfe|\xf4\xd0?\x18\xdfH\xc56A\xba?\x90\xc5\xfb\xc63:\xe5?\xbf%\xad\xe5.\x86\xe9?\xc6\x0c\xa9\x8c\xd7\xd5\xe9?\xf8\xafc:\x84g\xd7?\xf8\x98\x879\x9a\x16\xee?\xba\xdf\x88\x8az\x06\xe2?~g-\xeb\xc8\xed\xee?\x08A\xcc\x8c\xe7>\xef?\xceD\xc4ar\n\xdc?\x92w\xbb\xa34\xb1\xd9?\x88\xb9\xc0{u\xa3\xdc?d\x1a\xad\xe8\xf3\x14\xdd?\x9c\x95\x13\x96o?\xe5?\x9cT[\xb8r\xa9\xe5?0\xf1\x01+(\x0f\xdf?W\xbdjqD&\xed?c\xcf1-W\xe6\xe1?\xce\xbc\xe1{zW\xd9?"d\xcf\xd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?R\x92?\xc4\r\x08+\x99J\xe1?I|&U\x19\xc4\xe1?|*\xf9\xebq\x7f\xed?\xbc*\x93\x89k\xab\xe9?oiL\x90;\xe0\xef?\x96\xcd\x9b\xff\x18g\xdc?pt\xb4\xa5\x9c\xa2\xbc?Nu]w*\xb7\xd2?\x88k\xac\xd0\xfd\xbf\xd5?Q\x02$b\xfeH\xea?5\xf6\t\xb6K\x1a\xee?'
p13
tp14
b.

10
samples/Pickle/save.pkl Normal file
View File

@@ -0,0 +1,10 @@
(dp0
S'lion'
p1
S'yellow'
p2
sS'kitty'
p3
S'red'
p4
s.

30
samples/Pony/circle.pony Normal file
View File

@@ -0,0 +1,30 @@
use "collections"
class Circle
var _radius: F32
new create(radius': F32) =>
_radius = radius'
fun ref get_radius(): F32 =>
_radius
fun ref get_area(): F32 =>
F32.pi() * _radius.pow(2)
fun ref get_circumference(): F32 =>
2 * _radius * F32.pi()
actor Main
new create(env: Env) =>
for i in Range[F32](1.0, 101.0) do
let c = Circle(i)
var str =
"Radius: " + c.get_radius().string() + "\n" +
"Circumference: " + c.get_circumference().string() + "\n" +
"Area: " + c.get_area().string() + "\n"
env.out.print(str)
end

32
samples/Pony/counter.pony Normal file
View File

@@ -0,0 +1,32 @@
use "collections"
actor Counter
var _count: U32
new create() =>
_count = 0
be increment() =>
_count = _count + 1
be get_and_reset(main: Main) =>
main.display(_count)
_count = 0
actor Main
var _env: Env
new create(env: Env) =>
_env = env
var count: U32 = try env.args(1).u32() else 10 end
var counter = Counter
for i in Range[U32](0, count) do
counter.increment()
end
counter.get_and_reset(this)
be display(result: U32) =>
_env.out.print(result.string())

261
samples/Pony/gups-opt.pony Normal file
View File

@@ -0,0 +1,261 @@
use "options"
use "time"
use "collections"
class Config
var logtable: U64 = 20
var iterate: U64 = 10000
var logchunk: U64 = 10
var logactors: U64 = 2
fun ref apply(env: Env): Bool =>
var options = Options(env)
options
.add("logtable", "l", I64Argument)
.add("iterate", "i", I64Argument)
.add("chunk", "c", I64Argument)
.add("actors", "a", I64Argument)
for option in options do
match option
| ("table", var arg: I64) => logtable = arg.u64()
| ("iterate", var arg: I64) => iterate = arg.u64()
| ("chunk", var arg: I64) => logchunk = arg.u64()
| ("actors", var arg: I64) => logactors = arg.u64()
| let err: ParseError =>
err.report(env.out)
env.out.print(
"""
gups_opt [OPTIONS]
--table N log2 of the total table size. Defaults to 20.
--iterate N number of iterations. Defaults to 10000.
--chunk N log2 of the chunk size. Defaults to 10.
--actors N log2 of the actor count. Defaults to 2.
"""
)
return false
end
end
env.out.print(
"logtable: " + logtable.string() +
"\niterate: " + iterate.string() +
"\nlogchunk: " + logchunk.string() +
"\nlogactors: " + logactors.string()
)
true
actor Main
let _env: Env
let _config: Config = Config
var _updates: U64 = 0
var _confirm: U64 = 0
let _start: U64
var _actors: Array[Updater] val
new create(env: Env) =>
_env = env
if _config(env) then
let actor_count = 1 << _config.logactors
let loglocal = _config.logtable - _config.logactors
let chunk_size = 1 << _config.logchunk
let chunk_iterate = chunk_size * _config.iterate
_updates = chunk_iterate * actor_count
_confirm = actor_count
var updaters = recover Array[Updater](actor_count) end
for i in Range[U64](0, actor_count) do
updaters.push(Updater(this, actor_count, i, loglocal, chunk_size,
chunk_iterate * i))
end
_actors = consume updaters
_start = Time.nanos()
for a in _actors.values() do
a.start(_actors, _config.iterate)
end
else
_start = 0
_actors = recover Array[Updater] end
end
be done() =>
if (_confirm = _confirm - 1) == 1 then
for a in _actors.values() do
a.done()
end
end
be confirm() =>
_confirm = _confirm + 1
if _confirm == _actors.size() then
let elapsed = (Time.nanos() - _start).f64()
let gups = _updates.f64() / elapsed
_env.out.print(
"Time: " + (elapsed / 1e9).string() +
"\nGUPS: " + gups.string()
)
end
actor Updater
let _main: Main
let _index: U64
let _updaters: U64
let _chunk: U64
let _mask: U64
let _loglocal: U64
let _output: Array[Array[U64] iso]
let _reuse: List[Array[U64] iso] = List[Array[U64] iso]
var _others: (Array[Updater] val | None) = None
var _table: Array[U64]
var _rand: U64
new create(main:Main, updaters: U64, index: U64, loglocal: U64, chunk: U64,
seed: U64)
=>
_main = main
_index = index
_updaters = updaters
_chunk = chunk
_mask = updaters - 1
_loglocal = loglocal
_rand = PolyRand.seed(seed)
_output = _output.create(updaters)
let size = 1 << loglocal
_table = Array[U64].undefined(size)
var offset = index * size
try
for i in Range[U64](0, size) do
_table(i) = i + offset
end
end
be start(others: Array[Updater] val, iterate: U64) =>
_others = others
iteration(iterate)
be apply(iterate: U64) =>
iteration(iterate)
fun ref iteration(iterate: U64) =>
let chk = _chunk
for i in Range(0, _updaters) do
_output.push(
try
_reuse.pop()
else
recover Array[U64](chk) end
end
)
end
for i in Range(0, _chunk) do
var datum = _rand = PolyRand(_rand)
var updater = (datum >> _loglocal) and _mask
try
if updater == _index then
_table(i) = _table(i) xor datum
else
_output(updater).push(datum)
end
end
end
try
let to = _others as Array[Updater] val
repeat
let data = _output.pop()
if data.size() > 0 then
to(_output.size()).receive(consume data)
else
_reuse.push(consume data)
end
until _output.size() == 0 end
end
if iterate > 1 then
apply(iterate - 1)
else
_main.done()
end
be receive(data: Array[U64] iso) =>
try
for i in Range(0, data.size()) do
let datum = data(i)
var j = (datum >> _loglocal) and _mask
_table(j) = _table(j) xor datum
end
data.clear()
_reuse.push(consume data)
end
be done() =>
_main.confirm()
primitive PolyRand
fun apply(prev: U64): U64 =>
(prev << 1) xor if prev.i64() < 0 then _poly() else 0 end
fun seed(from: U64): U64 =>
var n = from % _period()
if n == 0 then
return 1
end
var m2 = Array[U64].undefined(64)
var temp = U64(1)
try
for i in Range(0, 64) do
m2(i) = temp
temp = this(temp)
temp = this(temp)
end
end
var i: U64 = 64 - n.clz()
var r = U64(2)
try
while i > 0 do
temp = 0
for j in Range(0, 64) do
if ((r >> j) and 1) != 0 then
temp = temp xor m2(j)
end
end
r = temp
i = i - 1
if ((n >> i) and 1) != 0 then
r = this(r)
end
end
end
r
fun _poly(): U64 => 7
fun _period(): U64 => 1317624576693539401

View File

@@ -0,0 +1,3 @@
actor Main
new create(env: Env) =>
env.out.print("Hello, world.")

View File

@@ -0,0 +1,188 @@
use "files"
use "options"
use "collections"
actor Worker
new mandelbrot(main: Main, x: U64, y: U64, width: U64, iterations: U64,
limit: F32, real: Array[F32] val, imaginary: Array[F32] val)
=>
var view: Array[U8] iso =
recover
Array[U8]((y - x) * (width >> 3))
end
let group_r = Array[F32].undefined(8)
let group_i = Array[F32].undefined(8)
var row = x
try
while row < y do
let prefetch_i = imaginary(row)
var col: U64 = 0
while col < width do
var j: U64 = 0
while j < 8 do
group_r.update(j, real(col + j))
group_i.update(j, prefetch_i)
j = j + 1
end
var bitmap: U8 = 0xFF
var n = iterations
repeat
var mask: U8 = 0x80
var k: U64 = 0
while k < 8 do
let r = group_r(k)
let i = group_i(k)
group_r.update(k, ((r * r) - (i * i)) + real(col + k))
group_i.update(k, (2.0 * r * i) + prefetch_i)
if ((r * r) + (i * i)) > limit then
bitmap = bitmap and not mask
end
mask = mask >> 1
k = k + 1
end
until (bitmap == 0) or ((n = n - 1) == 1) end
view.push(bitmap)
col = col + 8
end
row = row + 1
end
main.draw(x * (width >> 3), consume view)
end
actor Main
var iterations: U64 = 50
var limit: F32 = 4.0
var chunks: U64 = 16
var width: U64 = 16000
var actors: U64 = 0
var header: U64 = 0
var real: Array[F32] val = recover Array[F32] end
var imaginary: Array[F32] val = recover Array[F32] end
var outfile: (File | None) = None
new create(env: Env) =>
try
arguments(env)
let length = width
let recip_width = 2.0 / width.f32()
var r = recover Array[F32](length) end
var i = recover Array[F32](length) end
for j in Range(0, width) do
r.push((recip_width * j.f32()) - 1.5)
i.push((recip_width * j.f32()) - 1.0)
end
real = consume r
imaginary = consume i
spawn_actors()
create_outfile()
end
be draw(offset: U64, pixels: Array[U8] val) =>
match outfile
| var out: File =>
out.seek_start(header + offset)
out.write(pixels)
if (actors = actors - 1) == 1 then
out.dispose()
end
end
fun ref create_outfile() =>
match outfile
| var f: File =>
f.print("P4\n " + width.string() + " " + width.string() + "\n")
header = f.size()
f.set_length((width * (width >> 3)) + header)
end
fun ref spawn_actors() =>
actors = ((width + (chunks - 1)) / chunks)
var rest = width % chunks
if rest == 0 then rest = chunks end
var x: U64 = 0
var y: U64 = 0
for i in Range(0, actors - 1) do
x = i * chunks
y = x + chunks
Worker.mandelbrot(this, x, y, width, iterations, limit, real, imaginary)
end
Worker.mandelbrot(this, y, y + rest, width, iterations, limit, real,
imaginary)
fun ref arguments(env: Env) ? =>
let options = Options(env)
options
.add("iterations", "i", I64Argument)
.add("limit", "l", F64Argument)
.add("chunks", "c", I64Argument)
.add("width", "w", I64Argument)
.add("output", "o", StringArgument)
for option in options do
match option
| ("iterations", var arg: I64) => iterations = arg.u64()
| ("limit", var arg: F64) => limit = arg.f32()
| ("chunks", var arg: I64) => chunks = arg.u64()
| ("width", var arg: I64) => width = arg.u64()
| ("output", var arg: String) =>
outfile = try File(FilePath(env.root, arg)) end
| let err: ParseError => err.report(env.out) ; usage(env) ; error
end
end
fun tag usage(env: Env) =>
env.out.print(
"""
mandelbrot [OPTIONS]
The binary output can be converted to a BMP with the following command
(ImageMagick Tools required):
convert <output> JPEG:<output>.jpg
Available options:
--iterations, -i Maximum amount of iterations to be done for each pixel.
Defaults to 50.
--limit, -l Square of the limit that pixels need to exceed in order
to escape from the Mandelbrot set.
Defaults to 4.0.
--chunks, -c Maximum line count of chunks the image should be
divided into for divide & conquer processing.
Defaults to 16.
--width, -w Lateral length of the resulting mandelbrot image.
Defaults to 16000.
--output, -o File to write the output to.
"""
)

130
samples/Pony/mixed.pony Normal file
View File

@@ -0,0 +1,130 @@
use "collections"
actor Worker
var _env: Env
new create(env: Env) =>
_env = env
var a: U64 = 86028157
var b: U64 = 329545133
var result = factorize(a*b)
var correct =
try
(result.size() == 2) and
(result(0) == 86028157) and
(result(1) == 329545133)
else
false
end
fun ref factorize(bigint: U64) : Array[U64] =>
var factors = Array[U64](2)
if bigint <= 3 then
factors.push(bigint)
else
var d: U64 = 2
var i: U64 = 0
var n = bigint
while d < n do
if (n % d) == 0 then
i = i + 1
factors.push(d)
n = n / d
else
d = if d == 2 then 3 else (d + 2) end
end
end
factors.push(d)
end
factors
actor Ring
var _env: Env
var _size: U32
var _pass: U32
var _repetitions: U32
var _next: Ring
new create(env: Env, size: U32, pass: U32, repetitions: U32) =>
_env = env
_size = size
_pass = pass
_repetitions = repetitions
_next = spawn_ring(_env, _size, _pass)
run()
new neighbor(env: Env, next: Ring) =>
_env = env
_next = next
_size = 0
_pass = 0
_repetitions = 0
be apply(i: U32) =>
if i > 0 then
_next(i - 1)
else
run()
end
fun ref run() =>
if _repetitions > 0 then
_repetitions = _repetitions - 1
_next(_pass * _size)
Worker(_env)
end
fun tag spawn_ring(env: Env, size: U32, pass': U32) : Ring =>
var next: Ring = this
for i in Range[U32](0, size) do
next = Ring.neighbor(env, next)
end
next
actor Main
var _size: U32 = 50
var _count: U32 = 20
var _pass: U32 = 10000
var _repetitions: U32 = 5
var _env: Env
new create(env: Env) =>
_env = env
try
arguments()
start_benchmark()
else
usage()
end
fun ref arguments() ? =>
_count = _env.args(1).u32()
_size = _env.args(2).u32()
_pass = _env.args(3).u32()
_repetitions = _env.args(4).u32()
fun ref start_benchmark() =>
for i in Range[U32](0, _count) do
Ring(_env, _size, _pass, _repetitions)
end
fun ref usage() =>
_env.out.print(
"""
mixed OPTIONS
N number of actors in each ring"
N number of rings"
N number of messages to pass around each ring"
N number of times to repeat"
"""
)

267
samples/Ruby/racc.rb Normal file
View File

@@ -0,0 +1,267 @@
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.7
# from Racc grammer file "".
#
require 'racc/parser.rb'
module RJSON
class Parser < Racc::Parser
require 'rjson/handler'
attr_reader :handler
def initialize tokenizer, handler = Handler.new
@tokenizer = tokenizer
@handler = handler
super()
end
def next_token
@tokenizer.next_token
end
def parse
do_parse
handler
end
##### State transition tables begin ###
racc_action_table = [
9, 33, 9, 11, 13, 16, 19, 22, 9, 7,
23, 1, 9, 11, 13, 16, 19, 29, 30, 7,
21, 1, 9, 11, 13, 16, 19, 31, nil, 7,
21, 1, 23, 7, nil, 1 ]
racc_action_check = [
6, 27, 33, 33, 33, 33, 33, 3, 31, 33,
6, 33, 29, 29, 29, 29, 29, 12, 22, 29,
12, 29, 2, 2, 2, 2, 2, 25, nil, 2,
2, 2, 25, 0, nil, 0 ]
racc_action_pointer = [
24, nil, 20, 7, nil, nil, -2, nil, nil, nil,
nil, nil, 10, nil, nil, nil, nil, nil, nil, nil,
nil, nil, 18, nil, nil, 20, nil, -7, nil, 10,
nil, 6, nil, 0, nil, nil, nil ]
racc_action_default = [
-27, -12, -21, -27, -1, -2, -27, -10, -15, -26,
-8, -22, -27, -23, -17, -16, -24, -20, -18, -25,
-19, -11, -27, -13, -3, -27, -6, -27, -9, -21,
37, -27, -4, -21, -14, -5, -7 ]
racc_goto_table = [
8, 26, 24, 27, 10, 3, 25, 5, 4, 12,
nil, nil, nil, nil, 28, nil, nil, nil, nil, nil,
nil, 32, nil, nil, nil, nil, 35, 34, 27, nil,
nil, 36 ]
racc_goto_check = [
9, 7, 5, 8, 11, 1, 6, 3, 2, 12,
nil, nil, nil, nil, 11, nil, nil, nil, nil, nil,
nil, 5, nil, nil, nil, nil, 7, 9, 8, nil,
nil, 9 ]
racc_goto_pointer = [
nil, 5, 8, 7, nil, -4, 0, -5, -3, -2,
nil, 2, 7, nil, nil ]
racc_goto_default = [
nil, nil, 14, 18, 6, nil, nil, nil, 20, nil,
2, nil, nil, 15, 17 ]
racc_reduce_table = [
0, 0, :racc_error,
1, 14, :_reduce_none,
1, 14, :_reduce_none,
2, 15, :_reduce_none,
3, 15, :_reduce_none,
3, 19, :_reduce_none,
1, 19, :_reduce_none,
3, 20, :_reduce_none,
2, 16, :_reduce_none,
3, 16, :_reduce_none,
1, 23, :_reduce_10,
1, 24, :_reduce_11,
1, 17, :_reduce_12,
1, 18, :_reduce_13,
3, 25, :_reduce_none,
1, 25, :_reduce_none,
1, 22, :_reduce_none,
1, 22, :_reduce_none,
1, 22, :_reduce_none,
1, 26, :_reduce_none,
1, 26, :_reduce_20,
0, 27, :_reduce_none,
1, 27, :_reduce_22,
1, 27, :_reduce_23,
1, 27, :_reduce_24,
1, 27, :_reduce_25,
1, 21, :_reduce_26 ]
racc_reduce_n = 27
racc_shift_n = 37
racc_token_table = {
false => 0,
:error => 1,
:STRING => 2,
:NUMBER => 3,
:TRUE => 4,
:FALSE => 5,
:NULL => 6,
"," => 7,
":" => 8,
"[" => 9,
"]" => 10,
"{" => 11,
"}" => 12 }
racc_nt_base = 13
racc_use_result_var = true
Racc_arg = [
racc_action_table,
racc_action_check,
racc_action_default,
racc_action_pointer,
racc_goto_table,
racc_goto_check,
racc_goto_default,
racc_goto_pointer,
racc_nt_base,
racc_reduce_table,
racc_token_table,
racc_shift_n,
racc_reduce_n,
racc_use_result_var ]
Racc_token_to_s_table = [
"$end",
"error",
"STRING",
"NUMBER",
"TRUE",
"FALSE",
"NULL",
"\",\"",
"\":\"",
"\"[\"",
"\"]\"",
"\"{\"",
"\"}\"",
"$start",
"document",
"object",
"array",
"start_object",
"end_object",
"pairs",
"pair",
"string",
"value",
"start_array",
"end_array",
"values",
"scalar",
"literal" ]
Racc_debug_parser = false
##### State transition tables end #####
# reduce 0 omitted
# reduce 1 omitted
# reduce 2 omitted
# reduce 3 omitted
# reduce 4 omitted
# reduce 5 omitted
# reduce 6 omitted
# reduce 7 omitted
# reduce 8 omitted
# reduce 9 omitted
def _reduce_10(val, _values, result)
@handler.start_array
result
end
def _reduce_11(val, _values, result)
@handler.end_array
result
end
def _reduce_12(val, _values, result)
@handler.start_object
result
end
def _reduce_13(val, _values, result)
@handler.end_object
result
end
# reduce 14 omitted
# reduce 15 omitted
# reduce 16 omitted
# reduce 17 omitted
# reduce 18 omitted
# reduce 19 omitted
def _reduce_20(val, _values, result)
@handler.scalar val[0]
result
end
# reduce 21 omitted
def _reduce_22(val, _values, result)
n = val[0]; result = n.count('.') > 0 ? n.to_f : n.to_i
result
end
def _reduce_23(val, _values, result)
result = true
result
end
def _reduce_24(val, _values, result)
result = false
result
end
def _reduce_25(val, _values, result)
result = nil
result
end
def _reduce_26(val, _values, result)
@handler.scalar val[0].gsub(/^"|"$/, '')
result
end
def _reduce_none(val, _values, result)
val[0]
end
end # class Parser
end # module RJSON

View File

@@ -0,0 +1,27 @@
//@jsx: preserve
//@module: amd
//@filename: react.d.ts
declare module JSX {
interface Element { }
interface IntrinsicElements {
}
interface ElementAttributesProperty {
props;
}
}
interface Props {
foo: string;
}
//@filename: file.tsx
export class MyComponent {
render() {
}
props: { foo: string; }
}
<MyComponent foo="bar" />; // ok
<MyComponent foo={0} />; // should be an error

1053
samples/XML/sample.csl Normal file

File diff suppressed because it is too large Load Diff

213
samples/XML/water.tsx Normal file
View File

@@ -0,0 +1,213 @@
<?xml version="1.0" ?>
<tileset name="Sunny Beach">
<tile id="0">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAABYklEQVR42tVVq47DMBDsp/hHDxQcOFBwwMAgwMDEIKAgoCAgUqBhqH8l50126lHaq9TrQ7pKq8TOemd2dtfd7f7rz3TTbNpibpyNT/N7gUOxSHbKs+mLlW+vAwaQJ1B5ulQN+88kYkIJ3GhwkVwyFRABvKbEkKvfI0TOGYkha9nDe4AiqfqIHZUoznbTfURwYA1agn+rvAL2VRpuX8ym1Rw9QUpIiB/WLQilRZXfgXuVziro51hr69HxtPZUAlk3ui9ErZYNvvLeEplAU7MAx00tj3mVEhkMuWYdVeZGQTrtCZTDqz8IsAotleqCCDcUZ7aQUduSsanKjnVDe44yx9Qogdvj1k21m08KDiltqllAdnwX+xgvRzNqvLuaUQ4EDSCgB8oQtb4GxIBDfvxeOE9ApO7mUjltWl5HvQfiMy+kXhXBjGP8DhsF2rTYa6/kQKPFV7Sf3vinFLQX3Np0f43zA259mZw6IuSNAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="1">
<image format="png">
<data encoding="base64">
iVBORw0KG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0ac1tIiqseI7xrHUo3HVBRKyPmhPKkCCT5MvBeniWG/Ui8dj+OP+yBR6UvVSsiZ06ZCVwdsiun7p32SM519KnUfJ6SutsnJtPHX/ShhxPN+v/WeP+Pal6x1OIpVAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="5">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACTElEQVR42tVUr2vrUBSenKyMjI28MjI2MrIyMjYyaoSJEepSUWhEoc+UMlFKRaAVhUwUOvFgExMVT0Q80X/hvO876X2rGlvf9mCBQ27Opff7cb7bq6vv+qw3iRx/T6X9NUaV8t+Al7tUmk0q6zqRfBsr+H6Xy9Mj6mf+dUSennNZLmI5HEoFIoE9QNNZCCfG0jyk4g5dabap9j8N+PBSyB6Ay1UCkEwP9ye+vgmY1311Ib0PlRh7XuXBkUyOx+nlRFQJAPW9y4REWqhvtok6oT26AWem6K0xGhLjKOYPiWT3fYnrUMzAFTMz7ydCZeUukbYtNWDnituXUrrwjcUZOB34JlYXSJTquTcHmRC/MZVRN9h3bh1dvzljzpEHqTINVaFlVVvFtDutIx2JP/K0T0cIzL1s1ZfiRIzkvYGna+7x7dw5r0SyRaTAnB9LlbdjDRn3qJyq13WqB3ezLnBQLMkkgNWR3obmGePC3OMfgSSLUIH5e6veTEzXm0VKwoyMBvjVAYDzetFCrglkU22tVdvPg3YoJMahcQVQHBbOfAmrDsgC85wSmTBDT4JFoH3m4s3Us5h6hufc2jlGoXmA9UusUygMoCw8qck3nUNqOwhmGBOLoAQP4M67w5itIs2BHQfJdA4UmvJ+BeWrUMuH8ilGQmBabYvf3OP74uvIwLBI4PrmWtxRZ2ECNTy4d9v7m3AqdW96SL+nZLn3aX9I51fJqqKt/O4BlD0lcKov+0umMmt1+Ygc4BZwrcT+xeqPPgT0ht399kbexcB/AEhbiVW/ps4pAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="6">
<image format="png">
<data encoding="base64">
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++vXzZjkiQhkvGhPBQHKZwAMwKAHg7ThlApvdRyYBal0PXJsisYwgAJAVOAFv9ddMhYfHp0i4t5cRoQcROJDYJYmHklxUBoMDcxUyAZVUg+jCm9H9TgQO8WIVQcXLFGU+6TFJjORUJEZndI7gTXyLisFvzcgoNjXY46ObmQpJyEgGKoMqITlXAXssbfYCEQeysztkWMoPcXTniLCxUqz3w5SrbEczr7JK4InsOaWQhGZTI2P8PW49YwkPPx0SIZkpCZxRxbxVdDd7gaq+yIzwQKVJgErfUmsakwnM5j9Uimr1xRMIPrgFxpHk206lTckrBE6uJ3A0dWcXXEhjUkQXf+TNqJl/tMG47UpWbLT4ipb2jn9KKnmhjvvi2jw/5gK11tLQbjMAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="8">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACOElEQVR42tWVr2/bQBzF+ycMBoYaFgaGBhoGGoYaGgZN0cCkDERKQaWGBBhEVUGkBVRywCQHRDqDAIOAAwUHCgxG3t73e7nVqbQf6tpKi/TV2U7k97n3np2Li//1Y6oxim2K2zyBe5jj3YTtcYqSwuW3DPVhouJ6vss447cDKe5T1PUUhiJf1yNYO6cDPN6kCiHfm/2Yk+n6asJhp7I7e5yr7TJeTK5NCTY5OTLF7SrRYx268mLhXm4x2AHxIzDcNxSb6KgYAZrHGw8jzlQTFRN32nDl1oMI5F8Ld+8MZPoU7W8d4gOQNdCby42cu1EAOW870/C6wDlGEwr6PDZD0F8Lb2p0c4NoZtBbcve5Q39NgIoOfAdGRyCxQEpX1HoKyU2dm/syEuBnIZ/FJk4IlF6vfFznwktzPqsavY1TF3pbH8Xw4DDY0w1GktTQOGSHcvMA4SPIFK5dzOBEHSD4WyvO7FuOdBctgHB8bdD5WODyzjKOBjFdESBxIqEzqayMaESoEXxX9HEMIkfvkoy4IVDaj+o3T4kKSw/ufSTdWakwceU7ITCJA4+tuhTTjf7OR5XUDYaMagwfWXhCilMsZ9b/sYwCsPDinSuun0qEJ+NDXrKcjT/fcF0RhhAiPhCQB66O1wmnu/6XF5Q6sD71hHGEmDrXJaJlrQ5FVwaXa6sdESBxYyAQhH21F5KWVRzJT/34UqLzudCOhJjaxX2zV3IoabR4KqxEIjHJvNufUpSfIGT3s5cL/wB3sgL2s65DmgAAAABJRU5ErkJggg==
</data>
</image>
</tile>
<tile id="9">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACYUlEQVR42tVVoW7jUBDsJwQGmhoaGpoWBhoGhgYGGp2igpN6IFICItUkqgKiKiBSDCo5IJIDLNkg4IECgwKDAwYlc7P77F7InapeW+kirTZ5D8zszOzL1dX/+vGTAulhguppjof1EF8HXDYIn4HBocGoBIpyyoqQnSas6POIOHEBZ8tKDIYkMMwBY+aoqjman3dIH8co8og10f5hwL3ZHv3vKYSA+2jg5TX8Y43BETp1/TwnkalWdpzgYTPUrsX79088y9BfZOgtUvT53VkX7Clc9rEB/F2FQSW9Zg5uYWiFAKaHTokI93GoROT+zcDuhpOynFWhwP2bVBXwdgbukndLA39TIUgaS4CZcI8V1anQ1HdWjfNUiYgtxtyiYDb2u5Hm5c/AW2On/JFp9QgsKjgLS8TjxN6KJGiFTO2faoxqZoF1zUyM2cMz1JKM4DK5EJEtETL7pD0rrVW/pWaoZNrLcjfGqhC3Zy0xISBEglOD4NzYPLAPSGAiRI7cEG5G+AINp5ARFaQyrqz2jpgok18o8gq2ugBeWvCOlJdQ6q2oYNQKb0VVaIe3rXB9qGlLDYdBlTUVYjKtKKAqUAEhpPko/7IlFqxQzwX81RrJA7PQ+9aGUraCBBU8b7TL9O6hQiRqPNEe/sbLvX0n2s14+xZwEifOrBKU37nJtAuozQTDSFBnYc/EmgEBAyoxJnjITbn0/p/W0dnZnMhGdDb1l5Zcp4ooEPB19NZU5MTpSUI8/7iXMGkVaTOh2yLg3bbwzGcGAtrhU4XPe5LbkLrxZWDtoyX1ZX9K8iIqCZl+9n7gXyTF4JLCnrXHAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="10">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACQ0lEQVR42tVVoW7jQBDtp5gaGhqaGgYGGpoaBgaGBvbASSmpTgVRFWCpAZFiYMkGkRxgsKDAIGBBgMGRd29mbQdVV7W9ShdpNJvx23nvza6Tu7v/9ePtGvg7A/+hgfezwvcR5yR9MvAem1uw5u0ZFPXviIWIJAHJ/S1zaTX7PxqETx3CbXcT85VCpKmOmTnYk+jcI6itEsskgrxDVPRILeAXFl7RwWfNO3xSiCcE28Et3QmR/2AQ5hbhwSJi+CQLBhEhI9gxKCI4OIz7zn0U827ikO7iVyA+gSQ9oi0bPRp1HnM9z4G0BeZ8PiuJI2Zecy01iTOQFMzsMROMAcKSU5O7QzFvE7e9kkqzhHnBjSmbROKYEbGWGEeado5oxojqHlnvBCWCN66HiJH9ijs5Q7HgmWU6E7Fp13jeJgqoygWaekkQxbQOKOpnV2D5mwStcxoPbkVQwvqsc8SZdfWA05Je/XWD5rxEc1pifiGWz+NymBS/R+w9CRHgschwPGQwZq1CmtNKszQTkv76S9eCk6bW3uNln6IqFlo37YrrTNcV93WvfJ6nsJd7HPeZZtknXG8exbix69aa1UHtXHSclggU0pecQs+rYZ0qYVUvpmci3hgXx1EU492XUYjEmebBXSeTYePjIdVj00kNAhVXLyYRIk5CXdfLj7+OQizxvEvpxI3WkbmpjCK0vr85bSjE2s3X/SAJyeSaxOPY9UyHezIeUfUZx38VcnJOx8tVlSJgNd2Tb/tTknO2l41eVHmVP9rnD/NFCxuaQAv3AAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="11">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACIUlEQVR42tWVrW/jQBDFCwsPFi41NDQ0NQwMLCy9vyLgwIGCgIAAEwMD62RgEGCpAZEcUCkFAQYFhgYHDI5M35vZ9VWV7qT22koXabRrOTvvN1/ri4v/9efqk7gStr4Tt+3kc4VzWHGSqO7NdoO4XS9893HCEKRIVMDKXuLDaGuOZwCp4dk17wzi8k7cpjPnFcT2AwziG8vCbChH1CITbW+l+deMuHU3O3Zbi46iIdIYMGkvktSDLM4iiyP2u1GS4yRxC0C81/P16XUg4YBGRDGARACIGfU37FedgXgYdwvQAJsbrFvdGUDu/QQYZOXPwj51KriG4HcY6p3UiKqBHSaNNuW+GXSvZQnCKJOu7AH6IDzBS+sRLV/ty1g+y4jWqnhRT3Y2ROJq0DU6jupMo4aDGF1PxwTkBLD2armHYZ9QnA1a2JkwMZqhrS9t/mx8w2iFiFSoMoG49SBwkJwndUxxXZkNwnpAhSp8+TYWuVrjA/UAfx+32kdBaoozyqKfnc6j6FeFK3y6V92cLbf5fWdoiV/TjBHmPEE3pwBJykGyBj2AkqTsdFiKTLAfUvYI+iHZ2/+ZEb2kcO5L1clVdZLL2x9vH0cVwZgpTAGA/WRiAYSrLwXf8XnxIBIdrEnf7UKK0YgZZvx6FLn5KXJ9NlvuRbJ20rtg+Yj9AyDux4+7kimU4dJZEgAgX38hOxDNDqIZ+LSPEtO8uIdRePf2iJ8AkT7BKeWMTHEAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="12">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAAhklEQVR42mNgGKpgztI5/5Ex3S2u7mxGwTR3CC6Lae4QYi1Gx1GZSWBMscVAJhjDDCTBYjAmOUTQfUysQ3BZTHTUEApqXA4hZDHBNEJqHKM7hFiLCTqEUBzj8impaYVg4kQ3gNggJuQQknMFqXFLyCF0LweoXiCRUQ7QBhBRDtAHYCkHyAIATRZdO8VgYzoAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="13">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACNElEQVR42tWVrY/bQBTEAwMNDU0NAw8eDQwMDDQNDIwKqqisBZbOINKZRJGBZRlY2gORHHCSD0TaggJD/xuvM2+zl6hqq7b3ITXSUxwr8fx2ZnYzGv2vr7DoJCqsxFsr44+VvJtwd1xJVS4k3HYSl71MT4OEpZWg7GSct28Hss/n0h6WUtULud/OpHtcyb5I5KYeJM6tRBmAil6CXSejzLweCFdrHpxwd1zLfjfXMXUipklk0gxyexwkSNtnJ4IMTtCN9AXRtF4UK+WKTbPUoQv7Yi79t42DgTM3DwN6YCRCH2JcTzCEGH8yzo2/AaEwRe7SqdznMxWvigVE6UQi9rRWAMJ5Z+LMukLu8I44psWgUGHq3Bh/MYCpnCu/etFOCtqntXs4P0PcC7eHlbMe96+d6fvPMkEZ2QWKx4jjtmQvepmgE4RSkPQMghld7xq/Wgox78u4jO+ymQrynjqSXeLQCOCG/bpR17SIEIwfBxUn1PQJbhwAB8gwx075ULn5EYRiPlPfdooQhMJ0oKM7APFOMI7rmPg70ywkAgRd4RkR1xBmNE2vMYWA/O254dtOi7nnKeQb72PwTrQA9DF5N3hfhTm564ZGA1ei2v55GZ8fmDsBLacCLfUeY2uPS9eJs0s+Pl4H2JLRoddOBLv2Zdvx0hPXfsJpR+DMTyFYXHyPW/XVDiQt5HnVVe12iIfguA64iAj5ZkcyxTSC7LxldbWJQhHy3f6U9Mw4bVDWta78X5/zHZ1ZvLB/eOxTAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="14">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACSUlEQVR42tVVLW/jQBTsT1lquNAw1NDw4MHQwEKjKjqWgkgpqFSTgoCAAEs1iBSDSDaw5IACg4IFAYamrzNvN70rqO7UL+kijXbzIc+8efNeLi7+15fZdmLWwHIv5raWbyOOyl7MfSfR2p963zmJmgFn/3VClBDk0T2wASqnIuKNk0kxyKQEDqPERwBiPs/qvBZzU/tqaTmqNUUvNge2TuJdIIYAklsK2Pn7BHg/8bLWClmtuQ3kN506YAunhIkT+XEUmVQgoxCe7SjJIz7vAXxPEe5p8e9CTAESWG1Lpw9NylER48HxEp9fd2IhgrYnu1HSSvSkC2kQM21F3+93M+n7hXRNJg/FVLrj/G0h7K/ZgByVm2tUf1VLvPb9jYEIVdvQc62+8raTSFuB36QgnopIehCtugaxe1pJXV2CPJP6cCk9RPB8TRzSfE63ksEB2s/TIlQWbYgA7W8zauhiEvMOy9NB5Cdsn55EhtMdsFIHujZ7caI/i3ici6Mz7R+OmPy3iJc7e7/1ghRM/wHEaAExgRusPml81dqSxtvv3AJYyUM59WLKmZ4URDfebgWJuWQw0xo8JF5FBEERgmhJvAntKLwLtJ9tmZ98MAeQ9/1csa9mWvkr6/8aRgrIw/ghE+aXzwZFkJzLh6N4DiNd0Gy0fgJsOyi5Vt1kHxtHdYFCrvY+F2H+mRcVUPgpoAiK4fhlCCPFfN5CKoMja58PToi2IHd6TxlEWM8tyF3wdX9CIaRRWE5cSpyS80L6vn9DuBGdhSCY733OM8S85MLHyAKwAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="15">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACUElEQVR42tWVr4/icBDF90/BViIrschKZGVtJbKyFsmKS8CsQJANgoSKJosgAdGkFYgKxFcgKlZUnHn33rTcj+Tukg27myzJZL5pE+Yzb958+/DwVX9eXsNb1xg8HjH4dsSnFfZPDYYbh+HWwc8ay17uMMgIsyk/DkSFgiswqYDgDPhFi2FGiJXDaNvAXzsD8/aNwbxb4Rhd0dABowIYXxg8T3iWAqN9izFhgopAVMdnttHcq0h9TlGeEqTfgbhhMEeXXwoEVa9C37kvFTSSvIGnsQjiqTSIN4GosOJ5E+Eli7DLYhwPU4QESF8JcaICWWtgAc+SXmMY8zwh2Chv4T/WnU96rwxuMP8bTVkkLBijuc4tu8vc4rifoq5SO6ccx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V1n1vRtiqctC34Hej6NJe12PbJUwiwr/AiHdeYi5OKHw2Z8LtBpzgrJ86cJ8C5EBPJRG3hFEgzV9BiznjmAJ05/WsAOrFo249ChDMV+gYOC9zoTPLVy54H4bvsxXDBStU0jVrBa92ZwJqBAPZrquXujKbP0v9rUv2D59eHLDuBZ0WNmsl3Cr9ZvDb5TP5dq3Slztu3XbJ/rU/pX7WBWyaW331d/4B+NMC1rjos6YAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="17">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAB/klEQVR42tVVLU/DUBTlp9RWPln57CRykv/BD0AiEBMTFTUVFRUVT1Q02QRJJ0geAlGBmEBM1l7Oue9t3QKEAIOEJSdru6Tn4577dnHxXz+J85JUwGIlSd7LnxGn3VZSEKfNIEnpAxyuW6DxvyeEhGkL8gLk9SBmsxPjtkign7AXc04hhsTlIFkLQgjIHkd1m+ZeTMM0hjAKkjOFLt7/NJH5g4i9H5U4c0AH1FsxAMnoPtuMYiCAiSQQlCCdpPaTIKLxXxOSIdr5KDJ7BNaj2HonlgLg3BZbsTlEFENAOUGToAAKuVkF8iKKUUG9pvIx8RMI4Mg2ELARmTvRa5JbprAOCdh21BRMHZxrN5jCnpwduAPZMvaCz3hdHYkpjrbGPOzk6kU0UkZOzF9CAiTht30OYmbdKJe4T10YhfYAwnQzulBQdc0e7AUcp1BFkfl7QjhTvExFIHoWTIFnhEUnMvxmMIqT+FlEjmDpA+Gyn0axOHLu4tpGAR+OYob4OW8S0Wm6DiIOZYTzzEVxFMAk3DA5u169Xc0ypvKVMnI0PHA0mQpkOVaxjNFzLdEXjiAtYtylP0UXV/Kn54I6Zho8fBb+UDyeCdp8kt/2U+v3rtsQ+flOQo6CxC4Qq3tGftufJlD1it87kqvhICCph+n4/axcZ/83LOKOL0LpvvueV8nivBN16X1tAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="18">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACQklEQVR42tVUr4vjQBTePyV25MjI2pGRKyPXVlZWHeXEQc1CKwoXU46IslQELiLQiEAiFhKxYkTFiBURJ2Lffe9NuqUcy+4t3YMrPObHy/u+731v6M3N//pruzkdyik9pDH1zyv6Z8TuuKQaxHU1I/u0EHI5NzPE/POEHIopWbukFiQ/sztybgUHsM+nIoLz7eMcMZP1asTSqV1Id+64Ets5PBnfLX1eHFnSwy6WvQRc+TBxVBHdOqJJM1DUEMgWEkIGATT8EBJxplu8CGJxYdmTeSQK85506Ujl9v1C+ONJNwjAbUd094QVAnTTy8yHX98pRm76TBRb5DmOOBORacaakZwjQt4AQ2cQUrnXhXBSui2JogLgCFNACM6mHASIhbAb8dETRQBmoVHnv2FCgxy7x2Fy1FcDTYCjcwjYW4kgqc9CAnQcpC0F25ZUaiksejgA68cuWH004Jz1XhyfIWbCOQCHEM3fh52/03uHPe53jvTWkt7ZC3KFu2DTes4LIYkXcRKiuBBgGvNUGfYF9hCnKggEuMlAkjovmDtMrIRKfK0QrWtPhHMADMHf+Hh1FPLRHlGMznChKIcwiFTrlnTqxYkLbDG7hRmHuDNJL/fsgNr4ZgST8fbt+x+jFMAiKb7H+rWWlUHFVjgjXbPN6XmMvAppMUb2l8R/CGHyk31fDhckMiKMQW/8/kUsr7mvudofkgCyIzxffiNrPw71rZb17EAt8Wl/yULCD/b0wLbjO3nrcV1dCLvBpPcHsf2jOL8BAQzkc/Yiwa4AAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="19">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACN0lEQVR42tVUr4vjQBjdPyU2MjKyNjKyMjI2srKyticWeuJga1ZUlFIRaEShEYVUFFJREVExomLEidjv3vsmuestt+zt0j24wGPIJOT9+iYPD//rVZ/GsiszWS0SsdeZ/DNic5lKBeJqP5LmPFFy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GFsqssaY96ifXrUnXAoBo/RePsBmbc+oS0xNgu0kBsBRznisUr4/ggxQw6QUwZ5FJgwigMSJ9kmQEcgoTXRedObsY8l+Nj74ZH25Oc6H0rLUQxX4ixsxVCR5jFmrGFBMPDk5ssxBx33RqrQUFqFD/tvZeWQU16JnMeH9QldVvHmkBOGkbGzQrA5CCBV9Ye6eqWLuUbZ5qznsmlVeCKxv9CMbdI9/hHJDvCAZ1APfnVRznOjVXwmmZl/upfrfNUtVwAOBqFKxVC/c1UENVRG3qAHAOigBoAFXio/13M1JuNSNhQiPNK++VzqyoucsdIP2qOAAPvZJcvAoJlHnRz7Ez5TrtDMlIheowMUF4j9G1ecVYf7UXkkp98A9ujanmPczUK9vcK8UV8PqbvZKpRvueoCGpQFvj9O/2p6QK5JMg9/zZjX8CTEsEAZI+lIoAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="21">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAABfElEQVR42tVVoW7DQAw9WFhYGBoYGBg2RQVTpIJWChgoKCgYGBgYGNh33+7Zfo6jVZuqtJtW6ZSrk/g9Pz9fUvqvv+a4yt3zWlZb9r8H/JQyloC/bHK90z3jdwPuATYmXfuUh7cq91glPrxXEmtGXYjdvOL2vM7Vg17xHyBC6lH3iEENEMEziIPMoooJHsGkSiMEHwCUpHgPRBGnQlcpcglY9pYM++GjFhB6AUT6181U/W56nx6R575TREBLIoJLT01WVigKWGIkrLZJgU36ejt5wL1R7uEqhJHfMGbAsYdIgORkLjFUaNXENpCcE9wnrz7mxfN471CUi36CkrO5FnkL2/akgN5bEjCJmbCxieBe5I/KnVZfvMF8P7reWzJOQKiAxGKlVMKNauZ0HwRvXDd+RoDyM4bKOH4wJ/ZSrfUYvujCO7i/6ByIhoqOjj3mNOAqbTRv3O4kLJV2Z03uUzLqFMzGDa0oz971W+BngynDNjR/8VGSM2HB2f8JRvClN9IGbE8AAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="22">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACO0lEQVR42tVVLW/CUBRFIpGVWGRlZW1lJRJZ26CqlmZiaeaKICmChBlCEM2CIAGxpAiSIkiKmKhAIBD8hbt77uN1H8m+P5ItuenbbXPPueect9Vq//XHvG6SOTBV8fnPgJu9JqHaU5vMsUnNiwaZQ5N0/9eAraFFxrUh1bo0yGYC1tQi9HFGT79H78eAHR6GzVqDFvljl8y+2hbbA6h+UVdKcK9x2SDjypBvG6wMyHwZuLyPqNiEdDgktJh7VGwjqbKMKkLugBXotSictylIXQHEu3q3TgYrohX6lCIARt3OPMqWngzO1wHlq4CiZYdOx4TPvpCL+XdUtg1psgvkDGLIBYgAGKogIwjrm4oUPCRb+gKAc7ELacEEAFzuQCqmDMD8Ln+izGTLxFiBZOWR0+c8MFBn6kghGyBgpzbVujW5LahnYcXg27QjWyZzfm4COWNDkOiwzABEH4QWc7+yI7vzheDplJC2zLuxyR1blKxZvZlbWYOs2DO7sg+EnNR5JAIwbIihZRkrAls1FL3ojuXnrUFOKwHgOG0zMV/6IAF75MyqhWwJVIKqL9V91QqRd5+wxLE88bEiw33YwGS0EgDRNmk1vIEt/cM+lsCisjMp1IfDqAfK87zdAcqI9J7YhuunCcp3sO9sleSGS7behN+7jtWtWAWSBwWmVBG7diqYCduhNy02yMbo5/4gAQRbCyADx1O3IoENAaotyr+z8btEztdVhytfg0BU5eTP/inB59NxJEHFVf7qnAcPbLZlMU2ZQwAAAABJRU5ErkJggg==
</data>
</image>
</tile>
<tile id="23">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACPUlEQVR42tVVLY/iUBSdn4KtrKzEVlYikVgkshKLZMUmjBmBaAiChIomVJC0okkRiCdGPIF4YkTFmrP33DclzSa7yczOTDKT3DwohPN1z5uHh+/6115SnMo5dtsp4nOHLwO2zytU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ItgjA2BcLIHxOwJwKsGn2bCXZhMq8BOD8OZQUe+ncSFFESoQkcuSdbZyv8RKala8ogDWLJADAxmxSbCKVlXsZlUFh9R97jCfI57vZYgeYJJhHW1iD9TQOEJyP1wkFxqMdK/qYrQJdEzVlJHIWYpyAkqnRovnaKkMWL8tYnGU8D7SNYLivgNkYgAsHArkkwBpHBT6RjQmcGdtCAcrLAsxjYTZ2NvH5ABY55WtfZz0veP9U3bNWqLwvMVhEOo/hu1ODIMygeVCCcppBS1XgNc3U612czYrC6kj3tnyQ/qufk1fnE9lS3AbapkqBjVPJSc0Y7XRAuP+r63i4FQCUuWaYeS1dQ43PjkzzFc9G/+8+SGxyYP3Ob/V07zstcuAu9kl215UA9NotCcDuD214vT8lHkSedItDym/ET+u8AfUc39TwIyvtAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="25">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACV0lEQVR42tWVr4/iUBDHV1YiK7HISmQtElmJrCUnLlWbZsWlwbHiEhAkrCEXREMQJEVsAoKkiE1YsQKBqFjBvzA3n+k+cifuR/Z2NzmSyXt9fW++P2Zeubr6X39p3pVgHNQxaMqHATdvm0IEEwWeBdK8btjcrb8bcHvSFn/gW7RufAnnobTnbWGdOWvuPWtvrrg1bon3yZPga60W9QB5155k9z2ZrnvSuGlIb9yWRMvTUGcg80/AALjR2W0ODFpGKJl1ZJhH8m3XN9D+vGNxeEilWMVSVSM57FM5PmV/TyS8CyXMw4tK5iRNV5EsFChVpZ28I/Gk3sN6pjHcxeJ/8c0NiHGmWPfleBxKpCWCxOHxN0ToZBI6cJIxYisgHEatA13sE/E+ewJhR/D8PJKO3op0GRlgqeqrk7rwmFqUu0S4PYwXYJI4qwHDYutqtRtrqSnkim1fFmorNcfuQpOwP5nr/CmVZNk1uzdbBVnXZDb3dWkYceL4QgJylT4fHn5wBMXUFQeC25YpQsF0HctIlWNtqQfZM1KFhZI7nDJzCqtxgXfltp4DCiF6wcjoHkb6Azd+WQqS+HqlUFGq7XVzdQ3IqWLPcBapaiWiBEtVzTpjsVK1eq46qeJjZrFRUij/yfo//WhArI/vaKDhxbbRqqdgsSzyntmKGsoCgUjLVe5riwFzpHDi1deRZMRiGRsZymKJdcSlukFTey5feoC9pVp9Pk/f7oMEiFNNw1JbAN2dR3GlTjly7/ZJBpCGcs1V7pTEPjObefdhf0o03/l5Ktk2th55bZ7vlm2RtXeU/5AAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="26">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACSElEQVR42tVVr4vjQBReWVkZGRsZGRlbWVkZOXY4FU4sYcUR1nVFIRWFrikloiwVhVQUuqLQioWuOBGxIuLE/gvfve+ls+yJ+8F1e3CFIdOZl/f9mDcvV1f/6y+89RGOQ9j7HqqnFP8M2L/zwRFOQoSzEP51V+du/WLA0SSCd+vpCG48xGWMbJUgLfsodkbX3D5jPwzYlj2kyz6CcYDOp44Cci1bD5CTwKKPh4PVNc69L57GmvtY185S7GwlqLObCpk43wn4rAczoRMDBZ+uDQqZH58yHfvHFPtdiuZliL8C5lyBOS8juL3eogWeP1pMNwZakBJHEq9NgeNzJkQSbDcWdT3E8ZChWhmJN/hlcTERrXVWcq1701VLOSco96g43yTIZ33UzVATM9773NZAthyg/ppjL8CMpxMkRTfq51yfb8CpBDtlBGMCrepTdSfjCFnZgpIA/89F9VzUzUXlgzyPYvFWriKVbgWsERdevxXqAI/COVELiam8Q3KN/B9u3jlC9SQRL2KEd4GScsqdxXrWUpBWzn66TtQtKq/WtlUnie2sLT4qbV4KtV7JSAyfWh9C5Lf33AHTQnuq/EpedjfCjOU4xD0jZNiMqJJWVyt7AhfFda6jWCZK8Afr/6ThENTdax6PI+WPfCSjqK0DGcYROKR6Y0ia75CIqj5kOKvzMRmPhiRYF60rbS/gvtaNtGV1TBzSYxyF6tTHdUJew1GgyQnqOl8sDed9S2YMYy/6LXjrDXRGWjIBO9edy34LfvpREjLn9P7vqg9kQ79shN4AAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="27">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACMUlEQVR42tVVrW/bQBTvnzBYGDpoaBgaaGhoaHrw0HTQKkuZByK5JKoCLCsgkg0iOSBSAiI5YMCgwKDAYKD07f3e+bwUbNW6dNIsPeWcD/8+73Jz879ezdlQvVNUrCJS+Yz+GXD3NKcDAx/2mtpvCfXPqb0/ah7zcUTqrSK9DqhhkHITU9el7ACvKyUk8HlzMjxaXq8G7JRCXfeUiu2Yx50FhCNtmwyOzKnII1nLsCvvBvYXPk3uJ1SwonQdMVhCejkTF9RqRi/fM0uGlbfnRMDgTj0Qy6qYo7FEQPKPgPU6FHCsvaVn1yufHKmkiiheTIUMnEk2Ib30mTjRczSuoEKunY+xNUz0l8B4sHc3EQAMVMZQzANAlQcUfvUpePBlrRgUD+371JaRCbhCGhZwGVu2jYWUxHS2cb0Cdsrihynd3t2St2DVXz6RqUJKlgGVUMM/KtnWYh1LHBgohM2OhI1AS0Evi+mcaB0J/m7H98UlEad+mk/Ju/8spAyr1Kw2Yrs7FOxoM3U5A7hmUvNVOD543KKsFOrFJZAZdovslLP5fRRuQAqOmDzkCSjdKy5XJPGUG1u+ciibcwPvF0zC7Q5MPZB6Zf1bl+tBynmiZI87tv+oButj2W5SMFYj1m/dYWSjAjmMqP6bAwq2YhAF8j2MYEbsRExSMLxf/VTaHLUU86pn/6j6ZLeVIwGFst+5J47cx/0JnaxSV67DHgTsDrjqEfzWhZz750yajiP4vc/5ASZt46J2q67KAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="30">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAAF0lEQVR42mNgGAWjYBSMglEwCkbBSAcACBAAAb475JcAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="31">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAAF0lEQVR42mNgGAWjYBSMglEwCkbBSAcACBAAAb475JcAAAAASUVORK5CYII=
</data>
</image>
</tile>
</tileset>

View File

@@ -5,18 +5,6 @@ set -ex
# Fetch all commits/refs needed to run our tests.
git fetch origin master:master v2.0.0:v2.0.0 test/attributes:test/attributes test/master:test/master
sudo apt-get update
script/vendor-deb libicu48 libicu-dev
if ruby -e 'exit RUBY_VERSION >= "2.0" && RUBY_VERSION < "2.1"'; then
# Workaround for https://bugs.ruby-lang.org/issues/8074. We can't use this
# solution on all versions of Ruby due to
# https://github.com/bundler/bundler/pull/3338.
bundle config build.charlock_holmes --with-icu-include=$(pwd)/vendor/debs/include --with-icu-lib=$(pwd)/vendor/debs/lib
else
bundle config build.charlock_holmes --with-icu-dir=$(pwd)/vendor/debs
fi
# Replace SSH links to submodules by HTTPS links.
sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules

View File

@@ -1,13 +0,0 @@
#!/bin/sh
set -ex
cd "$(dirname "$0")/.."
mkdir -p vendor/apt vendor/debs
(cd vendor/apt && apt-get --assume-yes download "$@")
for deb in vendor/apt/*.deb; do
ar p $deb data.tar.gz | tar -vzxC vendor/debs --strip-components=2
done

View File

@@ -3,6 +3,7 @@ require "minitest/autorun"
require "mocha/setup"
require "linguist"
require 'color-proximity'
require "linguist/blob"
require 'licensee'
def fixtures_path
@@ -10,8 +11,14 @@ def fixtures_path
end
def fixture_blob(name)
name = File.join(fixtures_path, name) unless name =~ /^\//
Linguist::FileBlob.new(name, fixtures_path)
filepath = (name =~ /^\//)? name : File.join(fixtures_path, name)
Linguist::FileBlob.new(filepath, fixtures_path)
end
def fixture_blob_memory(name)
filepath = (name =~ /^\//)? name : File.join(fixtures_path, name)
content = File.read(filepath)
Linguist::Blob.new(name, content)
end
def samples_path
@@ -19,6 +26,12 @@ def samples_path
end
def sample_blob(name)
name = File.join(samples_path, name) unless name =~ /^\//
Linguist::FileBlob.new(name, samples_path)
filepath = (name =~ /^\//)? name : File.join(samples_path, name)
Linguist::FileBlob.new(filepath, samples_path)
end
def sample_blob_memory(name)
filepath = (name =~ /^\//)? name : File.join(samples_path, name)
content = File.read(filepath)
Linguist::Blob.new(name, content)
end

View File

@@ -15,50 +15,47 @@ class TestBlob < Minitest::Test
end
def script_blob(name)
blob = sample_blob(name)
blob = sample_blob_memory(name)
blob.instance_variable_set(:@name, 'script')
blob
end
def test_name
assert_equal "foo.rb", sample_blob("foo.rb").name
assert_equal "foo.rb", sample_blob_memory("Ruby/foo.rb").name
end
def test_mime_type
assert_equal "application/postscript", fixture_blob("Binary/octocat.ai").mime_type
assert_equal "application/x-ruby", sample_blob("Ruby/grit.rb").mime_type
assert_equal "application/x-sh", sample_blob("Shell/script.sh").mime_type
assert_equal "application/xml", sample_blob("XML/bar.xml").mime_type
assert_equal "audio/ogg", fixture_blob("Binary/foo.ogg").mime_type
assert_equal "text/plain", fixture_blob("Data/README").mime_type
assert_equal "application/postscript", fixture_blob_memory("Binary/octocat.ai").mime_type
assert_equal "application/x-ruby", sample_blob_memory("Ruby/grit.rb").mime_type
assert_equal "application/x-sh", sample_blob_memory("Shell/script.sh").mime_type
assert_equal "text/plain", fixture_blob_memory("Data/README").mime_type
end
def test_content_type
assert_equal "application/pdf", fixture_blob("Binary/foo.pdf").content_type
assert_equal "audio/ogg", fixture_blob("Binary/foo.ogg").content_type
assert_equal "image/png", fixture_blob("Binary/foo.png").content_type
assert_equal "text/plain; charset=iso-8859-2", fixture_blob("Data/README").content_type
assert_equal "application/pdf", fixture_blob_memory("Binary/foo.pdf").content_type
assert_equal "image/png", fixture_blob_memory("Binary/foo.png").content_type
assert_equal "text/plain; charset=iso-8859-2", fixture_blob_memory("Data/README").content_type
end
def test_disposition
assert_equal "attachment; filename=foo+bar.jar", fixture_blob("Binary/foo bar.jar").disposition
assert_equal "attachment; filename=foo.bin", fixture_blob("Binary/foo.bin").disposition
assert_equal "attachment; filename=linguist.gem", fixture_blob("Binary/linguist.gem").disposition
assert_equal "attachment; filename=octocat.ai", fixture_blob("Binary/octocat.ai").disposition
assert_equal "inline", fixture_blob("Data/README").disposition
assert_equal "inline", sample_blob("Text/foo.txt").disposition
assert_equal "inline", sample_blob("Ruby/grit.rb").disposition
assert_equal "inline", fixture_blob("Binary/octocat.png").disposition
assert_equal "attachment; filename=foo+bar.jar", fixture_blob_memory("Binary/foo bar.jar").disposition
assert_equal "attachment; filename=foo.bin", fixture_blob_memory("Binary/foo.bin").disposition
assert_equal "attachment; filename=linguist.gem", fixture_blob_memory("Binary/linguist.gem").disposition
assert_equal "attachment; filename=octocat.ai", fixture_blob_memory("Binary/octocat.ai").disposition
assert_equal "inline", fixture_blob_memory("Data/README").disposition
assert_equal "inline", sample_blob_memory("Text/foo.txt").disposition
assert_equal "inline", sample_blob_memory("Ruby/grit.rb").disposition
assert_equal "inline", fixture_blob_memory("Binary/octocat.png").disposition
end
def test_data
assert_equal "module Foo\nend\n", sample_blob("Ruby/foo.rb").data
assert_equal "module Foo\nend\n", sample_blob_memory("Ruby/foo.rb").data
end
def test_lines
assert_equal ["module Foo", "end", ""], sample_blob("Ruby/foo.rb").lines
assert_equal ["line 1", "line 2", ""], sample_blob("Text/mac.txt").lines
assert_equal 475, sample_blob("Emacs Lisp/ess-julia.el").lines.length
assert_equal ["module Foo", "end", ""], sample_blob_memory("Ruby/foo.rb").lines
assert_equal ["line 1", "line 2", ""], sample_blob_memory("Text/mac.txt").lines
assert_equal 475, sample_blob_memory("Emacs Lisp/ess-julia.el").lines.length
end
def test_lines_maintains_original_encoding
@@ -66,534 +63,173 @@ class TestBlob < Minitest::Test
# earlier versions of the gem made implicit guarantees that the encoding of
# each `line` is in the same encoding as the file was originally read (in
# practice, UTF-8 or ASCII-8BIT)
assert_equal Encoding.default_external, fixture_blob("Data/utf16le").lines.first.encoding
assert_equal Encoding.default_external, fixture_blob_memory("Data/utf16le").lines.first.encoding
end
def test_size
assert_equal 15, sample_blob("Ruby/foo.rb").size
assert_equal 15, sample_blob_memory("Ruby/foo.rb").size
end
def test_loc
assert_equal 3, sample_blob("Ruby/foo.rb").loc
assert_equal 3, sample_blob_memory("Ruby/foo.rb").loc
end
def test_sloc
assert_equal 2, sample_blob("Ruby/foo.rb").sloc
assert_equal 3, fixture_blob("Data/utf16le-windows").sloc
assert_equal 1, fixture_blob("Data/iso8859-8-i").sloc
assert_equal 2, sample_blob_memory("Ruby/foo.rb").sloc
assert_equal 3, fixture_blob_memory("Data/utf16le-windows").sloc
assert_equal 1, fixture_blob_memory("Data/iso8859-8-i").sloc
end
def test_encoding
assert_equal "ISO-8859-2", fixture_blob("Data/README").encoding
assert_equal "ISO-8859-2", fixture_blob("Data/README").ruby_encoding
assert_equal "UTF-8", sample_blob("Text/foo.txt").encoding
assert_equal "UTF-8", sample_blob("Text/foo.txt").ruby_encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le").encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le").ruby_encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le-windows").encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le-windows").ruby_encoding
assert_equal "ISO-2022-KR", sample_blob("Text/ISO-2022-KR.txt").encoding
assert_equal "binary", sample_blob("Text/ISO-2022-KR.txt").ruby_encoding
assert_nil fixture_blob("Binary/dog.o").encoding
assert_equal "ISO-8859-2", fixture_blob_memory("Data/README").encoding
assert_equal "ISO-8859-2", fixture_blob_memory("Data/README").ruby_encoding
assert_equal "UTF-8", sample_blob_memory("Text/foo.txt").encoding
assert_equal "UTF-8", sample_blob_memory("Text/foo.txt").ruby_encoding
assert_equal "UTF-16LE", fixture_blob_memory("Data/utf16le").encoding
assert_equal "UTF-16LE", fixture_blob_memory("Data/utf16le").ruby_encoding
assert_equal "UTF-16LE", fixture_blob_memory("Data/utf16le-windows").encoding
assert_equal "UTF-16LE", fixture_blob_memory("Data/utf16le-windows").ruby_encoding
assert_equal "ISO-2022-KR", sample_blob_memory("Text/ISO-2022-KR.txt").encoding
assert_equal "binary", sample_blob_memory("Text/ISO-2022-KR.txt").ruby_encoding
assert_nil fixture_blob_memory("Binary/dog.o").encoding
end
def test_binary
# Large blobs aren't loaded
large_blob = sample_blob("git.exe")
large_blob.instance_eval do
def data; end
end
assert large_blob.binary?
assert fixture_blob("Binary/git.deb").binary?
assert fixture_blob("Binary/git.exe").binary?
assert fixture_blob("Binary/hello.pbc").binary?
assert fixture_blob("Binary/linguist.gem").binary?
assert fixture_blob("Binary/octocat.ai").binary?
assert fixture_blob("Binary/octocat.png").binary?
assert fixture_blob("Binary/zip").binary?
assert !fixture_blob("Data/README").binary?
assert !sample_blob("Ruby/foo.rb").binary?
assert !sample_blob("Perl/script.pl").binary?
assert fixture_blob_memory("Binary/git.deb").binary?
assert fixture_blob_memory("Binary/hello.pbc").binary?
assert fixture_blob_memory("Binary/linguist.gem").binary?
assert fixture_blob_memory("Binary/octocat.ai").binary?
assert fixture_blob_memory("Binary/octocat.png").binary?
assert fixture_blob_memory("Binary/zip").binary?
assert !fixture_blob_memory("Data/README").binary?
assert !sample_blob_memory("Ruby/foo.rb").binary?
assert !sample_blob_memory("Perl/script.pl").binary?
end
def test_all_binary
Samples.each do |sample|
blob = sample_blob(sample[:path])
blob = sample_blob_memory(sample[:path])
assert ! (blob.likely_binary? || blob.binary?), "#{sample[:path]} is a binary file"
end
end
def test_text
assert fixture_blob("Data/README").text?
assert fixture_blob("Data/md").text?
assert sample_blob("Shell/script.sh").text?
assert fixture_blob("Data/txt").text?
assert fixture_blob_memory("Data/README").text?
assert fixture_blob_memory("Data/md").text?
assert sample_blob_memory("Shell/script.sh").text?
assert fixture_blob_memory("Data/txt").text?
end
def test_image
assert fixture_blob("Binary/octocat.gif").image?
assert fixture_blob("Binary/octocat.jpeg").image?
assert fixture_blob("Binary/octocat.jpg").image?
assert fixture_blob("Binary/octocat.png").image?
assert !fixture_blob("Binary/octocat.ai").image?
assert !fixture_blob("Binary/octocat.psd").image?
assert fixture_blob_memory("Binary/octocat.png").image?
assert !fixture_blob_memory("Binary/octocat.ai").image?
assert !fixture_blob_memory("Binary/octocat.psd").image?
end
def test_solid
assert fixture_blob("Binary/cube.stl").solid?
assert fixture_blob("Data/cube.stl").solid?
assert fixture_blob_memory("Binary/cube.stl").solid?
assert fixture_blob_memory("Data/cube.stl").solid?
end
def test_csv
assert fixture_blob("Data/cars.csv").csv?
assert fixture_blob_memory("Data/cars.csv").csv?
end
def test_pdf
assert fixture_blob("Binary/foo.pdf").pdf?
assert fixture_blob_memory("Binary/foo.pdf").pdf?
end
def test_viewable
assert fixture_blob("Data/README").viewable?
assert sample_blob("Ruby/foo.rb").viewable?
assert sample_blob("Perl/script.pl").viewable?
assert !fixture_blob("Binary/linguist.gem").viewable?
assert !fixture_blob("Binary/octocat.ai").viewable?
assert !fixture_blob("Binary/octocat.png").viewable?
assert fixture_blob_memory("Data/README").viewable?
assert sample_blob_memory("Ruby/foo.rb").viewable?
assert sample_blob_memory("Perl/script.pl").viewable?
assert !fixture_blob_memory("Binary/linguist.gem").viewable?
assert !fixture_blob_memory("Binary/octocat.ai").viewable?
assert !fixture_blob_memory("Binary/octocat.png").viewable?
end
def test_generated
assert !fixture_blob("Data/README").generated?
# Xcode project files
assert !sample_blob("XML/MainMenu.xib").generated?
assert fixture_blob("Binary/MainMenu.nib").generated?
assert !sample_blob("XML/project.pbxproj").generated?
# Gemfile.lock is NOT generated
assert !sample_blob("Gemfile.lock").generated?
assert !fixture_blob_memory("Data/README").generated?
# Generated .NET Docfiles
assert sample_blob("XML/net_docfile.xml").generated?
assert sample_blob_memory("XML/net_docfile.xml").generated?
# Long line
assert !sample_blob("JavaScript/uglify.js").generated?
assert !sample_blob_memory("JavaScript/uglify.js").generated?
# Inlined JS, but mostly code
assert !sample_blob("JavaScript/json2_backbone.js").generated?
assert !sample_blob_memory("JavaScript/json2_backbone.js").generated?
# Minified JS
assert !sample_blob("JavaScript/jquery-1.6.1.js").generated?
assert sample_blob("JavaScript/jquery-1.6.1.min.js").generated?
assert sample_blob("JavaScript/jquery-1.4.2.min.js").generated?
# CoffeeScript-generated JS
# TODO
# TypeScript-generated JS
# TODO
assert !sample_blob_memory("JavaScript/jquery-1.6.1.js").generated?
assert sample_blob_memory("JavaScript/jquery-1.6.1.min.js").generated?
assert sample_blob_memory("JavaScript/jquery-1.4.2.min.js").generated?
# Composer generated composer.lock file
assert sample_blob("JSON/composer.lock").generated?
assert sample_blob_memory("JSON/composer.lock").generated?
# PEG.js-generated parsers
assert sample_blob("JavaScript/parser.js").generated?
assert sample_blob_memory("JavaScript/parser.js").generated?
# Generated PostScript
assert !sample_blob("PostScript/sierpinski.ps").generated?
assert !sample_blob_memory("PostScript/sierpinski.ps").generated?
# These examples are too basic to tell
assert !sample_blob("JavaScript/hello.js").generated?
assert !sample_blob_memory("JavaScript/hello.js").generated?
assert sample_blob("JavaScript/intro-old.js").generated?
assert sample_blob("JavaScript/classes-old.js").generated?
assert sample_blob_memory("JavaScript/intro-old.js").generated?
assert sample_blob_memory("JavaScript/classes-old.js").generated?
assert sample_blob("JavaScript/intro.js").generated?
assert sample_blob("JavaScript/classes.js").generated?
assert sample_blob_memory("JavaScript/intro.js").generated?
assert sample_blob_memory("JavaScript/classes.js").generated?
# Protocol Buffer generated code
assert sample_blob("C++/protocol-buffer.pb.h").generated?
assert sample_blob("C++/protocol-buffer.pb.cc").generated?
assert sample_blob("Java/ProtocolBuffer.java").generated?
assert sample_blob("Python/protocol_buffer_pb2.py").generated?
assert sample_blob("Go/api.pb.go").generated?
assert sample_blob("Go/embedded.go").generated?
assert sample_blob_memory("C++/protocol-buffer.pb.h").generated?
assert sample_blob_memory("C++/protocol-buffer.pb.cc").generated?
assert sample_blob_memory("Java/ProtocolBuffer.java").generated?
assert sample_blob_memory("Python/protocol_buffer_pb2.py").generated?
assert sample_blob_memory("Go/api.pb.go").generated?
assert sample_blob_memory("Go/embedded.go").generated?
# Apache Thrift generated code
assert sample_blob("Python/gen-py-linguist-thrift.py").generated?
assert sample_blob("Go/gen-go-linguist-thrift.go").generated?
assert sample_blob("Java/gen-java-linguist-thrift.java").generated?
assert sample_blob("JavaScript/gen-js-linguist-thrift.js").generated?
assert sample_blob("Ruby/gen-rb-linguist-thrift.rb").generated?
assert sample_blob("Objective-C/gen-cocoa-linguist-thrift.m").generated?
assert sample_blob_memory("Python/gen-py-linguist-thrift.py").generated?
assert sample_blob_memory("Go/gen-go-linguist-thrift.go").generated?
assert sample_blob_memory("Java/gen-java-linguist-thrift.java").generated?
assert sample_blob_memory("JavaScript/gen-js-linguist-thrift.js").generated?
assert sample_blob_memory("Ruby/gen-rb-linguist-thrift.rb").generated?
assert sample_blob_memory("Objective-C/gen-cocoa-linguist-thrift.m").generated?
# Generated JNI
assert sample_blob("C/jni_layer.h").generated?
assert sample_blob_memory("C/jni_layer.h").generated?
# Minified CSS
assert !sample_blob("CSS/bootstrap.css").generated?
assert sample_blob("CSS/bootstrap.min.css").generated?
assert !sample_blob_memory("CSS/bootstrap.css").generated?
assert sample_blob_memory("CSS/bootstrap.min.css").generated?
# Generated VCR
assert sample_blob("YAML/vcr_cassette.yml").generated?
assert sample_blob_memory("YAML/vcr_cassette.yml").generated?
# Generated by Zephir
assert sample_blob("Zephir/filenames/exception.zep.c").generated?
assert sample_blob("Zephir/filenames/exception.zep.h").generated?
assert sample_blob("Zephir/filenames/exception.zep.php").generated?
assert !sample_blob("Zephir/Router.zep").generated?
assert sample_blob("node_modules/grunt/lib/grunt.js").generated?
# Godep saved dependencies
assert sample_blob("Godeps/Godeps.json").generated?
assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").generated?
assert !sample_blob_memory("Zephir/Router.zep").generated?
# Cython-generated C/C++
assert sample_blob("C/sgd_fast.c").generated?
assert sample_blob("C++/wrapper_inner.cpp").generated?
assert sample_blob_memory("C/sgd_fast.c").generated?
assert sample_blob_memory("C++/wrapper_inner.cpp").generated?
# Unity3D-generated metadata
assert sample_blob("Unity3D Asset/Tiles.meta").generated?
assert sample_blob_memory("Unity3D Asset/Tiles.meta").generated?
# Racc-generated Ruby
assert sample_blob_memory("Ruby/racc.rb").generated?
end
def test_vendored
assert !fixture_blob("Data/README").vendored?
assert !sample_blob("ext/extconf.rb").vendored?
# Dependencies
assert sample_blob("dependencies/windows/headers/GL/glext.h").vendored?
# Node dependencies
assert sample_blob("node_modules/coffee-script/lib/coffee-script.js").vendored?
# Bower Components
assert sample_blob("bower_components/custom/custom.js").vendored?
assert sample_blob("app/bower_components/custom/custom.js").vendored?
assert sample_blob("vendor/assets/bower_components/custom/custom.js").vendored?
# Go dependencies
assert !sample_blob("Godeps/Godeps.json").vendored?
assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").vendored?
# Rails vendor/
assert sample_blob("vendor/plugins/will_paginate/lib/will_paginate.rb").vendored?
# Vendor/
assert sample_blob("Vendor/my_great_file.h").vendored?
# 'thirdparty' directory
assert sample_blob("thirdparty/lib/main.c").vendored?
# 'extern(al)' directory
assert sample_blob("extern/util/__init__.py").vendored?
assert sample_blob("external/jquery.min.js").vendored?
# C deps
assert sample_blob("deps/http_parser/http_parser.c").vendored?
assert sample_blob("deps/v8/src/v8.h").vendored?
assert sample_blob("tools/something/else.c").vendored?
# Chart.js
assert sample_blob("some/vendored/path/Chart.js").vendored?
assert !sample_blob("some/vendored/path/chart.js").vendored?
# Codemirror deps
assert sample_blob("codemirror/mode/blah.js").vendored?
assert sample_blob("codemirror/5.0/mode/blah.js").vendored?
# Debian packaging
assert sample_blob("debian/cron.d").vendored?
# Erlang
assert sample_blob("rebar").vendored?
# git config files
assert_predicate fixture_blob("some/path/.gitattributes"), :vendored?
assert_predicate fixture_blob(".gitignore"), :vendored?
assert_predicate fixture_blob("special/path/.gitmodules"), :vendored?
# Minified JavaScript and CSS
assert sample_blob("foo.min.js").vendored?
assert sample_blob("foo.min.css").vendored?
assert sample_blob("foo-min.js").vendored?
assert sample_blob("foo-min.css").vendored?
assert !sample_blob("foomin.css").vendored?
assert !sample_blob("foo.min.txt").vendored?
#.osx
assert sample_blob(".osx").vendored?
# Prototype
assert !sample_blob("public/javascripts/application.js").vendored?
assert sample_blob("public/javascripts/prototype.js").vendored?
assert sample_blob("public/javascripts/effects.js").vendored?
assert sample_blob("public/javascripts/controls.js").vendored?
assert sample_blob("public/javascripts/dragdrop.js").vendored?
# jQuery
assert sample_blob("jquery.js").vendored?
assert sample_blob("public/javascripts/jquery.js").vendored?
assert sample_blob("public/javascripts/jquery.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.7.js").vendored?
assert sample_blob("public/javascripts/jquery-1.7.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.5.2.js").vendored?
assert sample_blob("public/javascripts/jquery-1.6.1.js").vendored?
assert sample_blob("public/javascripts/jquery-1.6.1.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.10.1.js").vendored?
assert sample_blob("public/javascripts/jquery-1.10.1.min.js").vendored?
assert !sample_blob("public/javascripts/jquery.github.menu.js").vendored?
# jQuery UI
assert sample_blob("themes/ui-lightness/jquery-ui.css").vendored?
assert sample_blob("themes/ui-lightness/jquery-ui-1.8.22.custom.css").vendored?
assert sample_blob("themes/ui-lightness/jquery.ui.accordion.css").vendored?
assert sample_blob("ui/i18n/jquery.ui.datepicker-ar.js").vendored?
assert sample_blob("ui/i18n/jquery-ui-i18n.js").vendored?
assert sample_blob("ui/jquery.effects.blind.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.custom.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.custom.min.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.js").vendored?
assert sample_blob("ui/jquery-ui.min.js").vendored?
assert sample_blob("ui/jquery.ui.accordion.js").vendored?
assert sample_blob("ui/minified/jquery.effects.blind.min.js").vendored?
assert sample_blob("ui/minified/jquery.ui.accordion.min.js").vendored?
# jQuery Gantt
assert sample_blob("web-app/jquery-gantt/js/jquery.fn.gantt.js").vendored?
# jQuery fancyBox
assert sample_blob("web-app/fancybox/jquery.fancybox.js").vendored?
# Fuel UX
assert sample_blob("web-app/fuelux/js/fuelux.js").vendored?
# jQuery File Upload
assert sample_blob("fileupload-9.0.0/jquery.fileupload-process.js").vendored?
# Slick
assert sample_blob("web-app/slickgrid/controls/slick.columnpicker.js").vendored?
# Leaflet plugins
assert sample_blob("leaflet-plugins/Leaflet.Coordinates-0.5.0.src.js").vendored?
assert sample_blob("leaflet-plugins/leaflet.draw-src.js").vendored?
assert sample_blob("leaflet-plugins/leaflet.spin.js").vendored?
# MooTools
assert sample_blob("public/javascripts/mootools-core-1.3.2-full-compat.js").vendored?
assert sample_blob("public/javascripts/mootools-core-1.3.2-full-compat-yc.js").vendored?
# Dojo
assert sample_blob("public/javascripts/dojo.js").vendored?
# MochiKit
assert sample_blob("public/javascripts/MochiKit.js").vendored?
# YUI
assert sample_blob("public/javascripts/yahoo-dom-event.js").vendored?
assert sample_blob("public/javascripts/yahoo-min.js").vendored?
assert sample_blob("public/javascripts/yuiloader-dom-event.js").vendored?
# WYS editors
assert sample_blob("public/javascripts/ckeditor.js").vendored?
assert sample_blob("public/javascripts/tiny_mce.js").vendored?
assert sample_blob("public/javascripts/tiny_mce_popup.js").vendored?
assert sample_blob("public/javascripts/tiny_mce_src.js").vendored?
# AngularJS
assert sample_blob("public/javascripts/angular.js").vendored?
assert sample_blob("public/javascripts/angular.min.js").vendored?
# D3.js
assert sample_blob("public/javascripts/d3.v3.js").vendored?
assert sample_blob("public/javascripts/d3.v3.min.js").vendored?
# Modernizr
assert sample_blob("public/javascripts/modernizr-2.7.1.js").vendored?
assert sample_blob("public/javascripts/modernizr.custom.01009.js").vendored?
# Fabric
assert sample_blob("fabfile.py").vendored?
# WAF
assert sample_blob("waf").vendored?
# Visual Studio IntelliSense
assert sample_blob("Scripts/jquery-1.7-vsdoc.js").vendored?
# Microsoft Ajax
assert sample_blob("Scripts/MicrosoftAjax.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftAjax.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcAjax.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcAjax.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcValidation.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcValidation.js").vendored?
# jQuery validation plugin (MS bundles this with asp.net mvc)
assert sample_blob("Scripts/jquery.validate.js").vendored?
assert sample_blob("Scripts/jquery.validate.min.js").vendored?
assert sample_blob("Scripts/jquery.validate.unobtrusive.js").vendored?
assert sample_blob("Scripts/jquery.validate.unobtrusive.min.js").vendored?
assert sample_blob("Scripts/jquery.unobtrusive-ajax.js").vendored?
assert sample_blob("Scripts/jquery.unobtrusive-ajax.min.js").vendored?
# NuGet Packages
assert sample_blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored?
# Font Awesome
assert sample_blob("some/asset/path/font-awesome.min.css").vendored?
assert sample_blob("some/asset/path/font-awesome.css").vendored?
# Normalize
assert sample_blob("some/asset/path/normalize.css").vendored?
# Carthage
assert sample_blob('Carthage/blah').vendored?
# Cocoapods
assert sample_blob('Pods/blah').vendored?
# Html5shiv
assert sample_blob("Scripts/html5shiv.js").vendored?
assert sample_blob("Scripts/html5shiv.min.js").vendored?
# Test fixtures
assert sample_blob("test/fixtures/random.rkt").vendored?
assert sample_blob("Test/fixtures/random.rkt").vendored?
assert sample_blob("tests/fixtures/random.rkt").vendored?
# Cordova/PhoneGap
assert sample_blob("cordova.js").vendored?
assert sample_blob("cordova.min.js").vendored?
assert sample_blob("cordova-2.1.0.js").vendored?
assert sample_blob("cordova-2.1.0.min.js").vendored?
# Foundation js
assert sample_blob("foundation.js").vendored?
assert sample_blob("foundation.min.js").vendored?
assert sample_blob("foundation.abide.js").vendored?
# Vagrant
assert sample_blob("Vagrantfile").vendored?
# Gradle
assert sample_blob("gradlew").vendored?
assert sample_blob("gradlew.bat").vendored?
assert sample_blob("gradle/wrapper/gradle-wrapper.properties").vendored?
assert sample_blob("subproject/gradlew").vendored?
assert sample_blob("subproject/gradlew.bat").vendored?
assert sample_blob("subproject/gradle/wrapper/gradle-wrapper.properties").vendored?
# Octicons
assert sample_blob("octicons.css").vendored?
assert sample_blob("public/octicons.min.css").vendored?
assert sample_blob("public/octicons/sprockets-octicons.scss").vendored?
# Typesafe Activator
assert sample_blob("activator").vendored?
assert sample_blob("activator.bat").vendored?
assert sample_blob("subproject/activator").vendored?
assert sample_blob("subproject/activator.bat").vendored?
assert_predicate fixture_blob(".google_apis/bar.jar"), :vendored?
assert_predicate fixture_blob("foo/.google_apis/bar.jar"), :vendored?
# Sphinx docs
assert sample_blob("docs/_build/asset.doc").vendored?
assert sample_blob("docs/theme/file.css").vendored?
# Vagrant
assert sample_blob("puphpet/file.pp").vendored?
# Fabric.io
assert sample_blob("Fabric.framework/Fabric.h").vendored?
# Crashlytics
assert sample_blob("Crashlytics.framework/Crashlytics.h").vendored?
# Xcode
assert sample_blob("myapp/My Template.xctemplate/___FILEBASENAME___.h").vendored?
assert sample_blob("myapp/My Images.xcassets/some/stuff.imageset/Contents.json").vendored?
assert !sample_blob("myapp/MyData.json").vendored?
end
def test_documentation
assert_predicate fixture_blob("doc/foo.html"), :documentation?
assert_predicate fixture_blob("docs/foo.html"), :documentation?
refute_predicate fixture_blob("project/doc/foo.html"), :documentation?
refute_predicate fixture_blob("project/docs/foo.html"), :documentation?
assert_predicate fixture_blob("Documentation/foo.md"), :documentation?
assert_predicate fixture_blob("documentation/foo.md"), :documentation?
assert_predicate fixture_blob("project/Documentation/foo.md"), :documentation?
assert_predicate fixture_blob("project/documentation/foo.md"), :documentation?
assert_predicate fixture_blob("javadoc/foo.html"), :documentation?
assert_predicate fixture_blob("project/javadoc/foo.html"), :documentation?
assert_predicate fixture_blob("man/foo.html"), :documentation?
refute_predicate fixture_blob("project/man/foo.html"), :documentation?
assert_predicate fixture_blob("README"), :documentation?
assert_predicate fixture_blob("README.md"), :documentation?
assert_predicate fixture_blob("README.txt"), :documentation?
assert_predicate fixture_blob("Readme"), :documentation?
assert_predicate fixture_blob("readme"), :documentation?
assert_predicate fixture_blob("foo/README"), :documentation?
assert_predicate fixture_blob("CHANGE"), :documentation?
assert_predicate fixture_blob("CHANGE.md"), :documentation?
assert_predicate fixture_blob("CHANGE.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGE"), :documentation?
assert_predicate fixture_blob("CHANGELOG"), :documentation?
assert_predicate fixture_blob("CHANGELOG.md"), :documentation?
assert_predicate fixture_blob("CHANGELOG.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGELOG"), :documentation?
assert_predicate fixture_blob("CHANGES"), :documentation?
assert_predicate fixture_blob("CHANGES.md"), :documentation?
assert_predicate fixture_blob("CHANGES.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGES"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING.md"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING.txt"), :documentation?
assert_predicate fixture_blob("foo/CONTRIBUTING"), :documentation?
assert_predicate fixture_blob("examples/some-file.pl"), :documentation?
assert_predicate fixture_blob("Examples/some-example-file.rb"), :documentation?
assert_predicate fixture_blob("LICENSE"), :documentation?
assert_predicate fixture_blob("LICENCE.md"), :documentation?
assert_predicate fixture_blob("License.txt"), :documentation?
assert_predicate fixture_blob("LICENSE.txt"), :documentation?
assert_predicate fixture_blob("foo/LICENSE"), :documentation?
assert_predicate fixture_blob("COPYING"), :documentation?
assert_predicate fixture_blob("COPYING.md"), :documentation?
assert_predicate fixture_blob("COPYING.txt"), :documentation?
assert_predicate fixture_blob("foo/COPYING"), :documentation?
assert_predicate fixture_blob("INSTALL"), :documentation?
assert_predicate fixture_blob("INSTALL.md"), :documentation?
assert_predicate fixture_blob("INSTALL.txt"), :documentation?
assert_predicate fixture_blob("foo/INSTALL"), :documentation?
refute_predicate fixture_blob("foo.md"), :documentation?
# Samples
assert sample_blob("Samples/Ruby/foo.rb").documentation?
assert_predicate fixture_blob("INSTALL.txt"), :documentation?
assert !fixture_blob_memory("Data/README").vendored?
end
def test_language
Samples.each do |sample|
blob = sample_blob(sample[:path])
blob = sample_blob_memory(sample[:path])
assert blob.language, "No language for #{sample[:path]}"
assert_equal sample[:language], blob.language.name, blob.name
end
@@ -612,7 +248,7 @@ class TestBlob < Minitest::Test
filepath = File.join(dirname, filename)
next unless File.file?(filepath)
blob = fixture_blob(filepath)
blob = fixture_blob_memory(filepath)
if language == 'Data'
assert blob.language.nil?, "A language was found for #{filepath}"
elsif language == 'Generated'
@@ -626,7 +262,7 @@ class TestBlob < Minitest::Test
end
def test_minified_files_not_safe_to_highlight
assert !sample_blob("JavaScript/jquery-1.6.1.min.js").safe_to_colorize?
assert !sample_blob_memory("JavaScript/jquery-1.6.1.min.js").safe_to_colorize?
end
def test_empty
@@ -639,27 +275,19 @@ class TestBlob < Minitest::Test
end
def test_include_in_language_stats
vendored = sample_blob("bower_components/custom/custom.js")
assert_predicate vendored, :vendored?
refute_predicate vendored, :include_in_language_stats?
documentation = fixture_blob("README")
assert_predicate documentation, :documentation?
refute_predicate documentation, :include_in_language_stats?
generated = sample_blob("CSS/bootstrap.min.css")
generated = sample_blob_memory("CSS/bootstrap.min.css")
assert_predicate generated, :generated?
refute_predicate generated, :include_in_language_stats?
data = sample_blob("Ant Build System/filenames/ant.xml")
data = sample_blob_memory("Ant Build System/filenames/ant.xml")
assert_equal :data, data.language.type
refute_predicate data, :include_in_language_stats?
prose = sample_blob("Markdown/tender.md")
prose = sample_blob_memory("Markdown/tender.md")
assert_equal :prose, prose.language.type
refute_predicate prose, :include_in_language_stats?
included = sample_blob("HTML/pages.html")
included = sample_blob_memory("HTML/pages.html")
assert_predicate included, :include_in_language_stats?
end
end

View File

@@ -1,9 +1,669 @@
require_relative "./helper"
class TestFileBlob < Minitest::Test
class TestBlob < Minitest::Test
include Linguist
def setup
# git blobs are normally loaded as ASCII-8BIT since they may contain data
# with arbitrary encoding not known ahead of time
@original_external = Encoding.default_external
Encoding.default_external = Encoding.find("ASCII-8BIT")
end
def teardown
Encoding.default_external = @original_external
end
def script_blob(name)
blob = sample_blob(name)
blob.instance_variable_set(:@name, 'script')
blob
end
def test_extensions
assert_equal [".gitignore"], Linguist::FileBlob.new(".gitignore").extensions
assert_equal [".xml"], Linguist::FileBlob.new("build.xml").extensions
assert_equal [".html.erb", ".erb"], Linguist::FileBlob.new("dotted.dir/index.html.erb").extensions
end
def test_name
assert_equal "foo.rb", sample_blob("foo.rb").name
end
def test_mime_type
assert_equal "application/postscript", fixture_blob("Binary/octocat.ai").mime_type
assert_equal "application/x-ruby", sample_blob("Ruby/grit.rb").mime_type
assert_equal "application/x-sh", sample_blob("Shell/script.sh").mime_type
assert_equal "application/xml", sample_blob("XML/bar.xml").mime_type
assert_equal "audio/ogg", fixture_blob("Binary/foo.ogg").mime_type
assert_equal "text/plain", fixture_blob("Data/README").mime_type
end
def test_content_type
assert_equal "application/pdf", fixture_blob("Binary/foo.pdf").content_type
assert_equal "audio/ogg", fixture_blob("Binary/foo.ogg").content_type
assert_equal "image/png", fixture_blob("Binary/foo.png").content_type
assert_equal "text/plain; charset=iso-8859-2", fixture_blob("Data/README").content_type
end
def test_disposition
assert_equal "attachment; filename=foo+bar.jar", fixture_blob("Binary/foo bar.jar").disposition
assert_equal "attachment; filename=foo.bin", fixture_blob("Binary/foo.bin").disposition
assert_equal "attachment; filename=linguist.gem", fixture_blob("Binary/linguist.gem").disposition
assert_equal "attachment; filename=octocat.ai", fixture_blob("Binary/octocat.ai").disposition
assert_equal "inline", fixture_blob("Data/README").disposition
assert_equal "inline", sample_blob("Text/foo.txt").disposition
assert_equal "inline", sample_blob("Ruby/grit.rb").disposition
assert_equal "inline", fixture_blob("Binary/octocat.png").disposition
end
def test_data
assert_equal "module Foo\nend\n", sample_blob("Ruby/foo.rb").data
end
def test_lines
assert_equal ["module Foo", "end", ""], sample_blob("Ruby/foo.rb").lines
assert_equal ["line 1", "line 2", ""], sample_blob("Text/mac.txt").lines
assert_equal 475, sample_blob("Emacs Lisp/ess-julia.el").lines.length
end
def test_lines_maintains_original_encoding
# Even if the file's encoding is detected as something like UTF-16LE,
# earlier versions of the gem made implicit guarantees that the encoding of
# each `line` is in the same encoding as the file was originally read (in
# practice, UTF-8 or ASCII-8BIT)
assert_equal Encoding.default_external, fixture_blob("Data/utf16le").lines.first.encoding
end
def test_size
assert_equal 15, sample_blob("Ruby/foo.rb").size
end
def test_loc
assert_equal 3, sample_blob("Ruby/foo.rb").loc
end
def test_sloc
assert_equal 2, sample_blob("Ruby/foo.rb").sloc
assert_equal 3, fixture_blob("Data/utf16le-windows").sloc
assert_equal 1, fixture_blob("Data/iso8859-8-i").sloc
end
def test_encoding
assert_equal "ISO-8859-2", fixture_blob("Data/README").encoding
assert_equal "ISO-8859-2", fixture_blob("Data/README").ruby_encoding
assert_equal "UTF-8", sample_blob("Text/foo.txt").encoding
assert_equal "UTF-8", sample_blob("Text/foo.txt").ruby_encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le").encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le").ruby_encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le-windows").encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le-windows").ruby_encoding
assert_equal "ISO-2022-KR", sample_blob("Text/ISO-2022-KR.txt").encoding
assert_equal "binary", sample_blob("Text/ISO-2022-KR.txt").ruby_encoding
assert_nil fixture_blob("Binary/dog.o").encoding
end
def test_binary
# Large blobs aren't loaded
large_blob = sample_blob("git.exe")
large_blob.instance_eval do
def data; end
end
assert large_blob.binary?
assert fixture_blob("Binary/git.deb").binary?
assert fixture_blob("Binary/git.exe").binary?
assert fixture_blob("Binary/hello.pbc").binary?
assert fixture_blob("Binary/linguist.gem").binary?
assert fixture_blob("Binary/octocat.ai").binary?
assert fixture_blob("Binary/octocat.png").binary?
assert fixture_blob("Binary/zip").binary?
assert !fixture_blob("Data/README").binary?
assert !sample_blob("Ruby/foo.rb").binary?
assert !sample_blob("Perl/script.pl").binary?
end
def test_all_binary
Samples.each do |sample|
blob = sample_blob(sample[:path])
assert ! (blob.likely_binary? || blob.binary?), "#{sample[:path]} is a binary file"
end
end
def test_text
assert fixture_blob("Data/README").text?
assert fixture_blob("Data/md").text?
assert sample_blob("Shell/script.sh").text?
assert fixture_blob("Data/txt").text?
end
def test_image
assert fixture_blob("Binary/octocat.gif").image?
assert fixture_blob("Binary/octocat.jpeg").image?
assert fixture_blob("Binary/octocat.jpg").image?
assert fixture_blob("Binary/octocat.png").image?
assert !fixture_blob("Binary/octocat.ai").image?
assert !fixture_blob("Binary/octocat.psd").image?
end
def test_solid
assert fixture_blob("Binary/cube.stl").solid?
assert fixture_blob("Data/cube.stl").solid?
end
def test_csv
assert fixture_blob("Data/cars.csv").csv?
end
def test_pdf
assert fixture_blob("Binary/foo.pdf").pdf?
end
def test_viewable
assert fixture_blob("Data/README").viewable?
assert sample_blob("Ruby/foo.rb").viewable?
assert sample_blob("Perl/script.pl").viewable?
assert !fixture_blob("Binary/linguist.gem").viewable?
assert !fixture_blob("Binary/octocat.ai").viewable?
assert !fixture_blob("Binary/octocat.png").viewable?
end
def test_generated
assert !fixture_blob("Data/README").generated?
# Xcode project files
assert !sample_blob("XML/MainMenu.xib").generated?
assert fixture_blob("Binary/MainMenu.nib").generated?
assert !sample_blob("XML/project.pbxproj").generated?
# Gemfile.lock is NOT generated
assert !sample_blob("Gemfile.lock").generated?
# Generated .NET Docfiles
assert sample_blob("XML/net_docfile.xml").generated?
# Long line
assert !sample_blob("JavaScript/uglify.js").generated?
# Inlined JS, but mostly code
assert !sample_blob("JavaScript/json2_backbone.js").generated?
# Minified JS
assert !sample_blob("JavaScript/jquery-1.6.1.js").generated?
assert sample_blob("JavaScript/jquery-1.6.1.min.js").generated?
assert sample_blob("JavaScript/jquery-1.4.2.min.js").generated?
# CoffeeScript-generated JS
# TODO
# TypeScript-generated JS
# TODO
# Composer generated composer.lock file
assert sample_blob("JSON/composer.lock").generated?
# PEG.js-generated parsers
assert sample_blob("JavaScript/parser.js").generated?
# Generated PostScript
assert !sample_blob("PostScript/sierpinski.ps").generated?
# These examples are too basic to tell
assert !sample_blob("JavaScript/hello.js").generated?
assert sample_blob("JavaScript/intro-old.js").generated?
assert sample_blob("JavaScript/classes-old.js").generated?
assert sample_blob("JavaScript/intro.js").generated?
assert sample_blob("JavaScript/classes.js").generated?
# Protocol Buffer generated code
assert sample_blob("C++/protocol-buffer.pb.h").generated?
assert sample_blob("C++/protocol-buffer.pb.cc").generated?
assert sample_blob("Java/ProtocolBuffer.java").generated?
assert sample_blob("Python/protocol_buffer_pb2.py").generated?
assert sample_blob("Go/api.pb.go").generated?
assert sample_blob("Go/embedded.go").generated?
# Apache Thrift generated code
assert sample_blob("Python/gen-py-linguist-thrift.py").generated?
assert sample_blob("Go/gen-go-linguist-thrift.go").generated?
assert sample_blob("Java/gen-java-linguist-thrift.java").generated?
assert sample_blob("JavaScript/gen-js-linguist-thrift.js").generated?
assert sample_blob("Ruby/gen-rb-linguist-thrift.rb").generated?
assert sample_blob("Objective-C/gen-cocoa-linguist-thrift.m").generated?
# Generated JNI
assert sample_blob("C/jni_layer.h").generated?
# Minified CSS
assert !sample_blob("CSS/bootstrap.css").generated?
assert sample_blob("CSS/bootstrap.min.css").generated?
# Generated VCR
assert sample_blob("YAML/vcr_cassette.yml").generated?
# Generated by Zephir
assert sample_blob("Zephir/filenames/exception.zep.c").generated?
assert sample_blob("Zephir/filenames/exception.zep.h").generated?
assert sample_blob("Zephir/filenames/exception.zep.php").generated?
assert !sample_blob("Zephir/Router.zep").generated?
assert sample_blob("node_modules/grunt/lib/grunt.js").generated?
# Godep saved dependencies
assert sample_blob("Godeps/Godeps.json").generated?
assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").generated?
# Cython-generated C/C++
assert sample_blob("C/sgd_fast.c").generated?
assert sample_blob("C++/wrapper_inner.cpp").generated?
# Unity3D-generated metadata
assert sample_blob("Unity3D Asset/Tiles.meta").generated?
end
def test_vendored
assert !fixture_blob("Data/README").vendored?
assert !sample_blob("ext/extconf.rb").vendored?
# Dependencies
assert sample_blob("dependencies/windows/headers/GL/glext.h").vendored?
# Node dependencies
assert sample_blob("node_modules/coffee-script/lib/coffee-script.js").vendored?
# Bower Components
assert sample_blob("bower_components/custom/custom.js").vendored?
assert sample_blob("app/bower_components/custom/custom.js").vendored?
assert sample_blob("vendor/assets/bower_components/custom/custom.js").vendored?
# Go dependencies
assert !sample_blob("Godeps/Godeps.json").vendored?
assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").vendored?
# Rails vendor/
assert sample_blob("vendor/plugins/will_paginate/lib/will_paginate.rb").vendored?
# Vendor/
assert sample_blob("Vendor/my_great_file.h").vendored?
# 'thirdparty' directory
assert sample_blob("thirdparty/lib/main.c").vendored?
# 'extern(al)' directory
assert sample_blob("extern/util/__init__.py").vendored?
assert sample_blob("external/jquery.min.js").vendored?
# C deps
assert sample_blob("deps/http_parser/http_parser.c").vendored?
assert sample_blob("deps/v8/src/v8.h").vendored?
assert sample_blob("tools/something/else.c").vendored?
# Chart.js
assert sample_blob("some/vendored/path/Chart.js").vendored?
assert !sample_blob("some/vendored/path/chart.js").vendored?
# Codemirror deps
assert sample_blob("codemirror/mode/blah.js").vendored?
assert sample_blob("codemirror/5.0/mode/blah.js").vendored?
# Debian packaging
assert sample_blob("debian/cron.d").vendored?
# Erlang
assert sample_blob("rebar").vendored?
# git config files
assert_predicate fixture_blob("some/path/.gitattributes"), :vendored?
assert_predicate fixture_blob(".gitignore"), :vendored?
assert_predicate fixture_blob("special/path/.gitmodules"), :vendored?
# Minified JavaScript and CSS
assert sample_blob("foo.min.js").vendored?
assert sample_blob("foo.min.css").vendored?
assert sample_blob("foo-min.js").vendored?
assert sample_blob("foo-min.css").vendored?
assert !sample_blob("foomin.css").vendored?
assert !sample_blob("foo.min.txt").vendored?
#.osx
assert sample_blob(".osx").vendored?
# Prototype
assert !sample_blob("public/javascripts/application.js").vendored?
assert sample_blob("public/javascripts/prototype.js").vendored?
assert sample_blob("public/javascripts/effects.js").vendored?
assert sample_blob("public/javascripts/controls.js").vendored?
assert sample_blob("public/javascripts/dragdrop.js").vendored?
# jQuery
assert sample_blob("jquery.js").vendored?
assert sample_blob("public/javascripts/jquery.js").vendored?
assert sample_blob("public/javascripts/jquery.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.7.js").vendored?
assert sample_blob("public/javascripts/jquery-1.7.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.5.2.js").vendored?
assert sample_blob("public/javascripts/jquery-1.6.1.js").vendored?
assert sample_blob("public/javascripts/jquery-1.6.1.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.10.1.js").vendored?
assert sample_blob("public/javascripts/jquery-1.10.1.min.js").vendored?
assert !sample_blob("public/javascripts/jquery.github.menu.js").vendored?
# jQuery UI
assert sample_blob("themes/ui-lightness/jquery-ui.css").vendored?
assert sample_blob("themes/ui-lightness/jquery-ui-1.8.22.custom.css").vendored?
assert sample_blob("themes/ui-lightness/jquery.ui.accordion.css").vendored?
assert sample_blob("ui/i18n/jquery.ui.datepicker-ar.js").vendored?
assert sample_blob("ui/i18n/jquery-ui-i18n.js").vendored?
assert sample_blob("ui/jquery.effects.blind.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.custom.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.custom.min.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.js").vendored?
assert sample_blob("ui/jquery-ui.min.js").vendored?
assert sample_blob("ui/jquery.ui.accordion.js").vendored?
assert sample_blob("ui/minified/jquery.effects.blind.min.js").vendored?
assert sample_blob("ui/minified/jquery.ui.accordion.min.js").vendored?
# jQuery Gantt
assert sample_blob("web-app/jquery-gantt/js/jquery.fn.gantt.js").vendored?
# jQuery fancyBox
assert sample_blob("web-app/fancybox/jquery.fancybox.js").vendored?
# Fuel UX
assert sample_blob("web-app/fuelux/js/fuelux.js").vendored?
# jQuery File Upload
assert sample_blob("fileupload-9.0.0/jquery.fileupload-process.js").vendored?
# Slick
assert sample_blob("web-app/slickgrid/controls/slick.columnpicker.js").vendored?
# Leaflet plugins
assert sample_blob("leaflet-plugins/Leaflet.Coordinates-0.5.0.src.js").vendored?
assert sample_blob("leaflet-plugins/leaflet.draw-src.js").vendored?
assert sample_blob("leaflet-plugins/leaflet.spin.js").vendored?
# MooTools
assert sample_blob("public/javascripts/mootools-core-1.3.2-full-compat.js").vendored?
assert sample_blob("public/javascripts/mootools-core-1.3.2-full-compat-yc.js").vendored?
# Dojo
assert sample_blob("public/javascripts/dojo.js").vendored?
# MochiKit
assert sample_blob("public/javascripts/MochiKit.js").vendored?
# YUI
assert sample_blob("public/javascripts/yahoo-dom-event.js").vendored?
assert sample_blob("public/javascripts/yahoo-min.js").vendored?
assert sample_blob("public/javascripts/yuiloader-dom-event.js").vendored?
# WYS editors
assert sample_blob("public/javascripts/ckeditor.js").vendored?
assert sample_blob("public/javascripts/tiny_mce.js").vendored?
assert sample_blob("public/javascripts/tiny_mce_popup.js").vendored?
assert sample_blob("public/javascripts/tiny_mce_src.js").vendored?
# AngularJS
assert sample_blob("public/javascripts/angular.js").vendored?
assert sample_blob("public/javascripts/angular.min.js").vendored?
# D3.js
assert sample_blob("public/javascripts/d3.v3.js").vendored?
assert sample_blob("public/javascripts/d3.v3.min.js").vendored?
# Modernizr
assert sample_blob("public/javascripts/modernizr-2.7.1.js").vendored?
assert sample_blob("public/javascripts/modernizr.custom.01009.js").vendored?
# Fabric
assert sample_blob("fabfile.py").vendored?
# WAF
assert sample_blob("waf").vendored?
# Visual Studio IntelliSense
assert sample_blob("Scripts/jquery-1.7-vsdoc.js").vendored?
# Microsoft Ajax
assert sample_blob("Scripts/MicrosoftAjax.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftAjax.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcAjax.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcAjax.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcValidation.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcValidation.js").vendored?
# jQuery validation plugin (MS bundles this with asp.net mvc)
assert sample_blob("Scripts/jquery.validate.js").vendored?
assert sample_blob("Scripts/jquery.validate.min.js").vendored?
assert sample_blob("Scripts/jquery.validate.unobtrusive.js").vendored?
assert sample_blob("Scripts/jquery.validate.unobtrusive.min.js").vendored?
assert sample_blob("Scripts/jquery.unobtrusive-ajax.js").vendored?
assert sample_blob("Scripts/jquery.unobtrusive-ajax.min.js").vendored?
# NuGet Packages
assert sample_blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored?
# Font Awesome
assert sample_blob("some/asset/path/font-awesome.min.css").vendored?
assert sample_blob("some/asset/path/font-awesome.css").vendored?
# Normalize
assert sample_blob("some/asset/path/normalize.css").vendored?
# Carthage
assert sample_blob('Carthage/blah').vendored?
# Cocoapods
assert sample_blob('Pods/blah').vendored?
# Html5shiv
assert sample_blob("Scripts/html5shiv.js").vendored?
assert sample_blob("Scripts/html5shiv.min.js").vendored?
# Test fixtures
assert sample_blob("test/fixtures/random.rkt").vendored?
assert sample_blob("Test/fixtures/random.rkt").vendored?
assert sample_blob("tests/fixtures/random.rkt").vendored?
# Cordova/PhoneGap
assert sample_blob("cordova.js").vendored?
assert sample_blob("cordova.min.js").vendored?
assert sample_blob("cordova-2.1.0.js").vendored?
assert sample_blob("cordova-2.1.0.min.js").vendored?
# Foundation js
assert sample_blob("foundation.js").vendored?
assert sample_blob("foundation.min.js").vendored?
assert sample_blob("foundation.abide.js").vendored?
# Vagrant
assert sample_blob("Vagrantfile").vendored?
# Gradle
assert sample_blob("gradlew").vendored?
assert sample_blob("gradlew.bat").vendored?
assert sample_blob("gradle/wrapper/gradle-wrapper.properties").vendored?
assert sample_blob("subproject/gradlew").vendored?
assert sample_blob("subproject/gradlew.bat").vendored?
assert sample_blob("subproject/gradle/wrapper/gradle-wrapper.properties").vendored?
# Octicons
assert sample_blob("octicons.css").vendored?
assert sample_blob("public/octicons.min.css").vendored?
assert sample_blob("public/octicons/sprockets-octicons.scss").vendored?
# Typesafe Activator
assert sample_blob("activator").vendored?
assert sample_blob("activator.bat").vendored?
assert sample_blob("subproject/activator").vendored?
assert sample_blob("subproject/activator.bat").vendored?
assert_predicate fixture_blob(".google_apis/bar.jar"), :vendored?
assert_predicate fixture_blob("foo/.google_apis/bar.jar"), :vendored?
# Sphinx docs
assert sample_blob("docs/_build/asset.doc").vendored?
assert sample_blob("docs/theme/file.css").vendored?
# Vagrant
assert sample_blob("puphpet/file.pp").vendored?
# Fabric.io
assert sample_blob("Fabric.framework/Fabric.h").vendored?
# Crashlytics
assert sample_blob("Crashlytics.framework/Crashlytics.h").vendored?
assert sample_blob("myapp/My Template.xctemplate/___FILEBASENAME___.h").vendored?
assert sample_blob("myapp/My Images.xcassets/some/stuff.imageset/Contents.json").vendored?
assert !sample_blob("myapp/MyData.json").vendored?
end
def test_documentation
assert_predicate fixture_blob("doc/foo.html"), :documentation?
assert_predicate fixture_blob("docs/foo.html"), :documentation?
refute_predicate fixture_blob("project/doc/foo.html"), :documentation?
refute_predicate fixture_blob("project/docs/foo.html"), :documentation?
assert_predicate fixture_blob("Documentation/foo.md"), :documentation?
assert_predicate fixture_blob("documentation/foo.md"), :documentation?
assert_predicate fixture_blob("project/Documentation/foo.md"), :documentation?
assert_predicate fixture_blob("project/documentation/foo.md"), :documentation?
assert_predicate fixture_blob("javadoc/foo.html"), :documentation?
assert_predicate fixture_blob("project/javadoc/foo.html"), :documentation?
assert_predicate fixture_blob("man/foo.html"), :documentation?
refute_predicate fixture_blob("project/man/foo.html"), :documentation?
assert_predicate fixture_blob("README"), :documentation?
assert_predicate fixture_blob("README.md"), :documentation?
assert_predicate fixture_blob("README.txt"), :documentation?
assert_predicate fixture_blob("Readme"), :documentation?
assert_predicate fixture_blob("readme"), :documentation?
assert_predicate fixture_blob("foo/README"), :documentation?
assert_predicate fixture_blob("CHANGE"), :documentation?
assert_predicate fixture_blob("CHANGE.md"), :documentation?
assert_predicate fixture_blob("CHANGE.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGE"), :documentation?
assert_predicate fixture_blob("CHANGELOG"), :documentation?
assert_predicate fixture_blob("CHANGELOG.md"), :documentation?
assert_predicate fixture_blob("CHANGELOG.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGELOG"), :documentation?
assert_predicate fixture_blob("CHANGES"), :documentation?
assert_predicate fixture_blob("CHANGES.md"), :documentation?
assert_predicate fixture_blob("CHANGES.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGES"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING.md"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING.txt"), :documentation?
assert_predicate fixture_blob("foo/CONTRIBUTING"), :documentation?
assert_predicate fixture_blob("examples/some-file.pl"), :documentation?
assert_predicate fixture_blob("Examples/some-example-file.rb"), :documentation?
assert_predicate fixture_blob("LICENSE"), :documentation?
assert_predicate fixture_blob("LICENCE.md"), :documentation?
assert_predicate fixture_blob("License.txt"), :documentation?
assert_predicate fixture_blob("LICENSE.txt"), :documentation?
assert_predicate fixture_blob("foo/LICENSE"), :documentation?
assert_predicate fixture_blob("COPYING"), :documentation?
assert_predicate fixture_blob("COPYING.md"), :documentation?
assert_predicate fixture_blob("COPYING.txt"), :documentation?
assert_predicate fixture_blob("foo/COPYING"), :documentation?
assert_predicate fixture_blob("INSTALL"), :documentation?
assert_predicate fixture_blob("INSTALL.md"), :documentation?
assert_predicate fixture_blob("INSTALL.txt"), :documentation?
assert_predicate fixture_blob("foo/INSTALL"), :documentation?
refute_predicate fixture_blob("foo.md"), :documentation?
# Samples
assert sample_blob("Samples/Ruby/foo.rb").documentation?
assert_predicate fixture_blob("INSTALL.txt"), :documentation?
end
def test_language
Samples.each do |sample|
blob = sample_blob(sample[:path])
assert blob.language, "No language for #{sample[:path]}"
assert_equal sample[:language], blob.language.name, blob.name
end
# Test language detection for files which shouldn't be used as samples
root = File.expand_path('../fixtures', __FILE__)
Dir.entries(root).each do |language|
next if language == '.' || language == '..' || language == 'Binary' ||
File.basename(language) == 'ace_modes.json'
# Each directory contains test files of a language
dirname = File.join(root, language)
Dir.entries(dirname).each do |filename|
# By default blob search the file in the samples;
# thus, we need to give it the absolute path
filepath = File.join(dirname, filename)
next unless File.file?(filepath)
blob = fixture_blob(filepath)
if language == 'Data'
assert blob.language.nil?, "A language was found for #{filepath}"
elsif language == 'Generated'
assert blob.generated?, "#{filepath} is not a generated file"
else
assert blob.language, "No language for #{filepath}"
assert_equal language, blob.language.name, blob.name
end
end
end
end
def test_minified_files_not_safe_to_highlight
assert !sample_blob("JavaScript/jquery-1.6.1.min.js").safe_to_colorize?
end
def test_empty
blob = Struct.new(:data) { include Linguist::BlobHelper }
assert blob.new("").empty?
assert blob.new(nil).empty?
refute blob.new(" ").empty?
refute blob.new("nope").empty?
end
def test_include_in_language_stats
vendored = sample_blob("bower_components/custom/custom.js")
assert_predicate vendored, :vendored?
refute_predicate vendored, :include_in_language_stats?
documentation = fixture_blob("README")
assert_predicate documentation, :documentation?
refute_predicate documentation, :include_in_language_stats?
generated = sample_blob("CSS/bootstrap.min.css")
assert_predicate generated, :generated?
refute_predicate generated, :include_in_language_stats?
data = sample_blob("Ant Build System/filenames/ant.xml")
assert_equal :data, data.language.type
refute_predicate data, :include_in_language_stats?
prose = sample_blob("Markdown/tender.md")
assert_equal :prose, prose.language.type
refute_predicate prose, :include_in_language_stats?
included = sample_blob("HTML/pages.html")
assert_predicate included, :include_in_language_stats?
end
end

View File

@@ -9,7 +9,6 @@ class TestGrammars < Minitest::Test
# This grammar has a nonstandard but acceptable license.
"vendor/grammars/gap-tmbundle",
"vendor/grammars/factor",
# These grammars have no license but have been grandfathered in. New grammars
# must have a license that allows redistribution.
@@ -81,7 +80,7 @@ class TestGrammars < Minitest::Test
end
def test_submodules_have_recognized_licenses
unrecognized = submodule_licenses.select { |k,v| v.nil? && Licensee::Project.new(k).license_file }
unrecognized = submodule_licenses.select { |k,v| v.nil? && Licensee::FSProject.new(k).license_file }
unrecognized.reject! { |k,v| PROJECT_WHITELIST.include?(k) }
message = "The following submodules have unrecognized licenses:\n* #{unrecognized.keys.join("\n* ")}\n"
message << "Please ensure that the project's LICENSE file contains the full text of the license."
@@ -132,7 +131,7 @@ class TestGrammars < Minitest::Test
# Given the path to a submodule, return its SPDX-compliant license key
def submodule_license(submodule)
# Prefer Licensee to detect a submodule's license
project = Licensee::Project.new(submodule)
project = Licensee::FSProject.new(submodule)
return project.license.key if project.license
# We know a license file exists, but Licensee wasn't able to detect the license,

View File

@@ -57,6 +57,7 @@ class TestLanguage < Minitest::Test
assert_equal Language['Shell'], Language.find_by_alias('sh')
assert_equal Language['Shell'], Language.find_by_alias('shell')
assert_equal Language['Shell'], Language.find_by_alias('zsh')
assert_equal Language['SuperCollider'], Language.find_by_alias('supercollider')
assert_equal Language['TeX'], Language.find_by_alias('tex')
assert_equal Language['TypeScript'], Language.find_by_alias('ts')
assert_equal Language['VimL'], Language.find_by_alias('vim')
@@ -119,6 +120,7 @@ class TestLanguage < Minitest::Test
assert_equal 'vim', Language['VimL'].search_term
assert_equal 'jsp', Language['Java Server Pages'].search_term
assert_equal 'rst', Language['reStructuredText'].search_term
assert_equal 'supercollider', Language['SuperCollider'].search_term
end
def test_popular
@@ -138,6 +140,7 @@ class TestLanguage < Minitest::Test
assert_equal :programming, Language['Ruby'].type
assert_equal :programming, Language['TypeScript'].type
assert_equal :programming, Language['Makefile'].type
assert_equal :programming, Language['SuperCollider'].type
end
def test_markup
@@ -227,7 +230,8 @@ class TestLanguage < Minitest::Test
"python" => "Python",
"python2" => "Python",
"python3" => "Python",
"sbcl" => "Common Lisp"
"sbcl" => "Common Lisp",
"sclang" => "SuperCollider"
}.each do |interpreter, language|
assert_equal [Language[language]], Language.find_by_interpreter(interpreter)
end
@@ -339,6 +343,7 @@ class TestLanguage < Minitest::Test
assert Language['Perl'].extensions.include?('.pl')
assert Language['Python'].extensions.include?('.py')
assert Language['Ruby'].extensions.include?('.rb')
assert Language['SuperCollider'].extensions.include?('.scd')
end
def test_primary_extension
@@ -349,6 +354,7 @@ class TestLanguage < Minitest::Test
assert_equal '.coffee', Language['CoffeeScript'].primary_extension
assert_equal '.t', Language['Turing'].primary_extension
assert_equal '.ts', Language['TypeScript'].primary_extension
assert_equal '.sc', Language['SuperCollider'].primary_extension
end
def test_eql

1
vendor/grammars/sublime-pony vendored Submodule

Some files were not shown because too many files have changed in this diff Show More