mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Use path.extname() instead of fsUtils.extension()
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
window.nakedLoad = (file) ->
|
||||
fsUtils = require 'fs-utils'
|
||||
path = require 'path'
|
||||
file = require.resolve(file)
|
||||
code = fsUtils.read(file)
|
||||
if fsUtils.extension(file) is '.coffee'
|
||||
if path.extname(file) is '.coffee'
|
||||
require('coffee-script').eval(code, filename: file)
|
||||
else
|
||||
window.eval("#{code}\n//@ sourceURL=#{file}")
|
||||
|
||||
@@ -54,14 +54,6 @@ describe "fsUtils", ->
|
||||
expect(fsUtils.split("/a/b/c.txt")).toEqual ["", "a", "b", "c.txt"]
|
||||
expect(fsUtils.split("a/b/c.txt")).toEqual ["a", "b", "c.txt"]
|
||||
|
||||
describe ".extension(path)", ->
|
||||
it "returns the extension of a file", ->
|
||||
expect(fsUtils.extension("a/b/corey.txt")).toBe '.txt'
|
||||
expect(fsUtils.extension("a/b/corey.txt.coffee")).toBe '.coffee'
|
||||
|
||||
it "returns an empty string for paths without an extension", ->
|
||||
expect(fsUtils.extension("a/b.not-extension/a-dir")).toBe ''
|
||||
|
||||
describe ".makeTree(path)", ->
|
||||
beforeEach ->
|
||||
fsUtils.remove("/tmp/a") if fsUtils.exists("/tmp/a")
|
||||
|
||||
Reference in New Issue
Block a user