Skip to content

Commit

Permalink
Remove extension hack in ResolveModule.
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed May 30, 2018
1 parent e401d9e commit 4f00218
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
5 changes: 0 additions & 5 deletions os.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 3 additions & 4 deletions os_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,16 @@ func TestResolveModule4(t *testing.T) {
path.Join(SrcDir, "unpkg.com/[email protected]/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/[email protected]/index.ts"))
if err != nil {
t.Fatalf(err.Error())
}
AssertEqual(t, moduleName,
"https://unpkg.com/[email protected]/util.ts")
"https://unpkg.com/[email protected]/util")
AssertEqual(t, filename,
path.Join(SrcDir, "unpkg.com/[email protected]/util.ts"))
path.Join(SrcDir, "unpkg.com/[email protected]/util"))
}
2 changes: 1 addition & 1 deletion testing/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;

Expand Down
6 changes: 3 additions & 3 deletions testing/util_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit 4f00218

Please sign in to comment.