1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

Remove extension hack in ResolveModule.

This commit is contained in:
Ryan Dahl 2018-05-30 18:05:23 +02:00
parent e401d9e21b
commit 4f00218d6d
4 changed files with 7 additions and 13 deletions

5
os.go
View file

@ -76,11 +76,6 @@ func ResolveModule(moduleSpecifier string, containingFile string) (
containingFile = SrcFileToUrl(containingFile)
moduleSpecifier = SrcFileToUrl(moduleSpecifier)
// Hack: If there is no extension, just add .ts
if path.Ext(moduleSpecifier) == "" {
moduleSpecifier = moduleSpecifier + ".ts"
}
logDebug("os.go ResolveModule after moduleSpecifier %s containingFile %s",
moduleSpecifier, containingFile)

View file

@ -72,9 +72,8 @@ func TestResolveModule4(t *testing.T) {
path.Join(SrcDir, "unpkg.com/liltest@0.0.5/index.ts"))
}
func TestResolveModule5(t *testing.T) {
func TestResolveModuleExtensionsAintSpecial(t *testing.T) {
createDirs()
// Files in SrcDir should resolve to URLs.
moduleName, filename, err := ResolveModule(
"./util",
path.Join(SrcDir, "unpkg.com/liltest@0.0.5/index.ts"))
@ -82,7 +81,7 @@ func TestResolveModule5(t *testing.T) {
t.Fatalf(err.Error())
}
AssertEqual(t, moduleName,
"http://unpkg.com/liltest@0.0.5/util.ts")
"http://unpkg.com/liltest@0.0.5/util")
AssertEqual(t, filename,
path.Join(SrcDir, "unpkg.com/liltest@0.0.5/util.ts"))
path.Join(SrcDir, "unpkg.com/liltest@0.0.5/util"))
}

View file

@ -13,7 +13,7 @@
limitations under the License.
*/
export { assert, assertEqual, equal } from "./util";
export { assert, assertEqual, equal } from "./util.ts";
export type TestFunction = () => void | Promise<void>;

View file

@ -13,9 +13,9 @@
limitations under the License.
*/
import { test } from "./index";
import { assert } from "./util";
import * as util from "./util";
import { test } from "./index.ts";
import { assert } from "./util.ts";
import * as util from "./util.ts";
test(async function util_equal() {
assert(util.equal("world", "world"));