If $f \in C([a, b],\mathbb{R})$ is differentiable on $(a,b]$ and $\lim_{x\to a}f'(x)$ exists, then $f\in C^1([a, b],\mathbb{R})$? The following is exercise IV.2.3. from Analysis I by Amann and Escher.

Let $-\infty < a < b < \infty$ and $f \in C([a, b],\mathbb{R})$ be differentiable on $(a, b]$. Show that, if $\lim_{x\to a} f'(x)$ exists, then $f$ is in $C^1([a, b],\mathbb{R})$ and $f'(a) = \lim_{x\to a} f'(x)$. (Hint: Use the mean value theorem.)

I think this is false and found a counterexample: Set $b=0$ and define $f:[a,0]\to\mathbb{R}$ by
$$
f(x):=
\begin{cases}
x^2\sin(1/x),&x\in[-a,0);\\
0,&x=0.
\end{cases}
$$
The function $f$ satifies all the hypotheses but $f'$ is not continuous at $x=0$.
Am I right?
Edit: My point is that $\lim_{x\to a} f'(x)$ does not imply $f\in C^1([a, b],\mathbb{R})$, or, roughly speaking, the continuity of $f'$ at $x=a$ does not imply its continuity on the whole interval. However, the second conclusion, $f'(a) = \lim_{x\to a} f'(x)$, is correct.
 A: As I said in the comments, the statement asked to be proved, as stated, is clearly wrong by the very reason you mentioned in your edit. It should be either assumed that $f \in C^1\left((a,b] \right)$, or the conclusion should be changed to then $f$ is differentiable at $a$ and (...). 
Assuming this was an oversight by the authors (which is imho very likely true), let's try to answer the proper question. The method will be the same for both of the possible fixes, so I'll assume the second which does not require continuity of the derivative:

Let $-\infty < a < b < \infty$ and $f \in C([a, b],\mathbb{R})$ be differentiable on $(a, b]$. Show that, if $\lim_{x\to a} f'(x)$ exists, then $f$ is differentiable at $a$ and $f'(a) = \lim_{x\to a} f'(x)$. (Hint: Use the mean value theorem.)

Proof: Let $L:= \lim\limits_{x\to a} f'(x)$. It follows from the hypotheses that $f$ is continuous at $[a,c]$ and differentiable at $(a,c)$ for every $c \leq b$. 
Take $\epsilon>0$. By the definition of limit, there exists $\delta>0$ such that if $x< a+\delta$, then $|f'(x)-L|<\epsilon$. From the mean-value theorem we have that if $x \in (a,a+\delta),$
$$\left|\frac{f(x)-f(a)}{x-a}-L\right|=|f'(\xi_x)-L|<\epsilon,$$
since $\xi_x \in (a,x)$, hence in $(a,a+\delta)$. But this proves precisely that $f'(a)=L$.
